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

test.py文件执行报错 #29

Open
ghost opened this issue Oct 11, 2022 · 2 comments
Open

test.py文件执行报错 #29

ghost opened this issue Oct 11, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2022

Traceback (most recent call last):
File "D:/Codes/Information-extraction/keyword-extraction/SIFRank_zh/test/test.py", line 16, in
ELMO = word_emb_elmo.WordEmbeddings(model_file)
File "D:\Codes\Information-extraction\keyword-extraction\SIFRank_zh\embeddings\word_emb_elmo.py", line 19, in init
self.elmo = Embedder(model_path)
File "D:\Codes\Information-extraction\keyword-extraction\SIFRank_zh\elmoformanylangs\elmo.py", line 107, in init
self.model, self.config = self.get_model()
File "D:\Codes\Information-extraction\keyword-extraction\SIFRank_zh\elmoformanylangs\elmo.py", line 163, in get_model
model.load_model(self.model_dir)
File "D:\Codes\Information-extraction\keyword-extraction\SIFRank_zh\elmoformanylangs\frontend.py", line 206, in load_model
map_location=lambda storage, loc: storage))
File "D:\softwares\miniconda\envs\torch1.8\lib\site-packages\torch\nn\modules\module.py", line 1224, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ConvTokenEmbedder:
size mismatch for word_emb_layer.embedding.weight: copying a param with shape torch.Size([140384, 100]) from checkpoint, the shape in current model is torch.Size([71222, 100]).
size mismatch for char_emb_layer.embedding.weight: copying a param with shape torch.Size([15889, 50]) from checkpoint, the shape in current model is torch.Size([6169, 50]).

@hyacinth-prog
Copy link

你好,你的问题解决了吗,我也遇到了同样的问题

@HarmonRS
Copy link

HarmonRS commented Feb 2, 2025

这是因为token_embedder.pkl的原因 应该使用哈工大简体中文下载的zhs.model.tar_2.bz2压缩包下的token_embedder.pkl而不是179.zip包下的文件 替换后我成功执行了代码

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