TypeError need help

#1
by ss22s - opened

when i was fine-tuning the Florence-2-base-FT, i meet one problem, shows that:

Traceback (most recent call last):
File "/home/Florence-2/fine_turning.py", line 175, in
trainer.train()
File "/opt/conda/lib/python3.10/site-packages/transformers/trainer.py", line 1885, in train
return inner_training_loop(
File "/opt/conda/lib/python3.10/site-packages/transformers/trainer.py", line 2216, in _inner_training_loop
tr_loss_step = self.training_step(model, inputs)
File "/opt/conda/lib/python3.10/site-packages/transformers/trainer.py", line 3238, in training_step
loss = self.compute_loss(model, inputs)
File "/opt/conda/lib/python3.10/site-packages/transformers/trainer.py", line 3264, in compute_loss
outputs = model(**inputs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/.cache/huggingface/modules/transformers_modules/modeling_florence2.py", line 2760, in forward
return Florence2Seq2SeqLMOutput(
TypeError: Florence2Seq2SeqLMOutput.init() got an unexpected keyword argument 'loss'

can you help me, thx

Did you try to load the model with the PR fix mentioned in https://huggingface.co/blog/finetune-florence2?

Like this:
model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True, revision='refs/pr/6').to(device)
processor = AutoProcessor.from_pretrained("microsoft/Florence-2-base-ft", trust_remote_code=True, revision='refs/pr/6')

The problem has been solved, thanks for your suggestion~
This issue appears to be a code bug that has been fixed by the author: https://huggingface.co/microsoft/Florence-2-large/discussions/12#66752ee0ec54ee155826d156

ss22s changed discussion status to closed

Sign up or log in to comment