How-to-use-Transformers
How-to-use-Transformers copied to clipboard
如何基于transformers库自定义模型?
我试了一下您这个写法,确实可以从from_pretrained方法中加载一些已经预训练过的一些模型,但是前提是这个地方的参数名称一定叫做self.bert
如果我把这一行的名称改写为self.bert_model等等其他的名称,就统统无法用from_pretrained方法成功加载权重了。这样是不是太死板了,有什么别的方法解决吗?
Really? Why rename can make mistake? I have recurrented your code and there is no error. Check out if you have any other problems
同,我也发现了这个问题,很神奇
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?