问题描述
我有一个经过微调的 xlm-roberta-base 模型,用于二进制分类任务,如下所示:
model = XLMRobertaForSequenceClassification.from_pretrained( "xlm-roberta-base",num_labels=2,)
我想使用 maskedlm 重新训练模型,其中输入和标签都是句子,然后再次训练它进行二元分类任务,但我不知道这是否可能,以及这样做的语法是否可能。现在我无法将我的 XLMRobertaForSequenceClassification 加载到 maskedLM 模型中。
model = RobertaForMaskedLM.from_pretrained("xlm-roberta-base") device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") print("device is ",device) model.load_state_dict(torch.load('fine_tuned_model.pt',map_location=torch.device('cpu')))
任何帮助表示赞赏。 谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)