Skip to content

Commit 3be4589

Browse files
committed
accommodate renaming of AutoModelForVision2Seq to AutoModelForImageTextToText
1 parent 008a9f6 commit 3be4589

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

tests/utils/test_embedding_resize.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Third Party
2222
from transformers import (
2323
AutoModelForCausalLM,
24-
AutoModelForVision2Seq,
24+
AutoModelForImageTextToText, #AutoModelForVision2Seq was renamed to this in transformers v5
2525
AutoProcessor,
2626
AutoTokenizer,
2727
)
@@ -212,7 +212,8 @@ def test_resize_with_multiple_of():
212212

213213

214214
def test_resize_llama_vision_model():
215-
model = AutoModelForVision2Seq.from_pretrained(TINY_LLAMA_VISION_MODEL_NAME)
215+
# model = AutoModelForVision2Seq.from_pretrained(TINY_LLAMA_VISION_MODEL_NAME)
216+
model = AutoModelForImageTextToText.from_pretrained(TINY_LLAMA_VISION_MODEL_NAME)
216217
processor = AutoProcessor.from_pretrained(TINY_LLAMA_VISION_MODEL_NAME)
217218
tokenizer = processor.tokenizer
218219

tuning/sft_trainer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from torch.cuda import OutOfMemoryError
3131
from transformers import (
3232
AutoModelForCausalLM,
33-
AutoModelForVision2Seq,
33+
AutoModelForImageTextToText, # AutoModelForVision2Seq was renamed in transformers v5
3434
AutoProcessor,
3535
AutoTokenizer,
3636
TrainerCallback,
@@ -292,7 +292,10 @@ def train(
292292
)
293293
)
294294
# try to load model as a vision model
295-
model = AutoModelForVision2Seq.from_pretrained(
295+
# model = AutoModelForVision2Seq.from_pretrained(
296+
# model_args.model_name_or_path, **model_kwargs
297+
# )
298+
model = AutoModelForImageTextToText.from_pretrained(
296299
model_args.model_name_or_path, **model_kwargs
297300
)
298301
try:

0 commit comments

Comments
 (0)