Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'tuple' object has no attribute 'is_cuda' #52

Open
Tron1994 opened this issue Jan 12, 2023 · 6 comments
Open

AttributeError: 'tuple' object has no attribute 'is_cuda' #52

Tron1994 opened this issue Jan 12, 2023 · 6 comments

Comments

@Tron1994
Copy link

/mpu/transformer.py", line 422, in custom_forward
x_ = layer(x_, inputs[1])
File "/home/jovyan/miniconda3/envs/cpm2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/jovyan/xz_nlp/icode/CPM-2-Finetune-master/mpu/transformer.py", line 304, in forward
layernorm_output = self.input_layernorm(hidden_states)
File "/home/jovyan/miniconda3/envs/cpm2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/jovyan/miniconda3/envs/cpm2/lib/python3.7/site-packages/apex/normalization/fused_layer_norm.py", line 290, in forward
if not input.is_cuda:
AttributeError: 'tuple' object has no attribute 'is_cuda'

报错怎么解

@t1101675
Copy link
Contributor

有没有训练的脚本?

@Tron1994
Copy link
Author

@t1101675
Copy link
Contributor

原来应该也是可以使用 past_key_values 的

@Tron1994
Copy link
Author

原来应该也是可以使用 past_key_values 的
cpm1-finetune:https:/TsinghuaAI/CPM-1-Finetune/blob/main/mpu/transformer.py
cpm1-generate:https:/TsinghuaAI/CPM-1-Generate/blob/main/mpu/transformer.py

cpm1-generate做了更新:TsinghuaAI/CPM-1-Generate@2730b1f#diff-a7922243f0695439497bd5bdae2069ec8fa268d10d549afc26fcd2765646a36e

我仔细对比没发现有什么问题,但是在layernorm_output = self.input_layernorm(hidden_states) 会报 is_cuda的错误

@t1101675
Copy link
Contributor

那用 CPM-1-Generate 也会报错?

@Tron1994
Copy link
Author

那用 CPM-1-Generate 也会报错?

刚跑了可以通,我把cpm1和cpm2放一块了,可能是哪里起冲突了吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants