code: def prepare(self, priming_data):
      if self.is_prepared:
          raise Exception(
              'You can only call "prepare" once for a given encoder.'
          )
  
      no_null_sentences = [
          x if x is not None else "" for x in priming_data
      ]
      estimated_time = (
          1 / 937 * self._train_iters * len(no_null_sentences)
      )
      log_every = math.ceil(self._train_iters / 100)
      log.info(
          "We will train an encoder for this text, on a CPU it will take about {min} minutes".format(
              min=estimated_time
          )
      )
  
      self._input_lang = Lang("input")
      self._output_lang = self._input_lang
  
      for row in no_null_sentences:
          if row is not None:
              self._input_lang.addSentence(row)
  
      max_length = max(map(len, no_null_sentences))
  
      hidden_size = self._encoded_vector_size
      self._encoder = EncoderRNN(
          self._input_lang.n_words, hidden_size
      ).to(self.device)
      self._decoder = DecoderRNN(
          hidden_size, self._output_lang.n_words
      ).to(self.device)
  
      trainIters(
          self._encoder,
          self._decoder,
          self._input_lang,
          self._output_lang,
          no_null_sentences,
          no_null_sentences,
          self._train_iters,
          print_every=int(log_every),
          learning_rate=self._learning_rate,
          loss_breakpoint=self._stop_on_error,
          max_length=max_length,
          device=self.device,
      )
  
      self.is_prepared = True
  
file_path: lightwood/lightwood/encoder/text/rnn.py
imports: from lightwood.encoder.text.helpers.rnn_helpers import *
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.log import log
  import math
label_desc: Use image node_id 2 for calling the RnnEncoder obj's underlying member method code with example usage: obj.prepare(priming_data) without return types