LLaVA-VL / LLaVA-NeXT

Apache License 2.0
2.52k stars 186 forks source link

Weight shape mismatch #187

Closed byungokhan closed 1 month ago

byungokhan commented 1 month ago

I finetuned "llava-onevision-qwen2-7b-si" using my custom data.

After the fine-tuning process, I tried to inference using my finetuned model.

But, when I use the load_pretrained_model function, I met an error like this:

ValueError: Trying to set a tensor of shape torch.Size([152064, 3584]) in "weight" (which has shape torch.Size([151936, 3584])), this looks incorrect.

128 dimension is missing.

Can you help me about this problem?

ChipsICU commented 1 month ago

I do have the same problem, try to use this. overwrite_config = {'tie_word_embeddings': True, 'use_cache': True, "vocab_size": 152064}

ChipsICU commented 1 month ago

if this work for you, plz let me know, thks.

byungokhan commented 1 month ago

Thanks. It does work with transformers==4.40.0 (downgraded) But, the inference result is completely wrong, , as if there is an issue with the tokenizer. Like this; ["duction less1 leaving111 RightRing剧烈 numericaltool'),\nige less lesstool11tooltooltooltooltool lesstooltooltool tractor2namesCharlestooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltooltool Deadline(line Browseelsing Lans哪些、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、"]

How do you think?

ChipsICU commented 1 month ago

@byungokhan Now we have the same problem, LOL!

ChipsICU commented 1 month ago

BTW, 0.5b works fine.

byungokhan commented 1 month ago

Any suggestion for this problem?

byungokhan commented 1 month ago

@ChipsICU This works for 7b. overwrite_config = {'tie_word_embeddings': False, 'use_cache': True, "vocab_size": 152064}

ChipsICU commented 1 month ago

Works for me as well! Many thks.