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 · 3 comments
Open

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

blue-vision0 opened this issue Jan 30, 2024 · 3 comments

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

@QXGeraldMo
Copy link

同,我也发现了这个问题,很神奇

@blue-vision0
Copy link
Author

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

Maybe it has something to do with the transformer package version, if you don`t encounter any error while loading weight which version do you use?

@blue-vision0 blue-vision0 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 7, 2025
@blue-vision0 blue-vision0 reopened this Feb 7, 2025
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

3 participants