MiniGPT-4 icon indicating copy to clipboard operation
MiniGPT-4 copied to clipboard

RuntimeError: The size of tensor a (32000) must match the size of tensor b (32001) at non-singleton dimension 0

Open Coca-Cola1999 opened this issue 2 years ago • 11 comments

RuntimeError: The size of tensor a (32000) must match the size of tensor b (32001) at non-singleton dimension 0 after I execute this command:python -m fastchat.model.apply_delta --base llama-7b-hf/ --target vicuna-7b/ --delta vicuna-7b-delta-v0/

Coca-Cola1999 avatar Apr 24 '23 01:04 Coca-Cola1999

I encountered same problem. I tried to expand para.data using torch.cat, then problem solved.

ibisbill avatar Apr 24 '23 07:04 ibisbill

torch.cat

Can you tell me which file to modify that line of code? I'm a newcomer

Coca-Cola1999 avatar Apr 24 '23 08:04 Coca-Cola1999

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

ibisbill avatar Apr 24 '23 11:04 ibisbill

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

can u show the code please,I am not familiar with Python!I am afraid to change the code in package.

hfchensq1 avatar Apr 25 '23 02:04 hfchensq1

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

Thank u! I can find that code,but how to Modify code. And are you Chinese?Can we add a WeChat account?

Coca-Cola1999 avatar Apr 25 '23 02:04 Coca-Cola1999

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

Thank u!Are you Chinese?Can we add a WeChat account?

你是国人嘛,这咋改那版代码,或者可以加微信沟通~

hfchensq1 avatar Apr 25 '23 02:04 hfchensq1

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

Thank u!Are you Chinese?Can we add a WeChat account?

你是国人嘛,这咋改那版代码,或者可以加微信沟通~

hhhh, 18622563703 微信加我吧

Coca-Cola1999 avatar Apr 25 '23 02:04 Coca-Cola1999

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

Thank u!Are you Chinese?Can we add a WeChat account?

你是国人嘛,这咋改那版代码,或者可以加微信沟通~

hhhh, 18622563703 微信加我吧

加了~

hfchensq1 avatar Apr 25 '23 02:04 hfchensq1

Use version v1.1 rather than v0

yPanStupidog avatar Apr 25 '23 23:04 yPanStupidog

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

Thank u!Are you Chinese?Can we add a WeChat account?

你是国人嘛,这咋改那版代码,或者可以加微信沟通~

hhhh, 18622563703 微信加我吧

加了~

hi. what was the solution?

wthoutanymmries avatar May 19 '23 08:05 wthoutanymmries

model version mismatch~

hfchensq1 avatar May 19 '23 14:05 hfchensq1

hi, the file is: fastchat/model/apply_delta.py line: 137, right before code param.data += delta.state_dict()[name] hope this can help you!

can u show the code please,I am not familiar with Python!I am afraid to change the code in package.

print("Applying the delta")
for name, param in tqdm(base.state_dict().items(), desc="Applying delta"):
    assert name in delta.state_dict()
    # param.data += delta.state_dict()[name]
    param.data = torch.cat((param.data, delta.state_dict()[name]), dim=0)

jiajunhappyelements avatar May 24 '23 15:05 jiajunhappyelements

My setting is same as u, u can just low your fastchat version with the command ' pip install fschat==0.1.10', which can fix this issue. You can see 'FastChat version compatibility' docs in this site: click this

ZyangLee avatar Aug 28 '23 14:08 ZyangLee

My setting is same as u, u can just low your fastchat version with the command ' pip install fschat==0.1.10', which can fix this issue. You can see 'FastChat version compatibility' docs in this site: click this

My terminal command is like: python -m fastchat.model.apply_delta --base /home/yinhang/minigpt4/llama_hf_7b --target /home/yinhang/minigpt4/vicuna --delta /home/yinhang/minigpt4/vicuna-7b-delta-v0 And my fastchat==0.1.10

ZyangLee avatar Aug 28 '23 14:08 ZyangLee