Skip to content

Commit

Permalink
Update NeVA Mixtral Tutorial (#10669)
Browse files Browse the repository at this point in the history
* update neva tutorial to unpack large nemo ckpt

Signed-off-by: paul-gibbons <paul@gibbonspaul.com>

* reword unpacking comment

Signed-off-by: paul-gibbons <paul@gibbonspaul.com>

---------

Signed-off-by: paul-gibbons <paul@gibbonspaul.com>
  • Loading branch information
paul-gibbons authored Oct 1, 2024
1 parent 32503fd commit 140f791
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tutorials/multimodal/NeVA Mixtral Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@
" --input_name_or_path /workspace/checkpoints/mixtral-8x7b-instruct \\\n",
" --output_path /workspace/checkpoints/mixtral-8x7b-instruct.nemo\n",
"\n",
"# Unpacking the NeMo checkpoint\n",
"When working with large NeMo checkpoints, it's efficient to unpack them beforehand. This avoids repeated unpacking every time the model is loaded, saving time and resources. Once unpacked, you can use the checkpoint in the same way as before.\n",
"\n",
"! mkdir mixtral_nemo_unpacked\n",
"! tar -xvf /workspace/checkpoints/mixtral-8x7b-instruct.nemo -C mixtral_nemo_unpacked\n",
"\n",
"# Prepare tokenizer\n",
"! cd /opt && git clone https://github.com/google/sentencepiece.git && \\\n",
" cd sentencepiece && \\\n",
Expand Down Expand Up @@ -237,7 +243,7 @@
"model.tokenizer.library=sentencepiece \\\n",
"model.tokenizer.model=/workspace/checkpoints/mixtral-8x7b-instruct/tokenizer_neva.model \\\n",
"model.data.num_workers=0 \\\n",
"model.mm_cfg.llm.from_pretrained=/workspace/checkpoints/mixtral-8x7b-instruct.nemo \\\n",
"model.mm_cfg.llm.from_pretrained=/workspace/checkpoints/mixtral_nemo_unpacked \\\n",
"model.mm_cfg.llm.model_type=mistral \\\n",
"model.data.conv_template=mistral \\\n",
"model.mm_cfg.vision_encoder.from_pretrained=\"google/siglip-so400m-patch14-384\" \\\n",
Expand Down Expand Up @@ -301,7 +307,7 @@
"model.tokenizer.library=sentencepiece \\\n",
"model.tokenizer.model=/workspace/checkpoints/mixtral-8x7b-instruct/tokenizer_neva.model \\\n",
"model.data.num_workers=0 \\\n",
"model.mm_cfg.llm.from_pretrained=/workspace/checkpoints/mixtral-8x7b-instruct.nemo \\\n",
"model.mm_cfg.llm.from_pretrained=/workspace/checkpoints/mixtral_nemo_unpacked \\\n",
"model.mm_cfg.llm.freeze=False \\\n",
"model.mm_cfg.llm.model_type=mistral \\\n",
"model.data.conv_template=mistral \\\n",
Expand All @@ -325,7 +331,7 @@
"\n",
"NeVA inference via the NeMo Framework can be quickly spun up via the NeMo Launcher and a few modifications to use the default NeVA inference config file.\n",
"\n",
"Inference can be run with a similar command leveraging the provided inference script `neva_evaluation.py` within the container.\n",
"Inference can be run with a similar command leveraging the provided inference script `neva_evaluation.py` within the container. You can unpack the finetuned checkpoint as mentioned earlier in the tutorial to load the model checkpoint faster.\n",
"\n",
"An example of an inference script execution:"
]
Expand Down

0 comments on commit 140f791

Please sign in to comment.