質問編集履歴

1

エラー分の追加及び、画像の添付

2022/10/05 15:06

投稿

ttttt08
ttttt08

スコア17

test CHANGED
File without changes
test CHANGED
@@ -93,3 +93,58 @@
93
93
 
94
94
  上記コードのどこを修正すれば、エラーせず次のコードに進めるのか教えていただきたいです。
95
95
 
96
+
97
+ ##### 追記
98
+
99
+ melian様よりいただいたリンクにてファイルをダウンロードすることが出来ました。
100
+ ```ここに言語を入力
101
+ model = KeyedVectors.load_word2vec_format('/content/GoogleNews-vectors-negative300.bin.gz', binary=True)
102
+ ```
103
+ ファイルのパスを入れ直し実行したところ、以下の様に異なるエラーが出てきました。
104
+
105
+ ```ここに言語を入力
106
+ ---------------------------------------------------------------------------
107
+ EOFError Traceback (most recent call last)
108
+ <ipython-input-3-e3c3e0db66bd> in <module>
109
+ ----> 1 model = KeyedVectors.load_word2vec_format('/content/GoogleNews-vectors-negative300.bin.gz', binary=True)
110
+
111
+ 4 frames
112
+ /usr/local/lib/python3.7/dist-packages/gensim/models/keyedvectors.py in load_word2vec_format(cls, fname, fvocab, binary, encoding, unicode_errors, limit, datatype)
113
+ 1436 return _load_word2vec_format(
114
+ 1437 cls, fname, fvocab=fvocab, binary=binary, encoding=encoding, unicode_errors=unicode_errors,
115
+ -> 1438 limit=limit, datatype=datatype)
116
+ 1439
117
+ 1440 def get_keras_embedding(self, train_embeddings=False):
118
+
119
+ /usr/local/lib/python3.7/dist-packages/gensim/models/utils_any2vec.py in _load_word2vec_format(cls, fname, fvocab, binary, encoding, unicode_errors, limit, datatype)
120
+ 210 word.append(ch)
121
+ 211 word = utils.to_unicode(b''.join(word), encoding=encoding, errors=unicode_errors)
122
+ --> 212 weights = fromstring(fin.read(binary_len), dtype=REAL).astype(datatype)
123
+ 213 add_word(word, weights)
124
+ 214 else:
125
+
126
+ /usr/lib/python3.7/gzip.py in read(self, size)
127
+ 285 import errno
128
+ 286 raise OSError(errno.EBADF, "read() on write-only GzipFile object")
129
+ --> 287 return self._buffer.read(size)
130
+ 288
131
+ 289 def read1(self, size=-1):
132
+
133
+ /usr/lib/python3.7/_compression.py in readinto(self, b)
134
+ 66 def readinto(self, b):
135
+ 67 with memoryview(b) as view, view.cast("B") as byte_view:
136
+ ---> 68 data = self.read(len(byte_view))
137
+ 69 byte_view[:len(data)] = data
138
+ 70 return len(data)
139
+
140
+ /usr/lib/python3.7/gzip.py in read(self, size)
141
+ 491 break
142
+ 492 if buf == b"":
143
+ --> 493 raise EOFError("Compressed file ended before the "
144
+ 494 "end-of-stream marker was reached")
145
+ 495
146
+
147
+ EOFError: Compressed file ended before the end-of-stream marker was reached
148
+ ```
149
+
150
+ ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-10-06/99ecb093-a106-47eb-8fe7-6bae13fc28ea.png)