chino

[w2v] convert text to binary, binary to text

Nov 23rd, 2017
239
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from gensim.models.keyedvectors import KeyedVectors
  2.  
  3. # Convert binary file to text file
  4. w2v_model = KeyedVectors.load_word2vec_format('Path to bin file', binary=True)
  5. w2v_model.save_word2vec_format('Path to output', binary=False)
  6.  
  7. # Convert text file to binary file
  8. w2v_model = KeyedVectors.load_word2vec_format('Path to text file', binary=False)
  9. w2v_model.save_word2vec_format('Path to output', binary=True)
RAW Paste Data