class_docstr: Class to use fasttext inside FARM by converting embeddings to format usable by preprocessing pipeline.
  Farm needs fixed vocab and embeddings. We can construct a vocab for the data we wish to embed.
class_docstr_tok: ["Class","to","use","fasttext","inside","FARM","by","converting","embeddings","to","format","usable","by","preprocessing","pipeline",".","Farm","needs","fixed","vocab","and","embeddings",".","We","can","construct","a","vocab","for","the","data","we","wish","to","embed","."]
code: def _save(self, vocab, embeddings):
      # create config
      lm_config = {
          "embeddings_filename": "vectors.txt",
          "hidden_size": embeddings.shape[1],
          "language": self.language,
          "name": "WordEmbedding_LM",
          "vocab_filename": "vocab.txt",
          "vocab_size": embeddings.shape[0],
      }
      # saving
      if not os.path.exists(self.output_path):
          os.makedirs(self.output_path)
      with open(
          self.output_path / "language_model_config.json", "w"
      ) as file:
          file.write(json.dumps(lm_config, indent=2))
      _save_word2vec_format(
          fname=str(
              self.output_path / lm_config["embeddings_filename"]
          ),
          fvocab=str(self.output_path / lm_config["vocab_filename"]),
          vocab=vocab,
          vectors=embeddings,
      )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import io
  import json
  import logging
  import os
  import unicodedata
  from pathlib import Path
  import numpy
  import pandas
  from tqdm import tqdm
  from transformers import BertTokenizer
  from sklearn.decomposition import TruncatedSVD
  from sklearn.cluster import KMeans
  from collections import Counter
  from farm.file_utils import load_from_cache
label_desc: Use image node_id 7 for calling the Fasttext_converter obj's underlying member method code with example usage: obj._save(vocab, embeddings) without return types