ValueError: invalid literal for int() with base 10 (word2vec)
ValueError: invalid literal for int() with base 10 (word2vec)
我对此有同样的问题 link: 我在这段代码中遇到错误:
def load_bin_vec(fname, vocab)
"""
Loads 300x1 word vecs from Google (Mikolov) word2vec
"""
word_vecs = {}
with open(fname, "rb") as f:
header = f.readline()
vocab_size, layer1_size = map(int, header.split())
binary_len = np.dtype('float32').itemsize * layer1_size
for line in xrange(vocab_size):
ValueError: 以 10 为底的 int() 无效文字:'if' 我该如何解决?
我在python和anaconda中还是新手,但经过一番搜索,我安装了anaconda(最新版)、gensim(最新版)。
在 process_data.py 的第 126 行,我将其从 w2v_file = sys.argv1 to w2v_file = sys.argv[1:] . read about python sys.argv here
更改为
您将在第 293、294 行的 sys.argv[] 上对 conv_net_sent.py 执行相同的操作。
在模块 process_data.py 的第 64 行,将 fname 更改为 "GoogleNews-vectors-negative300.bin"。
该模块将 运行 很好。
我只注意到当 运行 连接 conv_net_sent.py 模块时,在训练阶段,我得到了 python.exe 停止工作错误。
在 anaconda 上使用 spider 时,我收到一个错误:device gpu0 is not available (error: cuda unavailable),目前正在处理。
我希望这有帮助。
此致
我对此有同样的问题 link: 我在这段代码中遇到错误:
def load_bin_vec(fname, vocab)
"""
Loads 300x1 word vecs from Google (Mikolov) word2vec
"""
word_vecs = {}
with open(fname, "rb") as f:
header = f.readline()
vocab_size, layer1_size = map(int, header.split())
binary_len = np.dtype('float32').itemsize * layer1_size
for line in xrange(vocab_size):
ValueError: 以 10 为底的 int() 无效文字:'if' 我该如何解决?
我在python和anaconda中还是新手,但经过一番搜索,我安装了anaconda(最新版)、gensim(最新版)。 在 process_data.py 的第 126 行,我将其从 w2v_file = sys.argv1 to w2v_file = sys.argv[1:] . read about python sys.argv here
更改为您将在第 293、294 行的 sys.argv[] 上对 conv_net_sent.py 执行相同的操作。 在模块 process_data.py 的第 64 行,将 fname 更改为 "GoogleNews-vectors-negative300.bin"。 该模块将 运行 很好。 我只注意到当 运行 连接 conv_net_sent.py 模块时,在训练阶段,我得到了 python.exe 停止工作错误。 在 anaconda 上使用 spider 时,我收到一个错误:device gpu0 is not available (error: cuda unavailable),目前正在处理。 我希望这有帮助。 此致