Version: 3.x


ConveRTFeaturizer Objects

class ConveRTFeaturizer(DenseFeaturizer)

Featurizer using ConveRT model.

Loads the ConveRT( model from TFHub and computes sentence and sequence level feature representations for dense featurizable attributes of each message object.


| @classmethod
| required_components(cls) -> List[Type[Component]]

Components that should be included in the pipeline before this component.


| @classmethod
| required_packages(cls) -> List[Text]

Packages needed to be installed.


| __init__(component_config: Optional[Dict[Text, Any]] = None) -> None

Initializes ConveRTFeaturizer with the model and different encoding signatures.


  • component_config - Configuration for the component.


| train(training_data: TrainingData, config: Optional[RasaNLUModelConfig] = None, **kwargs: Any, ,) -> None

Featurize all message attributes in the training data with the ConveRT model.


  • training_data - Training data to be featurized
  • config - Pipeline configuration
  • **kwargs - Any other arguments.


| process(message: Message, **kwargs: Any) -> None

Featurize an incoming message with the ConveRT model.


  • message - Message to be featurized
  • **kwargs - Any other arguments.


| @classmethod
| cache_key(cls, component_meta: Dict[Text, Any], model_metadata: Metadata) -> Optional[Text]

Cache the component for future use.


  • component_meta - configuration for the component.
  • model_metadata - configuration for the whole pipeline.
  • Returns - key of the cache for future retrievals.


| provide_context() -> Dict[Text, Any]

Store the model in pipeline context for future use.


| tokenize(message: Message, attribute: Text) -> List[Token]

Tokenize the text using the ConveRT model.

ConveRT adds a special char in front of (some) words and splits words into sub-words. To ensure the entity start and end values matches the token values, reuse the tokens that are already assigned to the message. If individual tokens are split up into multiple tokens, add this information to the respected tokens.