ValueError: Trying to set a tensor of shape torch.Size([32005, 1024]) in "weight" (which has shape torch.Size([32003, 1024])), this look incorrect.

#4
by Vectorrent - opened

Somewhere between the conversion from model.safetensors to pytorch_model.bin, this model stopped working for me:

Traceback (most recent call last):
  File "/src/harness.py", line 553, in <module>
    main()
  File "/src/harness.py", line 223, in main
    prototype = aigen(
  File "/src/aigen/aigen/aigen.py", line 185, in __init__
    self.model = AutoModelForCausalLM.from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/auto_factory.py", line 565, in from_pretrained
    return model_class.from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 3307, in from_pretrained
    ) = cls._load_pretrained_model(
  File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 3695, in _load_pretrained_model
    new_error_msgs, offload_index, state_dict_index = _load_state_dict_into_meta_model(
  File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 741, in _load_state_dict_into_meta_model
    set_module_tensor_to_device(model, param_name, param_device, **set_module_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/accelerate/utils/modeling.py", line 285, in set_module_tensor_to_device
    raise ValueError(
ValueError: Trying to set a tensor of shape torch.Size([32005, 1024]) in "weight" (which has shape torch.Size([32003, 1024])), this look incorrect.

I don't know where the extra tokens are coming from, because I'm definitely not adding them. I can use the exact same code, and just swap in any other model, and it will load just fine (not to mention, the old version of THIS one also worked fine). I'm not sure what changed, but it looks like you broke something :(

Somewhere between the conversion from model.safetensors to pytorch_model.bin, this model stopped working for me:

Traceback (most recent call last):
  File "/src/harness.py", line 553, in <module>
    main()
  File "/src/harness.py", line 223, in main
    prototype = aigen(
  File "/src/aigen/aigen/aigen.py", line 185, in __init__
    self.model = AutoModelForCausalLM.from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/auto_factory.py", line 565, in from_pretrained
    return model_class.from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 3307, in from_pretrained
    ) = cls._load_pretrained_model(
  File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 3695, in _load_pretrained_model
    new_error_msgs, offload_index, state_dict_index = _load_state_dict_into_meta_model(
  File "/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py", line 741, in _load_state_dict_into_meta_model
    set_module_tensor_to_device(model, param_name, param_device, **set_module_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/accelerate/utils/modeling.py", line 285, in set_module_tensor_to_device
    raise ValueError(
ValueError: Trying to set a tensor of shape torch.Size([32005, 1024]) in "weight" (which has shape torch.Size([32003, 1024])), this look incorrect.

I don't know where the extra tokens are coming from, because I'm definitely not adding them. I can use the exact same code, and just swap in any other model, and it will load just fine (not to mention, the old version of THIS one also worked fine). I'm not sure what changed, but it looks like you broke something :(

Hello,
It seems I have accidentally loaded the wrong tokenizer when further training this model. I will upload this new tokenizer now.

Locutusque changed discussion status to closed

Sign up or log in to comment