title: Reading a large pre trained fastext word embedding file in python
body: <p>I am doing sentiment analysis and I want to use pre-trained fasttext embeddings, however the file is very large(6.7 GB) and the program takes ages to compile.</p>
  
  <pre><code>fasttext_dir = '/Fasttext'
  embeddings_index = {}
  f = open(os.path.join(fasttext_dir, 'wiki.en.vec'), 'r', encoding='utf-8')
  for line in tqdm(f):
      values = line.rstrip().rsplit(' ')
      word = values[0]
      coefs = np.asarray(values[1:], dtype='float32')
      embeddings_index[word] = coefs
  f.close()
  
  print('found %s word vectors' % len(embeddings_index))
  
  embedding_dim = 300
  
  embedding_matrix = np.zeros((max_words, embedding_dim))
  for word, i in word_index.items():
      if i &lt; max_words:
          embedding_vector = embeddings_index.get(word)
          if embedding_vector is not None:
              embedding_matrix[i] = embedding_vector
  </code></pre>
  
  <p>Is there any way to speedup the process?</p>