运行模型后提示Traceback (most recent call last): File "E:\data\ChatGPT\ChatGPT_Test.py", line 9, in <module> model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium",padding_side="left") File "C:\Users\MIS_L\AppData\Roaming\Python\Python311\site-packages\transformers\models\auto\auto_factory.py", line 471, in from_pretrained return model_class.from_pretrained( File "C:\Users\MIS_L\AppData\Roaming\Python\Python311\site-packages\transformers\modeling_utils.py", line 2498, in from_pretrained model = cls(config, *model_args, **model_kwargs) TypeError: GPT2LMHeadModel.__init__() got an unexpected keyword argument 'padding_side',需要如何修改
时间: 2023-05-27 16:01:30 浏览: 175
linux 下 pip3 报错“ File “/usr/bin/pip3”, line 9, in from pip import mainImportError: canno”处理
5星 · 资源好评率100%
根据提示信息,GPT2LMHeadModel并不支持padding_side参数,因此需要修改AutoModelForCausalLM.from_pretrained()中的padding_side参数为其他可用的参数,如padding_mode或pad_token_id等。例如:
```
model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium", padding_mode="left")
```
阅读全文