Closed jjzhu0579 closed 5 days ago
python3.11 transformers 4.36.2
No response
peft_config = PromptEncoderConfig( task_type=TaskType.CAUSAL_LM, num_virtual_tokens=256, num_attention_heads=2, token_dim=4096, encoder_reparameterization_type=PromptEncoderReparameterizationType.MLP, # 或者 MLP/GRU,视具体需要而定 encoder_num_layers=8, encoder_hidden_size=1024 )
Traceback (most recent call last): File "/share/home/aim/aim_zhujj/glm_pt.py", line 98, in outputs = model(input_ids=input_ids, attention_mask=attention_mask, labels=labels) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/peft/peft_model.py", line 1625, in forward return self.base_model(inputs_embeds=inputs_embeds, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl return forward_call(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/share/home/aim/aim_zhujj/.cache/huggingface/modules/transformers_modules/glm-4-9b-chat/modeling_chatglm.py", line 878, in forward transformer_outputs = self.transformer( ^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/share/home/aim/aim_zhujj/.cache/huggingface/modules/transformers_modules/glm-4-9b-chat/modeling_chatglm.py", line 757, in forward batch_size, seq_length = input_ids.shape ^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'shape'
如果直接使用作者所使用的代码的话,报错: Traceback (most recent call last): File "/share/home/aim/aim_zhujj/glm_pt.py", line 38, in peft_config = PeftConfig( ^^^^^^^^^^^ TypeError: PeftConfig.init() got an unexpected keyword argument 'num_virtual_tokens'
https://github.com/huggingface/peft/issues/1974#issue-2437471248
System Info / 系統信息
python3.11 transformers 4.36.2
Who can help? / 谁可以帮助到您?
No response
Information / 问题信息
Reproduction / 复现过程
peft_config = PromptEncoderConfig( task_type=TaskType.CAUSAL_LM, num_virtual_tokens=256, num_attention_heads=2, token_dim=4096, encoder_reparameterization_type=PromptEncoderReparameterizationType.MLP, # 或者 MLP/GRU,视具体需要而定 encoder_num_layers=8, encoder_hidden_size=1024 )
Expected behavior / 期待表现
Traceback (most recent call last): File "/share/home/aim/aim_zhujj/glm_pt.py", line 98, in
outputs = model(input_ids=input_ids, attention_mask=attention_mask, labels=labels)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/peft/peft_model.py", line 1625, in forward
return self.base_model(inputs_embeds=inputs_embeds, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/share/home/aim/aim_zhujj/.cache/huggingface/modules/transformers_modules/glm-4-9b-chat/modeling_chatglm.py", line 878, in forward
transformer_outputs = self.transformer(
^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl
return self._call_impl(*args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/aim_nuist/aim_zhujj/.conda/envs/blurb/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
return forward_call(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/share/home/aim/aim_zhujj/.cache/huggingface/modules/transformers_modules/glm-4-9b-chat/modeling_chatglm.py", line 757, in forward
batch_size, seq_length = input_ids.shape
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'