title: Memory efficiently loading of pretrained word embeddings from fasttext library with gensim
body: <p>I would like to load pretrained multilingual word embeddings from the fasttext library with gensim; here the link to the embeddings:</p>
  
  <p><a href="https://fasttext.cc/docs/en/crawl-vectors.html" rel="nofollow noreferrer">https://fasttext.cc/docs/en/crawl-vectors.html</a></p>
  
  <p>In particular, I would like to load the following word embeddings: </p>
  
  <ul>
  <li>cc.de.300.vec (4.4 GB) </li>
  <li>cc.de.300.bin (7 GB)</li>
  </ul>
  
  <p>Gensim offers the following two options for loading fasttext files:</p>
  
  <ol>
  <li><p><code>gensim.models.fasttext.load_facebook_model(path, encoding='utf-8')</code>    </p>
  
  <blockquote>
    <ul>
    <li><em>Load the input-hidden weight matrix from Facebook’s native fasttext
    .bin output file.</em></li>
    <li><em>load_facebook_model() loads the full model, not just
    word embeddings, and enables you to continue model training.</em></li>
    </ul>
  </blockquote></li>
  <li><p><code>gensim.models.fasttext.load_facebook_vectors(path, encoding='utf-8')</code></p>
  
  <blockquote>
    <ul>
    <li><em>Load word embeddings from a model saved in Facebook’s native fasttext .bin format.</em></li>
    <li><em>load_facebook_vectors() loads the word embeddings only. Its faster, but does not enable you to continue training.</em></li>
    </ul>
  </blockquote></li>
  </ol>
  
  <p>Source Gensim documentation: 
  <a href="https://radimrehurek.com/gensim/models/fasttext.html#gensim.models.fasttext.load_facebook_model" rel="nofollow noreferrer">https://radimrehurek.com/gensim/models/fasttext.html#gensim.models.fasttext.load_facebook_model</a></p>
  
  <p>Since my laptop has only 8 GB RAM, I am continuing to get MemoryErrors or the loading takes a very long time (up to several minutes).</p>
  
  <p>Is there an option to load these large models from disk more memory efficient?</p>