code: def _fit(self, X, y, sample_weight=None, **kwargs):
      if self.problem_type not in (BINARY, MULTICLASS):
          raise ValueError(
              "FastText model only supports binary or multiclass classification"
          )
  
      try_import_fasttext()
      import fasttext
  
      params = self._get_model_params()
      quantize_model = params.pop("quantize_model", True)
  
      verbosity = kwargs.get("verbosity", 2)
      if "verbose" not in params:
          if verbosity <= 2:
              params["verbose"] = 0
          elif verbosity == 3:
              params["verbose"] = 1
          else:
              params["verbose"] = 2
  
      if sample_weight is not None:
          logger.log(
              15,
              "sample_weight not yet supported for FastTextModel, this model will ignore them in training.",
          )
  
      X = self.preprocess(X)
  
      self._label_dtype = y.dtype
      self._label_map = {
          label: f"__label__{i}" for i, label in enumerate(y.unique())
      }
      self._label_inv_map = {v: k for k, v in self._label_map.items()}
      np.random.seed(0)
      idxs = np.random.permutation(list(range(len(X))))
      with tempfile.NamedTemporaryFile(mode="w+t") as f:
          logger.debug("generate training data")
          for label, text in zip(y.iloc[idxs], (X[i] for i in idxs)):
              f.write(f"{self._label_map[label]} {text}\n")
          f.flush()
          mem_start = ResourceManager.get_memory_rss()
          logger.debug("train FastText model")
          self.model = fasttext.train_supervised(f.name, **params)
          if quantize_model:
              self.model.quantize(input=f.name, retrain=True)
          gc.collect()
          mem_curr = ResourceManager.get_memory_rss()
          self._model_size_estimate = max(
              mem_curr - mem_start,
              100000000 if quantize_model else 800000000,
          )
          logger.debug("finish training FastText model")
  
imports: import contextlib
  import gc
  import logging
  import os
  import tempfile
  import numpy
  import pandas
  from autogluon.common.features.types import S_TEXT
  from autogluon.common.utils.resource_utils import ResourceManager
  from autogluon.common.utils.try_import import try_import_fasttext
  from autogluon.core.constants import BINARY, MULTICLASS
  from autogluon.core.models import AbstractModel
  from .hyperparameters.parameters import get_param_baseline
label_desc: Use image node_id 5 for calling the FastTextModel obj's underlying member method code with example usage: obj._fit(X, y, sample_weight) without return types