rasa.engine.storage.storage
ModelStorage Objects
Serves as storage backend for GraphComponents which need persistence.
create
Creates the storage.
Arguments:
storage_path- Directory which will contain the persisted graph components.
from_model_archive
Unpacks a model archive and initializes a ModelStorage.
Arguments:
storage_path- Directory which will contain the persisted graph components.model_archive_path- The path to the model archive.
Returns:
Initialized model storage, and metadata about the model.
Raises:
UnsupportedModelError if the loaded meta data indicates that the model
has been created with an outdated Rasa version.
metadata_from_archive
Retrieves metadata from archive.
Arguments:
model_archive_path- The path to the model archive.
Returns:
Metadata about the model.
Raises:
UnsupportedModelError if the loaded meta data indicates that the model
has been created with an outdated Rasa version.
write_to
Persists data for a given resource.
This Resource can then be accessed in dependent graph nodes via
model_storage.read_from.
Arguments:
resource- The resource which should be persisted.
Returns:
A directory which can be used to persist data for the given Resource.
read_from
Provides the data of a persisted Resource.
Arguments:
resource- TheResourcewhose persisted should be accessed.
Returns:
A directory containing the data of the persisted Resource.
Raises:
ValueError- In case no persisted data for the givenResourceexists.
create_model_package
Creates a model archive containing all data to load and run the model.
Arguments:
model_archive_path- The path to the archive which should be created.model_configuration- The model configuration (schemas, language, etc.)domain- TheDomainwhich was used to train the model.
Returns:
The model metadata.
ModelMetadata Objects
Describes a trained model.
__post_init__
Raises an exception when the metadata indicates an unsupported version.
Raises:
UnsupportedModelException if the rasa_open_source_version is lower
than the minimum compatible version
as_dict
Returns serializable version of the ModelMetadata.
from_dict
Loads ModelMetadata which has been serialized using metadata.as_dict().
Arguments:
serialized- SerializedModelMetadata(e.g. read from disk).
Returns:
Instantiated ModelMetadata.
