docstr: Estimate memory that will be needed to train a model, and print the estimates to log.
docstr_tok: ["Estimate","memory","that","will","be","needed","to","train","a","model",",","and","print","the","estimates","to","log","."]
code: def estimate_memory(self, vocab_size=None, report=None):
      """Estimate memory that will be needed to train a model, and print the estimates to log."""
      vocab_size = vocab_size or len(self.wv)
      vec_size = self.vector_size * np.dtype(np.float32).itemsize
      l1_size = self.layer1_size * np.dtype(np.float32).itemsize
      report = report or {}
      report["vocab"] = len(self.wv) * (700 if self.hs else 500)
      report["syn0_vocab"] = len(self.wv) * vec_size
      num_buckets = self.wv.bucket
      if self.hs:
          report["syn1"] = len(self.wv) * l1_size
      if self.negative:
          report["syn1neg"] = len(self.wv) * l1_size
      if self.wv.bucket:
          report["syn0_ngrams"] = self.wv.bucket * vec_size
          num_ngrams = 0
          for word in self.wv.key_to_index:
              hashes = ft_ngram_hashes(
                  word, self.wv.min_n, self.wv.max_n, self.wv.bucket
              )
              num_ngrams += len(hashes)
          # A list (64 bytes) with one np.array (100 bytes) per key, with a total of
          # num_ngrams uint32s (4 bytes) amongst them.
          # Only used during training, not stored with the model.
          report["buckets_word"] = (
              64 + (100 * len(self.wv)) + (4 * num_ngrams)
          )  # TODO: caching & calc sensible?
      report["total"] = sum(report.values())
      logger.info(
          "estimated required memory for %i words, %i buckets and %i dimensions: %i bytes",
          len(self.wv),
          num_buckets,
          self.vector_size,
          report["total"],
      )
      return report
  
imports: import logging
  import numpy
  from numpy import ones, vstack, float32
  import gensim.models._fasttext_bin
  from gensim.models.word2vec import Word2Vec
  from gensim.models.keyedvectors import KeyedVectors, prep_vectors
  from gensim import utils
  from gensim.utils import deprecated
  from gensim.models import keyedvectors
label_desc: Use image node_id 4 for calling the FastText obj's underlying member method code with example usage: obj.estimate_memory(vocab_size, report) and returns: report