0
embedding_dict={}
with open('glove.6B.100d.txt') as f:
 for line in f:
    values=line.split()
    word = values[0]
    vectors=np.asarray(values[1:],'float32')
    embedding_dict[word]=vectors
f.close()

ValueError: could not convert string to float: '-' - I have no idea how to fix this problem.

I am using google colab and glove.6B.100d.txt uploaded in files.

Can you please help me solve this error ?

Ekaterina
  • 1
  • 1
  • If you edit your question to show the full error message, including the traceback of involved stack frames, it will help show which line in your code, & line(s) in the libraries you're using, have triggered the error. Also, you could then add your own `try: ... except ValueError: ...` wrapping of the involved line(s) to print exactly what `line` or `values` cause the error. – gojomo Jun 01 '20 at 16:50
  • 1
    Also, are you sure your `glove.6B.100d.txt` file is uncorrupted, and wasn't truncated at any point? (Where did it come from, does downloading it from another source result in the exact same file, etc?) – gojomo Jun 02 '20 at 20:54

0 Answers0