class_docstr: Featurizer using ConveRT model.
  
  Loads the ConveRT(https://github.com/PolyAI-LDN/polyai-models#convert)
  model from TFHub and computes sentence and sequence level feature representations
  for dense featurizable attributes of each message object.
class_docstr_tok: ["Featurizer","using","ConveRT","model",".","Loads","the","ConveRT","(","https",":","\/\/github.com\/PolyAI-LDN\/polyai-models","#","convert",")","model","from","TFHub","and","computes","sentence","and","sequence","level","feature","representations","for","dense","featurizable","attributes","of","each","message","object","."]
docstr: Featurize all message attributes in the training data with the ConveRT model.
  
  Args:
      training_data: Training data to be featurized
  
  Returns:
      featurized training data
docstr_tok: ["Featurize","all","message","attributes","in","the","training","data","with","the","ConveRT","model",".","Args",":","training_data",":","Training","data","to","be","featurized","Returns",":","featurized","training","data"]
code: def process_training_data(
      self, training_data: TrainingData
  ) -> TrainingData:
      """Featurize all message attributes in the training data with the ConveRT model.
  
      Args:
          training_data: Training data to be featurized
  
      Returns:
          featurized training data
      """
      batch_size = 64
  
      for attribute in DENSE_FEATURIZABLE_ATTRIBUTES:
          non_empty_examples = list(
              filter(
                  lambda x: x.get(attribute),
                  training_data.training_examples,
              )
          )
  
          progress_bar = tqdm(
              range(0, len(non_empty_examples), batch_size),
              desc=attribute.capitalize() + " batches",
          )
          for batch_start_index in progress_bar:
              batch_end_index = min(
                  batch_start_index + batch_size,
                  len(non_empty_examples),
              )
  
              # Collect batch examples
              batch_examples = non_empty_examples[
                  batch_start_index:batch_end_index
              ]
  
              (
                  batch_sequence_features,
                  batch_sentence_features,
              ) = self._compute_features(batch_examples, attribute)
  
              self._set_features(
                  batch_examples,
                  batch_sequence_features,
                  batch_sentence_features,
                  attribute,
              )
      return training_data
  
imports: from __future__ import annotations
  import logging
  import os
  from typing import Any, Dict, List, Optional, Text, Tuple, Type
  import tensorflow
  from tensorflow.python.eager.wrap_function import WrappedFunction
  from tqdm import tqdm
  import numpy
  from rasa.engine.graph import GraphComponent, ExecutionContext
  from rasa.engine.recipes.default_recipe import DefaultV1Recipe
  from rasa.engine.storage.storage import ModelStorage
  from rasa.engine.storage.resource import Resource
  import rasa.shared.utils.io
  import rasa.core.utils
  from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer
  from rasa.nlu.featurizers.dense_featurizer.dense_featurizer import DenseFeaturizer
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.constants import DENSE_FEATURIZABLE_ATTRIBUTES, TOKENS_NAMES, NUMBER_OF_SUB_TOKENS
  from rasa.shared.nlu.constants import TEXT, ACTION_TEXT
  from rasa.exceptions import RasaException
  import rasa.nlu.utils
  import rasa.utils.train_utils
label_desc: Use image node_id 18 for calling the ConveRTFeaturizer obj's underlying member method code with example usage: obj.process_training_data(training_data) and returns: training_data