From 140f791c8b925ff2cab31dd564e1c56b44c10c39 Mon Sep 17 00:00:00 2001 From: Paul Gibbons <87940629+paul-gibbons@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:05:41 -0700 Subject: [PATCH] Update NeVA Mixtral Tutorial (#10669) * update neva tutorial to unpack large nemo ckpt Signed-off-by: paul-gibbons * reword unpacking comment Signed-off-by: paul-gibbons --------- Signed-off-by: paul-gibbons --- tutorials/multimodal/NeVA Mixtral Tutorial.ipynb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tutorials/multimodal/NeVA Mixtral Tutorial.ipynb b/tutorials/multimodal/NeVA Mixtral Tutorial.ipynb index 280d3e72b26e..7b33e7f1bfd2 100644 --- a/tutorials/multimodal/NeVA Mixtral Tutorial.ipynb +++ b/tutorials/multimodal/NeVA Mixtral Tutorial.ipynb @@ -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", @@ -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", @@ -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", @@ -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:" ]