LLaVA icon indicating copy to clipboard operation
LLaVA copied to clipboard

[Usage] TypeError: LlavaLlamaForCausalLM.forward() got an unexpected keyword argument 'cache_position'

Open segalinc opened this issue 1 year ago • 3 comments

Describe the issue

Reference issue https://github.com/huggingface/transformers/issues/29426

I also encountered this error with transformers >4.38.2 when trying new LLavaLama3 from https://huggingface.co/xtuner/llava-llama-3-8b-v1_1-hf/discussions/1 I need to use tranformers > 4.39.2 for my work and llava requires 4.37 which is quite old by now. would it be possible to adjust the code and update it to latest versions?

segalinc avatar Apr 23 '24 17:04 segalinc

Hey! This should be solvable by popping the cache_position from inputs in this method.

inputs.pop("cache_position")

The error is raised because calling "super()" returns kwargs that are not used in the custom model's forward.

zucchini-nlp avatar May 20 '24 07:05 zucchini-nlp

@zucchini-nlp It works!

SWHL avatar May 30 '24 01:05 SWHL

This fixed the issue for me as well, thanks!

tseven avatar Jul 11 '24 16:07 tseven