Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 6ae4211

Browse files
authored
Update torchtune pin to Llama 3.2 Release (#1205)
* Update torchtune pin to Llama 3.2 Release * Update flamingo tune components to 3_2 * Bumping the lm_eval install to circumvent tune dependency
1 parent f7aef8a commit 6ae4211

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

install/install_requirements.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ REQUIREMENTS_TO_INSTALL=(
9090
# Rely on the latest tochtune for flamingo support
9191
(
9292
set -x
93-
$PIP_EXECUTABLE install git+https://github.com/pytorch/torchtune.git@18efc81dda1c537bb7c25058ff059b4623ccff58
93+
$PIP_EXECUTABLE install git+https://github.com/pytorch/torchtune.git@d002d45e3ec700fa770d9dcc61b02c59e2507bf6
9494
)
9595

9696
if [[ -x "$(command -v nvidia-smi)" ]]; then
@@ -99,3 +99,9 @@ if [[ -x "$(command -v nvidia-smi)" ]]; then
9999
$PYTHON_EXECUTABLE torchchat/utils/scripts/patch_triton.py
100100
)
101101
fi
102+
103+
104+
(
105+
set -x
106+
$PIP_EXECUTABLE install lm-eval=="0.4.2"
107+
)

install/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ snakeviz
1414
sentencepiece
1515
numpy < 2.0
1616
gguf
17-
lm-eval==0.4.2
1817
blobfile
1918
tomli >= 1.1.0 ; python_version < "3.11"
2019
openai

torchchat/model.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
)
3232
from torch.nn import functional as F
3333

34-
from torchtune.models.flamingo import flamingo_decoder, flamingo_vision_encoder
34+
from torchtune.models.clip import clip_vision_encoder
3535
from torchtune.models.llama3_1._component_builders import llama3_1 as llama3_1_builder
36+
from torchtune.models.llama3_2_vision._component_builders import (
37+
llama3_2_vision_decoder,
38+
llama3_2_vision_encoder,
39+
)
3640
from torchtune.modules.model_fusion import DeepFusionModel
37-
from torchtune.models.clip import clip_vision_encoder
3841

3942
from torchchat.utils.build_utils import find_multiple, get_precision
4043

@@ -213,7 +216,10 @@ def _llama3_1(cls):
213216
def _flamingo(cls):
214217
return cls(
215218
model_type=ModelType.Flamingo,
216-
modules={"encoder": flamingo_vision_encoder, "decoder": flamingo_decoder},
219+
modules={
220+
"encoder": llama3_2_vision_encoder,
221+
"decoder": llama3_2_vision_decoder
222+
},
217223
fusion_class=DeepFusionModel,
218224
)
219225

torchchat/usages/openai_api.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717

1818
import torch
1919

20-
from torchtune.models.llama3_2_vision._convert_weights import padded_collate
21-
from torchtune.models.llama3_2_vision._model_builders import llama3_2_vision_transform
22-
2320
from PIL import Image
24-
from torchtune.data import Message
21+
22+
from torchtune.data import Message, padded_collate
23+
from torchtune.models.llama3_2_vision._model_builders import llama3_2_vision_transform
2524

2625
from torchchat.cli.download import is_model_downloaded, load_model_configs
2726
from torchchat.generate import Generator, GeneratorArgs
@@ -374,7 +373,9 @@ def chunked_completion(self, completion_request: CompletionRequest):
374373
images.append(Image.open(BytesIO(base64_decoded)))
375374
print("images:", len(images), flush=True)
376375
if len(images) > 0:
377-
transform = llama3_2_vision_transform(str(self.tokenizer_args.tokenizer_path))
376+
transform = llama3_2_vision_transform(
377+
str(self.tokenizer_args.tokenizer_path)
378+
)
378379
torchtune_messages = self._openai_messages_to_torchtune(
379380
completion_request.messages
380381
)

0 commit comments

Comments
 (0)