code: def train_new_model(
      self,
      texts,
      context_labels=None,
      num_epochs=50,
      gen_epochs=1,
      batch_size=128,
      dropout=0.0,
      train_size=1.0,
      validation=True,
      save_epochs=0,
      multi_gpu=False,
      **kwargs,
  ):
      self.config = self.default_config.copy()
      self.config.update(**kwargs)
  
      print(
          "Training new model w/ {}-layer, {}-cell {}LSTMs".format(
              self.config["rnn_layers"],
              self.config["rnn_size"],
              "Bidirectional "
              if self.config["rnn_bidirectional"]
              else "",
          )
      )
  
      # Create text vocabulary for new texts
      # if word-level, lowercase; if char-level, uppercase
      self.tokenizer = Tokenizer(
          filters="",
          lower=self.config["word_level"],
          char_level=(not self.config["word_level"]),
      )
      self.tokenizer.fit_on_texts(texts)
  
      # Limit vocab to max_words
      max_words = self.config["max_words"]
      self.tokenizer.word_index = {
          k: v
          for (k, v) in self.tokenizer.word_index.items()
          if v <= max_words
      }
  
      if not self.config.get("single_text", False):
          self.tokenizer.word_index[self.META_TOKEN] = (
              len(self.tokenizer.word_index) + 1
          )
      self.vocab = self.tokenizer.word_index
      self.num_classes = len(self.vocab) + 1
      self.indices_char = dict((self.vocab[c], c) for c in self.vocab)
  
      # Create a new, blank model w/ given params
      self.model = textgenrnn_model(
          self.num_classes, dropout=dropout, cfg=self.config
      )
  
      # Save the files needed to recreate the model
      with open(
          "{}_vocab.json".format(self.config["name"]),
          "w",
          encoding="utf8",
      ) as outfile:
          json.dump(
              self.tokenizer.word_index, outfile, ensure_ascii=False
          )
  
      with open(
          "{}_config.json".format(self.config["name"]),
          "w",
          encoding="utf8",
      ) as outfile:
          json.dump(self.config, outfile, ensure_ascii=False)
  
      self.train_on_texts(
          texts,
          new_model=True,
          via_new_model=True,
          context_labels=context_labels,
          num_epochs=num_epochs,
          gen_epochs=gen_epochs,
          train_size=train_size,
          batch_size=batch_size,
          dropout=dropout,
          validation=validation,
          save_epochs=save_epochs,
          multi_gpu=multi_gpu,
          **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 5 for calling the textgenrnn obj's underlying member method code with example usage: obj.train_new_model(texts, context_labels, num_epochs, gen_epochs, batch_size, dropout, train_size, validation, save_epochs, multi_gpu) without return types