code: def train_from_file(
      self,
      file_path,
      header=True,
      delim="\n",
      new_model=False,
      context=None,
      is_csv=False,
      **kwargs,
  ):
      context_labels = None
      if context:
          texts, context_labels = textgenrnn_texts_from_file_context(
              file_path
          )
      else:
          texts = textgenrnn_texts_from_file(
              file_path, header, delim, is_csv
          )
  
      print("{:,} texts collected.".format(len(texts)))
      if new_model:
          self.train_new_model(
              texts, context_labels=context_labels, **kwargs
          )
      else:
          self.train_on_texts(
              texts, context_labels=context_labels, **kwargs
          )
  
imports: import json
  import re
  import numpy
  import tensorflow
  import tqdm
  from pkg_resources import resource_filename
  from sklearn.decomposition import PCA
  from sklearn.manifold import TSNE
  from sklearn.metrics.pairwise import cosine_similarity
  from sklearn.preprocessing import LabelBinarizer
  from tensorflow import config
  from tensorflow.compat.v1.keras.backend import set_session
  from tensorflow.keras.callbacks import LearningRateScheduler
  from tensorflow.keras.models import Model
  from tensorflow.keras.optimizers import Adam
  from tensorflow.keras.preprocessing.text import Tokenizer, text_to_word_sequence
  from .model import textgenrnn_model
  from .model_training import generate_sequences_from_texts
  from .utils import generate_after_epoch, save_model_weights, textgenrnn_encode_sequence, textgenrnn_generate, textgenrnn_texts_from_file, textgenrnn_texts_from_file_context
label_desc: Use image node_id 9 for calling the textgenrnn obj's underlying member method code with example usage: obj.train_from_file(file_path, header, delim, new_model, context, is_csv) without return types