We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Traceback (most recent call last): File "C:/Users/user/PycharmProjects/textgeneration/Preprocess.py", line 77, in vocab, _ = Read_WordVec(config) File "C:/Users/user/PycharmProjects/textgeneration/Preprocess.py", line 36, in Read_WordVec assert len(wordLS) == config.vocab_size AssertionError
The text was updated successfully, but these errors were encountered:
这里的 word2vec 文件存储的格式是第一行注明 vocab_siz embedding_size 的,读取的时候跳过了这一行。猜测是因为少了一行导致,可以把读取第一行的注释掉:
def Read_WordVec(config): with open(config.vec_file, 'r') as fvec: wordLS = [] vec_ls =[] # fvec.readline() # 这一行是读取文件头信息的,如果没有信息可以注释掉,避免 size 不匹配
Sorry, something went wrong.
您好,请问这个问题解决了吗,我注释了fvec.readline(),但依然报错assert len(wordLS) == config.vocab_size AssertionError
@19970623 这里把 vocab_size 设置成词表大小就行了(即和 vec_file 里word数量相同)
No branches or pull requests
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/textgeneration/Preprocess.py", line 77, in
vocab, _ = Read_WordVec(config)
File "C:/Users/user/PycharmProjects/textgeneration/Preprocess.py", line 36, in Read_WordVec
assert len(wordLS) == config.vocab_size
AssertionError
The text was updated successfully, but these errors were encountered: