notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.x).

Version: Master/Unreleased

rasa.graph_components.validators.finetuning_validator

FineTuningValidator Objects

class FineTuningValidator(GraphComponent)

Component that checks whether fine-tuning is possible.

This is a component at the beginning of the graph which receives all training data and raises an exception in case is_finetuning is True and finetuning is not possible (e.g. because new labels were added). In case we are doing a regular training (and not finetuning) this persists the necessary information extracted from the training data to be able to validate when initialized via load whether we can finetune.

Finetuning is possible if, compared to the initial training phase, it holds that

  1. the configuration (except for "epoch" keys) does not change
  2. the domain (except for "responses") does not change - or we're not finetuning the core part
  3. the intents, entities, entity groups, entity roles, and action names that appeared in the original NLU training data, appear in the NLU training data used for finetuning, and no new such items (i.e. intents, entities, entity groups, entity roles, or action names) have been added, compared to the original training data - or we're not finetuning the nlu part. Note that even though conditions 2. and 3. differ based on which part we finetune, condition 1. always covers both parts, i.e. NLU and Core.

__init__

def __init__(model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, fingerprints: Optional[Dict[Text, Text]] = None) -> None

Instantiates a FineTuningValidator.

Arguments:

  • model_storage - Storage which graph components can use to persist and load themselves.
  • resource - Resource locator for this component which can be used to persist and load itself from the model_storage.
  • execution_context - Information about the current graph run.
  • fingerprints - a dictionary of fingerprints generated by a FineTuningValidator

validate_nlu_only

def validate_nlu_only(importer: TrainingDataImporter) -> None

Validates whether we can finetune the NLU part when finetuning is enabled.

Arguments:

  • importer - a training data importer

Raises:

InvalidConfigException if there is a conflict

validate_core_only

def validate_core_only(importer: TrainingDataImporter) -> None

Validates whether we can finetune the Core part when finetuning is enabled.

Arguments:

  • importer - a training data importer

Raises:

InvalidConfigException if there is a conflict

validate

def validate(importer: TrainingDataImporter) -> None

Validates whether we can finetune Core and NLU when finetuning is enabled.

Arguments:

  • importer - a training data importer

Raises:

InvalidConfigException if there is a conflict

create

@classmethod
def create(cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext) -> FineTuningValidator

Creates a new FineTuningValidator (see parent class for full docstring).

persist

def persist() -> None

Persists this FineTuningValidator.

load

@classmethod
def load(cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, **kwargs: Any, ,) -> GraphComponent

Loads a FineTuningValidator (see parent class for full docstring).