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

如何基于transformers库自定义模型? #16

Open
blue-vision0 opened this issue Jan 30, 2024 · 1 comment
Open

如何基于transformers库自定义模型? #16

blue-vision0 opened this issue Jan 30, 2024 · 1 comment

Comments

@blue-vision0
Copy link

image
我试了一下您这个写法,确实可以从from_pretrained方法中加载一些已经预训练过的一些模型,但是前提是这个地方的参数名称一定叫做self.bert
如果我把这一行的名称改写为self.bert_model等等其他的名称,就统统无法用from_pretrained方法成功加载权重了。这样是不是太死板了,有什么别的方法解决吗?

@Melmaphother
Copy link

Really? Why rename can make mistake? I have recurrented your code and there is no error. Check out if you have any other problems

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