File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121# Third Party
2222from 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
214214def 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
Original file line number Diff line number Diff line change 3030from torch .cuda import OutOfMemoryError
3131from 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 :
You can’t perform that action at this time.
0 commit comments