Skip to content

用xlsearch训练时,最后得到torch.nn.modules.module._IncompatibleKeys文件 #7

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

Open
Liunanzhu opened this issue Feb 22, 2023 · 1 comment

Comments

@Liunanzhu
Copy link

老师您好,我想咨询在使用 raynardj/yuan/tree/main/nbs 中的 xlsearch.ipynb 进行训练时,最后得到了一个torch.nn.modules.module._IncompatibleKeys文件的事情,

在执行过:module.load_state_dict(torch.load(best, map_location="cpu")['state_dict']) 之后,
我将它保存为pytorch_model.bin文件:Ptorch.save(module,"···/pytorch_model.bin")

然后我想调用这个模型测试一下训练效果(embedder = SentenceTransformer()),报错提示:
no sentence-transformers model found with name ```. Creating a new one with MEAN pooling.

求问这个文件要怎样才能作为一个模型测试它的训练结果,感谢感谢

@Liunanzhu
Copy link
Author

老师您好,我想咨询在使用 raynardj/yuan/tree/main/nbs 中的 xlsearch.ipynb 进行训练时,最后得到了一个torch.nn.modules.module._IncompatibleKeys文件的事情,

在执行过:module.load_state_dict(torch.load(best, map_location="cpu")['state_dict']) 之后, 我将它保存为pytorch_model.bin文件:Ptorch.save(module,"···/pytorch_model.bin")

然后我想调用这个模型测试一下训练效果(embedder = SentenceTransformer()),报错提示: no sentence-transformers model found with name ```. Creating a new one with MEAN pooling.

求问这个文件要怎样才能作为一个模型测试它的训练结果,感谢感谢

我的报错没有写完整,报错提示:'MaskedLM' object has no attribute 'keys'

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

1 participant