谁能建议我如何解决此错误。我只是在加载手套向量,在尝试迭代时,它显示了这个错误
embeddings_index = dict()
f = open('/content/drive/My Drive/lstm donor/lstm_glove_vectors')
for line in f:
values = line.split()
word = values[0]
coefs = asarray(values[1:], dtype='float32')
embeddings_index[word] = coefs
f.close()
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-79-3373015fdc0b> in <module>()
1 embeddings_index = dict()
2 with open('/content/drive/My Drive/lstm donor/lstm_glove_vectors','r',encoding='utf-8') as f:
----> 3 for line in f:
4 values = line.split()
5 word = values[0]
/usr/lib/python3.6/codecs.py in decode(self, input, final)
319 # decode input (taking the buffer into account)
320 data = self.buffer + input
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
322 # keep undecoded input until the next call
323 self.buffer = data[consumed:]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte