InternLM / InternLM/InternLM-XComposer
NotImplementedError when running official example code of InternLM-XComposer-2.5-Reward
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
When I run the official example code, I noticed there are warnings:
```
/home/tiger/miniconda3/envs/internlm/lib/python3.11/site-packages/torch/nn/modules/module.py:2397: UserWarning: for vision_model.encoder.layers.10.mlp.fc2.weight: copying from a non-meta parameter in the checkpoint to a meta parameter in the current model, which is a no-op. (Did you mean to pass `assign=True` to assign items in the state dictionary to their corresponding key in the module instead of copying them in place?)
warnings.warn(
/home/tiger/miniconda3/envs/internlm/lib/python3.11/site-packages/torch/nn/modules/module.py:2397: UserWarning: for vision_model.encoder.layers.10.mlp.fc2.bias: copying from a non-meta parameter in the checkpoint to a meta parameter in the current model, which is a no-op. (Did you mean to pass `assign=True` to assign items in the state dictionary to their corresponding key in the module instead of copying them in place?)
warnings.warn(
/home/tiger/miniconda3/envs/internlm/lib/python3.11/site-packages/torch/nn/modules/module.py:2397: UserWarning: for vision_model.encoder.layers.10.layer_norm2.weight: copying from a non-meta parameter in the checkpoint to a meta parameter in the current model, which is a no-op. (Did you mean to pass `assign=True` to assign items in the state dictionary to their corresponding key in the module instead of copying them in place?)
warnings.warn(
/home/tiger/miniconda3/envs/internlm/lib/python3.11/site-packages/torch/nn/modules/module.py:2397: UserWarning: for vision_model.encoder.layers.10.layer_norm2.bias: copying from a non-meta parameter in the checkpoint to a meta parameter in the current model, which is a no-op. (Did you mean to pass `assign=True` to assign items in the state dictionary to their corresponding key in the module instead of copying them in place?)
```
which may lead to further errors:
```
Traceback (most recent call last):
File "code/videogen/eval/InternLM-XComposer-2.5-Reward/inference.py", line 4, in
model = AutoModel.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tiger/.local/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 559, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tiger/.local/lib/python3.11/site-packages/transformers/modeling_utils.py", line 261, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tiger/.local/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4371, in from_pretrained
dispatch_model(model, **device_map_kwargs)
File "/usr/local/lib/python3.11/dist-packages/accelerate/big_modeling.py", line 498, in dispatch_model
model.to(device)
File "/home/tiger/.local/lib/python3.11/site-packages/transformers/modeling_utils.py", line 3142, in to
return super().to(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/torch/nn/modules/module.py", line 1340, in to
return self._apply(convert)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/torch/nn/modules/module.py", line 900, in _apply
module._apply(fn)
File "/usr/local/lib/python3.11/dist-packages/torch/nn/modules/module.py", line 900, in _apply
module._apply(fn)
File "/usr/local/lib/python3.11/dist-packages/torch/nn/modules/module.py", line 900, in _apply
module._apply(fn)
[Previous line repeated 3 more times]
File "/usr/local/lib/python3.11/dist-packages/torch/nn/modules/module.py", line 927, in _apply
param_applied = fn(param)
^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/torch/nn/modules/module.py", line 1333, in convert
raise NotImplementedError(
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty() instead of torch.nn.Module.to() when moving module from meta to a different device.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.