We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
因为网络原因,我本地下载了gpt2模型,并修改了原代码中GPT4TS.py 36行处: self.gpt2 = GPT2Model.from_pretrained('gpt2', output_attentions=True, output_hidden_states=True) 为 self.gpt2 = AutoModelForCausalLM.from_pretrained("/***/models--openai-community--gpt2/snapshots/607a30d783dfa663caf39e06633721c8d4cfcd7e", output_attentions=True, output_hidden_states=True) 然后在运行脚本时遇到问题: self.gpt2.h = self.gpt2.h[:configs.gpt_layers]处报错 AttributeError: 'GPT2LMHeadModel' object has no attribute 'h'
self.gpt2 = GPT2Model.from_pretrained('gpt2', output_attentions=True, output_hidden_states=True)
self.gpt2 = AutoModelForCausalLM.from_pretrained("/***/models--openai-community--gpt2/snapshots/607a30d783dfa663caf39e06633721c8d4cfcd7e", output_attentions=True, output_hidden_states=True)
self.gpt2.h = self.gpt2.h[:configs.gpt_layers]
The text was updated successfully, but these errors were encountered:
可以看一下源码https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py 与使用方式,GPT2LMHeadModel的一个变量transformer是GPT2Model
Sorry, something went wrong.
No branches or pull requests
因为网络原因,我本地下载了gpt2模型,并修改了原代码中GPT4TS.py 36行处:
self.gpt2 = GPT2Model.from_pretrained('gpt2', output_attentions=True, output_hidden_states=True)
为
self.gpt2 = AutoModelForCausalLM.from_pretrained("/***/models--openai-community--gpt2/snapshots/607a30d783dfa663caf39e06633721c8d4cfcd7e", output_attentions=True, output_hidden_states=True)
然后在运行脚本时遇到问题:
self.gpt2.h = self.gpt2.h[:configs.gpt_layers]
处报错AttributeError: 'GPT2LMHeadModel' object has no attribute 'h'
The text was updated successfully, but these errors were encountered: