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

运行短期预测时报错 #34

Open
licx11 opened this issue Apr 1, 2024 · 1 comment
Open

运行短期预测时报错 #34

licx11 opened this issue Apr 1, 2024 · 1 comment

Comments

@licx11
Copy link

licx11 commented Apr 1, 2024

因为网络原因,我本地下载了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'

@PSacfc
Copy link
Collaborator

PSacfc commented Apr 1, 2024

可以看一下源码https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py 与使用方式,GPT2LMHeadModel的一个变量transformer是GPT2Model

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