You are viewing documentation for our open source project which is maintained by the community. If you want to get started building assistants with Rasa please check out our latest [documentation here](/content/docs/index.html).

×

SearchK

This page contains information about changes between major versions and
how you can migrate from one version to another.

## Rasa 3.0 to 3.1 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-30-to-31 "Direct link to heading")

### Machine Learning Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#machine-learning-components "Direct link to heading")

#### TensorFlow Upgrade [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#tensorflow-upgrade "Direct link to heading")

Due to the TensorFlow upgrade, we can't guarantee the exact same output and hence
model performance if your configuration uses `LanguageModelFeaturizer`.
This applies to the case where the model is re-trained with the new Rasa
version without changing the configuration, random seeds, and data as well as to the
case where a model trained with a previous version of Rasa is loaded with
this new version for inference.

Please check whether your trained model still performs as expected and retrain if needed.

### NLU JSON Format [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#nlu-json-format "Direct link to heading")

[NLU training data](https://legacy-docs-oss.rasa.com/docs/rasa/nlu-training-data) in JSON format is deprecated and will be
removed in Rasa 4.0.
Please use `rasa data convert nlu -f yaml --data <path to NLU data>` to convert your
NLU JSON data to YAML format before support for NLU JSON data is removed.

## Rasa 2.x to 3.0 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-2x-to-30 "Direct link to heading")

### Markdown Data [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#markdown-data "Direct link to heading")

Markdown is no longer supported — all the supporting code that was previously deprecated is
now removed, and the convertors are removed as well.

The related CLI commands `rasa data convert responses` and `rasa data convert config`
were removed.

If you still have training data in Markdown format then the recommended approach is to use Rasa 2.x
to convert your data from Markdown to YAML. Please use the commands described
[here](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#training-data-files).

### Model Configuration [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#model-configuration "Direct link to heading")

It is required to specify the used `recipe` within the
[model configuration](https://legacy-docs-oss.rasa.com/docs/rasa/model-configuration). As of now Rasa only supports
the `default.v1` recipe and will continue using it even if you don't specify a recipe
in the model configuration. To avoid breaking changes in the future you should
to specify `recipe: "default.v1"` at the top of your model configuration:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

recipe: default.v1

language: en

pipeline:

...

policies:

...

### Custom Policies and Custom Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#custom-policies-and-custom-components "Direct link to heading")

Rasa 3.0 changed the way [NLU components](https://legacy-docs-oss.rasa.com/docs/rasa/components) and
[policies](https://legacy-docs-oss.rasa.com/docs/rasa/policies) are trained and run during inference. As part of these changes
the interfaces for NLU components and policies have been unified and adapted.

The next sections outline which adaptions are required to run your custom NLU components
and policies with Rasa 3.0.

##### caution

Please read the updated guide on custom graph components [here](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components) before
continuing to follow the step-by-step guide to migrate your own custom graph components.

**Type Annotations**

Until Rasa 3.0 [type annotations](https://docs.python.org/3/library/typing.html)
were not required in custom policies or custom NLU components.
It is now required to use
[type annotations](https://docs.python.org/3/library/typing.html) in custom NLU
components and policies. Rasa uses these type annotations to validate that
your graph components are compatible and correctly configured. As outlined in the custom
[components guide](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components) it is not allowed to use
[forward references](https://www.python.org/dev/peps/pep-0484/#forward-references).

##### Forward References with Python 3.7

Use the
[`from __future__ import annotations`](https://www.python.org/dev/peps/pep-0563/#enabling-the-future-behavior-in-python-3-7)
import to avoid using forward references with Python 3.7.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from \_\_future\_\_ import annotations

from typing import List, Any

from rasa.core.policies.policy import Policy

from rasa.engine.storage.resource import Resource

from rasa.shared.core.domain import Domain

from rasa.shared.core.generator import TrackerWithCachedStates

classMyPolicy(Policy):

deftrain(

self,

training\_trackers: List\[TrackerWithCachedStates\],

domain: Domain,

\*\*kwargs: Any,

)-> Resource:

...

#### Changes to Custom NLU Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#changes-to-custom-nlu-components "Direct link to heading")

**Inheriting from `GraphComponent`**

NLU components which previously inherited from one of the following classes additionally
need to inherit from the
[`GraphComponent` interface](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components#the-graphcomponent-interface):

- `SparseFeaturizer`
- `DenseFeaturizer`
- `IntentClassifier`
- `EntityExtractor`
- `Component`

This snippet shows the required changes:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from rasa.engine.graph import GraphComponent

from rasa.nlu.featurizers.sparse\_featurizer.sparse\_featurizer import SparseFeaturizer

classMyNLUComponent(GraphComponent, SparseFeaturizer):

...

**Inheriting from `EntityExtractorMixin` instead of `EntityExtractor`**

The `EntityExtractor` class was renamed to `EntityExtractorMixin`:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from rasa.engine.graph import GraphComponent

from rasa.nlu.extractors.extractor import EntityExtractorMixin

classMyNLUComponent(GraphComponent, EntityExtractorMixin):

...

**Instantiating a NLU Component for Training**

NLU components are no longer instantiated via their constructor. Instead, all NLU
components have to override the `create` method of the
[`GraphComponent` interface](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components#the-graphcomponent-interface). The
passed in configuration is your NLU component's default configuration including any updates
from your model configuration file.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import Dict, Text, Any

from rasa.engine.graph import GraphComponent, ExecutionContext

from rasa.engine.storage.resource import Resource

from rasa.engine.storage.storage import ModelStorage

from rasa.nlu.classifiers.classifier import IntentClassifier

classMyNLUComponent(GraphComponent, IntentClassifier):

def\_\_init\_\_(self, component\_config: Dict\[Text, Any\])->None:

self.component\_config = component\_config

...

@classmethod

defcreate(

cls,

config: Dict\[Text, Any\],

model\_storage: ModelStorage,

resource: Resource,

execution\_context: ExecutionContext,

)-> GraphComponent:

return cls(config)

**Persisting a Trained NLU Component**

NLU components used to be persisted by a call to the NLU component's `persist` method
from outside the NLU component itself.
With Rasa 3.0 NLU components are responsible for persisting themselves.
Use the provided `model_storage` and `resource` parameters
to persist your NLU component at the end of the training and then return the `resource`
as result of your NLU component's `train` method.
See [component persistence](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components#model-persistence) for more details.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from rasa.engine.graph import GraphComponent

from rasa.engine.storage.resource import Resource

from rasa.nlu.classifiers.classifier import IntentClassifier

from rasa.shared.nlu.training\_data.training\_data import TrainingData

classMyNLUComponent(GraphComponent, IntentClassifier):

deftrain(self, training\_data: TrainingData)-> Resource:

...

self.persist()

return self.\_resource

defpersist(self)->None:

with self.\_model\_storage.write\_to(self.\_resource)as directory:

model\_data\_file = directory /"model\_data.json"

rasa.shared.utils.io.dump\_obj\_as\_json\_to\_file(model\_data\_file,

self.get\_model\_data())

...

**Instantiating a Trained NLU Component**

Previously NLU components had to persist their own configuration. Now the config passed
into `load` will automatically contain the configuration which your model was trained with.
To instantiate a persisted NLU component, you need to use `model_storage` and `resource` in your NLU component's
`load` method.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from \_\_future\_\_ import annotations

import json

from typing import Any, Text, Dict

from rasa.engine.graph import GraphComponent, ExecutionContext

from rasa.engine.storage.resource import Resource

from rasa.engine.storage.storage import ModelStorage

from rasa.nlu.classifiers.classifier import IntentClassifier

from rasa.shared.exceptions import FileIOException

classMyNLUComponent(GraphComponent, IntentClassifier):

@classmethod

defload(

cls,

config: Dict\[Text, Any\],

model\_storage: ModelStorage,

resource: Resource,

execution\_context: ExecutionContext,

\*\*kwargs: Any,

)-> MyNLUComponent:

model\_data ={}

try:

with model\_storage.read\_from(resource)as path:

model\_data\_file = path /"model\_data.json"

model\_data = json.loads(rasa.shared.utils.io.read\_file(model\_data\_file))

except(ValueError, FileNotFoundError, FileIOException):

logger.debug(

f"Couldn't load metadata for component '{cls.\_\_name\_\_}' as the persisted "

f"model data couldn't be loaded."

)

return cls(

config, model\_data=model\_data

)

**Providing a Default Configuration for an NLU Component**

The default configuration is no longer a static class property but instead returned
by the static method `get_default_config`:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import Text, Any, Dict

from rasa.engine.graph import GraphComponent

from rasa.nlu.classifiers.classifier import IntentClassifier

classMyNLUComponent(GraphComponent, IntentClassifier):

...

@staticmethod

defget\_default\_config()-> Dict\[Text, Any\]:

return{"key1":"value1"}

**Augmenting Training Data in an NLU Component**

NLU Components like [tokenizers](https://legacy-docs-oss.rasa.com/docs/rasa/components#tokenizers) or
[featurizers](https://legacy-docs-oss.rasa.com/docs/rasa/components#featurizers) augment the training data with their
output during the model training. Their output is required by NLU components later in the
pipeline. Typically, featurizers require _tokenized_ messages and intent
classifiers require _featurized_ training data to train themselves. Rasa
3.0 makes these different purposes explicit. Previously both NLU component training and
training data augmentation were done as part of the `train` method. In Rasa
3.0 they are split into `train` and `process_training_data`:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from rasa.engine.graph import GraphComponent

from rasa.engine.storage.resource import Resource

from rasa.nlu.featurizers.sparse\_featurizer.sparse\_featurizer import SparseFeaturizer

from rasa.shared.nlu.training\_data.training\_data import TrainingData

classMyNLUComponent(GraphComponent, SparseFeaturizer):

deftrain(self, training\_data: TrainingData)-> Resource:

self.train\_featurizer(training\_data)

self.persist()

return self.\_resource

defprocess\_training\_data(self, training\_data: TrainingData)-> TrainingData:

for message in training\_data.training\_examples:

self.add\_features(message)

return training\_data

**Handling Lists of Messages During Inference in an NLU Component**

NLU components used to receive a single `Message` object during inference.
Starting with Rasa 3.0 all NLU components have to support a list of
messages during inference. Unless your component supports batch predictions the easiest
way to handle this is to loop over the messages. It is also required to return the
message objects at the end of the `process` method.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import List

from rasa.engine.graph import GraphComponent

from rasa.nlu.classifiers.classifier import IntentClassifier

from rasa.shared.nlu.training\_data.message import Message

classMyNLUComponent(GraphComponent, IntentClassifier):

defprocess(self, messages: List\[Message\])-> List\[Message\]:

for message in messages:

self.predict(message)

return messages

**Registering your NLU Component**

Before you can use your custom NLU component you have to register your NLU component using the
`DefaultV1Recipe.register` decorator. The NLU component types correspond to the existing
parent classes:

- `Tokenizer`: `ComponentType.MESSAGE_TOKENIZER`
- `SparseFeaturizer` / `DenseFeaturizer`: `ComponentType.MESSAGE_FEATURIZER`
- `IntentClassifier`: `ComponentType.INTENT_CLASSIFIER`
- `EntityExtractor`: `ComponentType.ENTITY_EXTRACTOR`
- If your NLU component provides a pretrained model which should be used by other
NLU components during training and inference use `ComponentType.MODEL_LOADER`

Specify `is_trainable=True` if the `train` method of your component should be called
during training.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from rasa.engine.recipes.default\_recipe import DefaultV1Recipe

from rasa.nlu.classifiers.classifier import IntentClassifier

from rasa.engine.graph import GraphComponent

@DefaultV1Recipe.register(

DefaultV1Recipe.ComponentType.INTENT\_CLASSIFIER, is\_trainable=True

)

classMyNLUComponent(GraphComponent, IntentClassifier):

...

**Using a Model Provider with your NLU Component**

If your NLU component requires a pretrained model such as a [Spacy](https://legacy-docs-oss.rasa.com/docs/rasa/components#spacynlp) or
[Mitie](https://legacy-docs-oss.rasa.com/docs/rasa/components#mitienlp) language model you have to specify the NLU component which
provides this model in your model's pipeline before the NLU component which requires
the model. In addition to this you now also need to specify the model loading component in the `model_from`
parameter in the `register` decorator. The model will then be passed to your model's
`train`, `process_training_data` and `process` methods:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import List

from rasa.engine.graph import GraphComponent

from rasa.engine.recipes.default\_recipe import DefaultV1Recipe

from rasa.engine.storage.resource import Resource

from rasa.nlu.classifiers.classifier import IntentClassifier

from rasa.nlu.utils.spacy\_utils import SpacyModel

from rasa.shared.nlu.training\_data.message import Message

from rasa.shared.nlu.training\_data.training\_data import TrainingData

@DefaultV1Recipe.register(

DefaultV1Recipe.ComponentType.INTENT\_CLASSIFIER, is\_trainable=True, model\_from="SpacyNLP"

)

classMyNLUComponent(GraphComponent, IntentClassifier):

deftrain(

self, training\_data: TrainingData, model: SpacyModel)-> Resource:

spacy\_nlp = model.model

...

defprocess(self, messages: List\[Message\], model: SpacyModel)-> List\[Message\]:

spacy\_nlp = model.model

...

#### Changes to Custom Policies [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#changes-to-custom-policies "Direct link to heading")

This guide leads you through the migration of a custom policy step by step.

**Instantiating a Policy for Training**

Policies are no longer instantiated via their constructor. Instead, all policies have
to implement a `create` method. During the policy instantiation the configuration from
the [model configuration](https://legacy-docs-oss.rasa.com/docs/rasa/model-configuration) is passed in as a dictionary instead
of as separate parameters. Similarly, the`featurizers` are no longer instantiated
outside of policies.
Instead, the super class `rasa.core.policies.policy.Policy` instantiates the
featurizers itself.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import Optional, Dict, Text, Any

from rasa.core.featurizers.tracker\_featurizers import TrackerFeaturizer

from rasa.core.policies.policy import Policy

from rasa.engine.graph import ExecutionContext

from rasa.engine.storage.resource import Resource

from rasa.engine.storage.storage import ModelStorage

classMyPolicy(Policy):

def\_\_init\_\_(

self,

config: Dict\[Text, Any\],

model\_storage: ModelStorage,

resource: Resource,

execution\_context: ExecutionContext,

featurizer: Optional\[TrackerFeaturizer\]=None,

)->None:

super().\_\_init\_\_(

config, model\_storage, resource, execution\_context, featurizer

)

...

...

@classmethod

defcreate(

cls,

config: Dict\[Text, Any\],

model\_storage: ModelStorage,

resource: Resource,

execution\_context: ExecutionContext,

)-> MyPolicy:

return cls(config, model\_storage, resource, execution\_context)

**Persisting a Trained Policy**

Policies used to be persisted by a call to the policy's `persist` method from outside the policy itself.
With Rasa 3.0 policies are responsible for persisting themselves.
Use the provided `model_storage` and `resource` parameters
to persist your graph component at the end of the training and then return the `resource`
as result of your policy's `train` method. See [graph component persistence](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components#model-persistence) for more details.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import List, Any

from rasa.core.policies.policy import Policy

from rasa.engine.storage.resource import Resource

from rasa.shared.core.domain import Domain

from rasa.shared.core.generator import TrackerWithCachedStates

classMyPolicy(Policy):

deftrain(

self,

training\_trackers: List\[TrackerWithCachedStates\],

domain: Domain,

\*\*kwargs: Any,

)-> Resource:

...

self.persist()

return self.\_resource

defpersist(self)->None:

with self.\_model\_storage.write\_to(self.\_resource)as directory:

if self.featurizer isnotNone:

self.featurizer.persist(directory)

file\_path = directory /"model\_data.json"

rasa.shared.utils.io.dump\_obj\_as\_json\_to\_file(file\_path,

self.get\_model\_data())

...

**Instantiating a Trained Policy**

Previously policies had to persist their own configuration. Now the config passed
into `load` will automatically contain the configuration which your model was trained with.

To instantiate a persisted policy, you need to use `model_storage` and `resource` in your policy's
`load` method.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

import json

from typing import Dict, Text, Any

from rasa.core.featurizers.tracker\_featurizers import TrackerFeaturizer

from rasa.core.policies.policy import Policy

from rasa.engine.graph import ExecutionContext

from rasa.engine.storage.resource import Resource

from rasa.engine.storage.storage import ModelStorage

from rasa.shared.exceptions import FileIOException

classMyPolicy(Policy):

@classmethod

defload(

cls,

config: Dict\[Text, Any\],

model\_storage: ModelStorage,

resource: Resource,

execution\_context: ExecutionContext,

\*\*kwargs: Any,

)-> MyPolicy:

featurizer =None

model\_data ={}

try:

with model\_storage.read\_from(resource)as path:

if(Path(path)/ FEATURIZER\_FILE).is\_file():

featurizer = TrackerFeaturizer.load(path)

model\_data\_file = path /"model\_data.json"

model\_data = json.loads(rasa.shared.utils.io.read\_file(model\_data\_file))

except(ValueError, FileNotFoundError, FileIOException):

logger.debug(

f"Couldn't load metadata for policy '{cls.\_\_name\_\_}' as the persisted "

f"metadata couldn't be loaded."

)

return cls(

config, model\_storage, resource, execution\_context,

featurizer=featurizer, model\_data=model\_data

)

**Providing a Default Configuration for a Policy**

The default configuration is no longer provided via default values in your policy's
constructor but instead returned by the static method `get_default_config`:

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import Dict, Text, Any

from rasa.core.policies.policy import Policy

classMyPolicy(Policy):

def\_\_init\_\_(self, config: Dict\[Text, Any\])->None:

...

@staticmethod

defget\_default\_config()-> Dict\[Text, Any\]:

return{"key1":"value1"}

**Using End-To-End Features in a Policy**

To use a custom [end-to-end policy](https://legacy-docs-oss.rasa.com/docs/rasa/stories#end-to-end-training) in Rasa
Open Source 2, you had to use the `interpreter` parameter to featurize the tracker
events manually. In Rasa 3.0,
you need to [register](https://legacy-docs-oss.rasa.com/docs/rasa/custom-graph-components#registering-graph-components-with-the-model-configuration) a policy that requires end-to-end features with type `ComponentType.POLICY_WITH_END_TO_END_SUPPORT`. The features
will be precomputed and passed into your policy during training and inference.

##### caution

End-To-End features will only be computed and provided to your policy if your training
data actually contains [end-to-end training data](https://legacy-docs-oss.rasa.com/docs/rasa/stories#end-to-end-training).

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import List, Optional, Dict, Text, Any

from rasa.core.featurizers.precomputation import MessageContainerForCoreFeaturization

from rasa.core.policies.policy import PolicyPrediction, Policy

from rasa.engine.recipes.default\_recipe import DefaultV1Recipe

from rasa.engine.storage.resource import Resource

from rasa.shared.core.domain import Domain

from rasa.shared.core.generator import TrackerWithCachedStates

from rasa.shared.core.trackers import DialogueStateTracker

@DefaultV1Recipe.register(

DefaultV1Recipe.ComponentType.POLICY\_WITH\_END\_TO\_END\_SUPPORT, is\_trainable=True

)

classMyPolicy(Policy):

deftrain(

self,

training\_trackers: List\[TrackerWithCachedStates\],

domain: Domain,

precomputations: Optional\[MessageContainerForCoreFeaturization\]=None,

)-> Resource:

...

model\_data, label\_ids = self.\_prepare\_for\_training(

training\_trackers, domain, precomputations,

)

...

defpredict\_action\_probabilities(

self,

tracker: DialogueStateTracker,

domain: Domain,

precomputations: Optional\[MessageContainerForCoreFeaturization\]=None,

rule\_only\_data: Optional\[Dict\[Text, Any\]\]=None,

\*\*kwargs: Any,

)-> PolicyPrediction:

...

tracker\_state\_features = self.\_featurize\_tracker(

tracker, domain, precomputations, rule\_only\_data=rule\_only\_data

)

...

**Registering a Policy**

Before you can use your custom policy you have to register your policy using the
`DefaultV1Recipe.register` decorator. If your policy requires end-to-end features
specify the graph component type `POLICY_WITH_END_TO_END_SUPPORT`. Otherwise, use
`POLICY_WITHOUT_END_TO_END_SUPPORT`. Specify `is_trainable=True` if the `train`
method of your policy should be called during the training. If your policy is only
used during inference use `is_trainable=False`.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from rasa.core.policies.policy import Policy

from rasa.engine.recipes.default\_recipe import DefaultV1Recipe

@DefaultV1Recipe.register(

DefaultV1Recipe.ComponentType.POLICY\_WITH\_END\_TO\_END\_SUPPORT,

is\_trainable=True

)

classMyPolicy(Policy):

...

**Providing Rule-only Data to a Policy**

Rasa allows excluding [forms](https://legacy-docs-oss.rasa.com/docs/rasa/forms) or [slots](https://legacy-docs-oss.rasa.com/docs/rasa/domain#slots) which
are completely handled by
[rules](https://legacy-docs-oss.rasa.com/docs/rasa/rules) from becoming features in other policies.
In Rasa 2 this information was passed onto the
policies using the `set_shared_policy_states` method which set the policy attribute
`_rule_only_data`. Rasa passes the names of rule-only slots and forms via the
`predict_action_probabilities` method. The passed `rule_only_data` can be `None`
in case the [`RulePolicy`](https://legacy-docs-oss.rasa.com/docs/rasa/policies#rule-policy) is not part of your model
configuration.

- Rasa 2.0 (old)
- Rasa 3.0 (new)

Copy

from typing import Optional, Dict, Text, Any

from rasa.core.policies.policy import Policy, PolicyPrediction

from rasa.shared.core.domain import Domain

from rasa.shared.core.trackers import DialogueStateTracker

classMyPolicy(Policy):

defpredict\_action\_probabilities(

self,

tracker: DialogueStateTracker,

domain: Domain,

rule\_only\_data: Optional\[Dict\[Text, Any\]\]=None,

)-> PolicyPrediction:

...

### Training data [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#training-data "Direct link to heading")

#### Upgrading `version` from `2.0` to `3.0` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#upgrading-version-from-20-to-30 "Direct link to heading")

At the top of your training data files, you need to change `version: "2.0"` to `version: "3.1"`.

We follow semantic versioning for training data versions. This means breaking changes result in a new
major version, while new features result in a new minor version. The latest training data version is 3.1.

The improvements to `slot mappings` in Rasa 3.0 were breaking changes, so we needed to upgrade
from major version `2.0` to major version `3.0`.

#### `TrainingDataImporter` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#trainingdataimporter "Direct link to heading")

`TrainingDataImporter` and all its implementations are updated to contain only synchronous methods.
If you have a custom data importer or rely on some functions provided by `TrainingDataImporter`, you need
to update your implementation and function calls.

For example, this is how data loading should look like in Rasa 3.0:

Copy

from typing import Text

from rasa.shared.importers.importer import TrainingDataImporter

defload\_data(domain\_path: Text, config\_path: Text):

file\_importer = TrainingDataImporter.load\_from\_config(

config\_path, domain\_path

)

\# note that all the functions below were async before:

config = file\_importer.get\_config()

domain = file\_importer.get\_domain()

stories = file\_importer.get\_stories()

nlu\_data = file\_importer.get\_nlu\_data()

Since any custom importer implements `TrainingDataImporter`, you should update your custom
importer to contain only sync methods as well:

Copy

from typing import Dict

from rasa.shared.core.domain import Domain

from rasa.shared.importers.importer import TrainingDataImporter

classMyImporter(TrainingDataImporter):

"""Example partial implementation of a custom importer component."""

\# this function was async before

defget\_domain(self)-> Domain:

pass

\# this function was also async before

defget\_config(self)-> Dict:

pass

\# ...

`template_variables` and `e2e` arguments also got removed from `get_stories` method of `TrainingDataImporter`.
Its new signature looks this way:

Copy

from typing import Optional

from rasa.shared.nlu.interpreter import RegexInterpreter

from rasa.shared.core.training\_data.structures import StoryGraph

classTrainingDataImporter:

\# ...

defget\_stories(

self,

interpreter:"NaturalLanguageInterpreter"= RegexInterpreter(),

exclusion\_percentage: Optional\[int\]=None,

)-> StoryGraph:

pass

\# ...

### Training [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#training "Direct link to heading")

#### `rasa train --dry-run` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-train---dry-run "Direct link to heading")

Due to changes in the model architecture the behavior of `rasa train --dry-run` changed.
The exit codes now have the following meaning:

- `0` means that the model does not require an expensive retraining. However, the
responses might still require updating by running `rasa train`
- `1` means that one or multiple components require to be retrained.
- `8` means that the `--force` flag was used and hence any cached results are ignored
and the entire model is retrained.

### Machine Learning Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#machine-learning-components-1 "Direct link to heading")

#### Normalization of Confidences in `DIETClassifier` and `ResponseSelector` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#normalization-of-confidences-in-dietclassifier-and-responseselector "Direct link to heading")

`DIETClassifier` and `ResponseSelector` will no longer automatically report
re-normalized confidences when `ranking_length` is set to a value greater than `0`.
This change affects the reported confidences but does not influence the final
predicted intent, which might be used by policies.
However, since the reported confidences are affected you might have to tune the
thresholds for fallback mechanisms again.
The previous behavior can still be enforced by setting `renormalize_confidences=True`
when using `model_confidence=softmax`.

#### Normalization of confidences in `TEDPolicy` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#normalization-of-confidences-in-tedpolicy "Direct link to heading")

Predictions of `TEDPolicy` will no longer be modified by masking and renormalizing
confidences. This change can affect the maximum confidence predicted by the
`TEDPolicy` and thereby affect the final result of the policy ensemble.
However, the previous behavior can still be enforced by setting
`ranking_length=10` and `renormalize_confidences=True`.

#### Removed Policies [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#removed-policies "Direct link to heading")

Several dialogue policies that were deprecated in Rasa 2.x have been removed in Rasa 3.0.
If you are migrating a config file with a removed policy,
consult the following migration guides for the individual policies:

- `FallbackPolicy` [migration guide](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/#manually-migrating-from-the-fallback-policy)
- `TwoStageFallbackPolicy` [migration guide](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/#manually-migrating-from-the-two-stage-fallback-policy)
- `MappingPolicy` [migration guide](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/#manually-migrating-from-the-mapping-policy)
- `FormPolicy` [migration guide](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/#forms)
- `SklearnPolicy` should be replaced with [TEDPolicy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#ted-policy).
It is recommended to use the [default TEDPolicy config](https://legacy-docs-oss.rasa.com/docs/rasa/model-configuration#suggested-config) as a starting point.

#### Removed Tokenizers and Featurizers [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#removed-tokenizers-and-featurizers "Direct link to heading")

The `ConveRTTokenizer`, `LanguageModelTokenizer`, and `HFTransformersNLP` featurizer
components were deprecated in Rasa 2.x and have been removed in Rasa 3.0. See the
[migration guide for Rasa 2.x](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/#deprecations-2) for replacing these components in your pipeline.

### Slot Mappings [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#slot-mappings "Direct link to heading")

As of version 3.0, there is a single explicit mechanism for slot filling enabled by defining slot mappings for each slot
in the `slots` section of the domain file. This approach keeps slots up to date over the course of a conversation, and
removes duplicated effort in mapping the same slots in multiple forms. It is still possible to fill slots from arbitrary
custom actions and not update them on every turn of the conversation if that behavior is desired.

This new mechanism replaces the implicit slot setting via auto-fill of slots with entities of the same name.
The `auto_fill` key in the domain is no longer available, as well as the `auto_fill` parameter in the constructor of
the `Slot` class.

While forms continue to request the next slot, slot extraction is now delegated to the default
action [`action_extract_slots`](https://legacy-docs-oss.rasa.com/docs/rasa/default-actions#action_extract_slots). This action runs in the background
automatically after each user turn. Like `action_listen`, it should not be included in stories.

Each slot in the `slots` section must include the `mappings` key. The same keys used for predefined mappings in 2.0 are
available in 3.0. Additionally, you can define slots with custom mappings implemented in a custom action which will be
run on every user turn, for example:

Copy

slots:

is\_existing\_customer:

type: bool

mappings:

-type: custom

action: action\_verify\_customer\_status

You can use [slot validation actions](https://legacy-docs-oss.rasa.com/docs/rasa/slot-validation-actions) to either validate slots with predefined
mappings, or to both extract and validate slots with custom mappings.

Slots which will be filled by arbitrary custom actions in the course of the conversation, and which should not be updated
on every user turn, should be listed with mappings of type `custom` and no action. For example:

Copy

slots:

handoff\_completed:

type: bool

initial\_value:false

mappings:

-type: custom

This slot's value will only change when a custom action is predicted that sets it. This mapping maintains the behavior
from 2.x for a slot which was not filled by an entity or by slot mappings in a form.

##### note

The `required_slots` of a form used to be a list of slot mappings.
Since slot mappings are relocated to the `slots` section of the domain, `required_slots` has been converted to a list of
slot names only.

#### Automatic migration from 2.0 domain format to the 3.0 format [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#automatic-migration-from-20-domain-format-to-the-30-format "Direct link to heading")

The only data file that has changed in format is the domain file.
To migrate automatically to the 3.0 domain format, you can run the following command:

Copy

rasa data migrate -d DOMAIN --out OUT\_PATH

In addition to creating a valid 3.0 domain in the indicated out path, this command will automatically backup your
original domain file(s) in a file labeled `original_domain.yml` or `original_domain` directory if a directory was
provided instead.

To maintain the behavior of forms in the 2.0 format, all migrated slot mappings will include mapping conditions for
each form. This can be changed manually according to your use case.
See the docs on [mapping conditions](https://legacy-docs-oss.rasa.com/docs/rasa/domain#mapping-conditions) for more information.

#### Manually migrating from 2.0 domain format to the 3.0 format [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#manually-migrating-from-20-domain-format-to-the-30-format "Direct link to heading")

Each slot in the `slots` section of the domain will need a new key `mappings`.
This key is a list of mappings moved from forms, while the `required_slots` field collapses to a list of slot names.

Let's consider the following 2.0 domain file:

Copy

entities:

- cuisine

- number

slots:

cuisine:

type: text

num\_people:

type: float

outdoor\_seating:

type: bool

forms:

restaurant\_form:

required\_slots:

cuisine:

-type: from\_entity

entity: cuisine

num\_people:

-type: from\_entity

entity: number

outdoor\_seating:

-type: from\_intent

intent: affirm

value:true

-type: from\_intent

intent: deny

value:false

The initial result of migrating this domain to 3.0 format would look like this:

Copy

entities:

- cuisine

- number

slots:

cuisine:

type: text

mappings:

-type: from\_entity

entity: cuisine

num\_people:

type: float

mappings:

-type: from\_entity

entity: number

outdoor\_seating:

type: bool

mappings:

-type: from\_intent

intent: affirm

value:true

-type: from\_intent

intent: deny

value:false

forms:

restaurant\_form:

required\_slots:

- cuisine

- num\_people

- outdoor\_seating

For slots that should be filled only in the context of a form, add [mapping conditions](https://legacy-docs-oss.rasa.com/docs/rasa/domain#mapping-conditions)
to specify which form(s) should be active, as well as indicate if the `requested_slot` should be the same slot.
Adding `conditions` is required to preserve the behavior of slot mappings from 2.0, since without them
the mappings will be applied on each user turn regardless of whether a form is active or not.

Copy

slots:

outdoor\_seating:

type: bool

mappings:

-type: from\_intent

intent: affirm

value:true

conditions:

-active\_loop: restaurant\_form

requested\_slot: outdoor\_seating

-type: from\_intent

intent: deny

value:false

conditions:

-active\_loop: restaurant\_form

requested\_slot: outdoor\_seating

#### Rasa-SDK Modifications [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-sdk-modifications "Direct link to heading")

If you have used `FormValidationAction` to define custom extraction and validation code in which you override the
`required_slots` method, note that `slots_mapped_in_domain` argument has been replaced by the `domain_slots` argument.
You must make this replacement to continue using your custom code.

If you have been dynamically filling slots not present in the form's `required_slots` defined in the `domain.yml`
file, note that this behaviour is no longer supported in 3.x. Any dynamic slots with custom mappings, which are set in
the last user turn, will be filled **only if** they are returned by the `required_slots` method of the custom action
inheriting from `FormValidationAction`. To maintain the 2.x behaviour, you must now override the `required_slots` method
of this custom action as per the strong recommendation listed in the [dynamic form documentation](https://legacy-docs-oss.rasa.com/docs/rasa/forms#dynamic-form-behavior).

To extract custom slots that are not defined in any form's `required_slots`, you should now use a global [custom slot mapping](https://legacy-docs-oss.rasa.com/docs/rasa/domain#custom-slot-mappings)
and extend the [ValidationAction class](https://legacy-docs-oss.rasa.com/docs/rasa/action-server/validation-action#validationaction-class).

##### note

If you have custom validation actions extending `FormValidationAction` which override `required_slots` method, you should
double-check the dynamic form behavior of your migrated assistant. Slots set by the default action
[`action_extract_slots`](https://legacy-docs-oss.rasa.com/docs/rasa/default-actions#action_extract_slots) may need to be reset within the context of your
form by the custom validation actions for the form's required slots. For example, if your form dynamically adds a required
slot after the first slot is filled, you may want to reset the potential required slot as part of the first required slot's
validation method to ensure it will be empty when added.

## Rasa 2.7 to 2.8 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-27-to-28 "Direct link to heading")

##### caution

This release **breaks backward compatibility of machine learning models**.
It is not possible to load models trained with previous versions of Rasa. Please re-train
your assistant before using this version.

### Deprecations [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#deprecations "Direct link to heading")

#### Tracker Featurizers [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#tracker-featurizers "Direct link to heading")

`training_states_actions_and_entities` method of `TrackerFeaturizer`, `FullDialogueTrackerFeaturizer` and
`MaxHistoryTrackerFeaturizer` classes is deprecated and will be removed in Rasa 3.0 .
If you had a custom tracker featurizer which relied on this method from any of the above classes, please use
`training_states_labels_and_entities` instead.

`training_states_and_actions` method of `TrackerFeaturizer`, `FullDialogueTrackerFeaturizer` and
`MaxHistoryTrackerFeaturizer` classes is deprecated and will be removed in Rasa 3.0 .
If you had a custom tracker featurizer which relied on this method from any of the above classes, please use
`training_states_and_labels` instead.

#### State Featurizer [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#state-featurizer "Direct link to heading")

`encode_all_actions` method of `SingleStateFeaturizer` class is deprecated and will be removed in Rasa 3.0 .
It is recommended to use the method `encode_all_labels` instead.

### Incremental Training [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#incremental-training "Direct link to heading")

Users don't need to specify an additional buffer size for sparse featurizers anymore during incremental training.

Space for new sparse features are created dynamically inside the downstream machine learning
models - `DIETClassifier`, `ResponseSelector`. In other words, no extra buffer is created in
advance for additional vocabulary items and space will be dynamically allocated for them inside the model.

This means there's no need to specify `additional_vocabulary_size` for
[`CountVectorsFeaturizer`](https://legacy-docs-oss.rasa.com/docs/rasa/components#countvectorsfeaturizer) or
`number_additional_patterns` for [`RegexFeaturizer`](https://legacy-docs-oss.rasa.com/docs/rasa/components#regexfeaturizer).
These parameters are now deprecated.

**Before**

Copy

pipeline:

-name:"WhitespaceTokenizer"

-name:"RegexFeaturizer"

number\_additional\_patterns:100

-name:"CountVectorsFeaturizer"

additional\_vocabulary\_size:{text:100,response:20}

**Now**

Copy

pipeline:

-name:"WhitespaceTokenizer"

-name:"RegexFeaturizer"

-name:"CountVectorsFeaturizer"

### Machine Learning Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#machine-learning-components-2 "Direct link to heading")

The option `model_confidence=linear_norm` is deprecated and will be removed in Rasa `3.0.0`.

Rasa `2.3.0` introduced `linear_norm` as a possible value for `model_confidence`
parameter in machine learning components such as `DIETClassifier`, `ResponseSelector` and `TEDPolicy`.
Based on user feedback, we have identified multiple problems with this option.
Therefore, `model_confidence=linear_norm` is now deprecated and
will be removed in Rasa `3.0.0`. If you were using `model_confidence=linear_norm` for any of the mentioned components,
we recommend to revert it back to `model_confidence=softmax` and re-train the assistant. After re-training,
we also recommend to [re-tune the thresholds for fallback components](https://legacy-docs-oss.rasa.com/docs/rasa/fallback-handoff#fallbacks).

## Rasa 2.5 to 2.6 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-25-to-26 "Direct link to heading")

### Forms [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#forms "Direct link to heading")

#### New `ignored_intents` parameter in Forms [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#new-ignored_intents-parameter-in-forms "Direct link to heading")

There is a new parameter under Forms called `ignored_intents`. This parameter
can be used to prevent any required slots in a form from being filled with the specified
intent or intents. Please see the [Forms documentation](https://legacy-docs-oss.rasa.com/docs/rasa/forms) for examples and more
information on how to use it in your `domain.yml` file.

Before, if a user did not want to fill any slots of a form with a specified intent
they would have to define it under the `not_intent` parameter for every slot mapping
as shown in the following example :

domain.yml

Copy

forms:

restaurant\_form:

cuisine:

-type: from\_entity

entity: cuisine

not\_intent: chitchat

num\_people:

-type: from\_entity

entity: number

intent:\[inform, request\_restaurant\]

not\_intent: chitchat

feedback:

-type: from\_entity

entity: feedback

not\_intent: chitchat

By introducing the `ignored_intents` parameter, we now only need to define it
in one place and it will affect all the slots of the form :

domain.yml

Copy

forms:

restaurant\_form:

ignored\_intents: chitchat

required\_slots:

cuisine:

-type: from\_entity

entity: cuisine

num\_people:

-type: from\_entity

entity: number

intent:\[inform, request\_restaurant\]

feedback:

-type: from\_entity

entity: feedback

-type: from\_text

## Rasa 2.4 to 2.5 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-24-to-25 "Direct link to heading")

### Machine Learning Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#machine-learning-components-3 "Direct link to heading")

#### `DIET`, `TED`, and `ResponseSelector` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#diet-ted-and-responseselector "Direct link to heading")

The former `weight_sparsity` parameter of the `DIETClassifier`, `TEDPolicy`, and the `ResponseSelector`,
is now deprecated and superseded by the new `connection_density` parameter.
The old `weight_sparsity` is roughly equivalent to `1 - connection_density`, except at very low densities
(high sparsities).

To avoid deprecation issues, you should set `connection_density` to
`1 - your former weight_sparsity setting` throughout the config file. (If you left
`weight_sparsity` at its default setting, you don't need to do anything.)

#### SpaCy 3.0 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#spacy-30 "Direct link to heading")

Rasa now supports spaCy 3.0. This means that we can support more features for more
languages but this also introduced a breaking change. SpaCy 3.0 deprecated the
`spacy link <language model>` command. So from now on you need to use the
[the full model name](https://spacy.io/models) in the `config.yml` file.

**Before**

Before you could run `spacy link en en_core_web_md` and then we would be able
to pick up the correct model from the `language` parameter.

Copy

language: en

pipeline:

-name: SpacyNLP

**Now**

This behavior will be deprecated and instead you'll want to be explicit in `config.yml`.

Copy

language: en

pipeline:

-name: SpacyNLP

model: en\_core\_web\_md

**Fallback**

To make the transition easier, Rasa will try to fall back to a medium spaCy model whenever
a compatible language is configured for the entire pipeline in `config.yml`, even if you don't
specify a `model`. This fallback behavior is temporary and will be deprecated in Rasa 3.0.0.

We've updated our docs to reflect these changes. All examples now show a direct link to the
correct spaCy model. We've also added a warning to the [SpaCyNLP](https://legacy-docs-oss.rasa.com/docs/rasa/components#spacynlp)
docs that explains the fallback behavior.

## Rasa 2.3 to Rasa 2.4 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-23-to-rasa-24 "Direct link to heading")

### Deprecating `template` for `response` [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#deprecating-template-for-response "Direct link to heading")

NLG Server

- Changed request format to send `response` as well as `template` as a field. The `template` field will be removed in Rasa 3.0.0.

`rasa.core.agent`

- The terminology `template` is deprecated and replaced by `response`. Support for `template` from the NLG response will be removed in Rasa 3.0.0. Please see [here](https://legacy-docs-oss.rasa.com/docs/rasa/nlg) for more details.

`rasa.core.nlg.generator`

- `generate()` now takes in `utter_action` as a parameter.
- The terminology `template` is deprecated and replaced by `response`. Support for `template` in the `NaturalLanguageGenerator` will be removed in Rasa 3.0.0.

`rasa.shared.core.domain`

- The property `templates` is deprecated. Use `responses` instead. It will be removed in Rasa 3.0.0.
- `retrieval_intent_templates` will be removed in Rasa 3.0.0. Please use `retrieval_intent_responses` instead.
- `is_retrieval_intent_template` will be removed in Rasa 3.0.0. Please use `is_retrieval_intent_response` instead.
- `check_missing_templates` will be removed in Rasa 3.0.0. Please use `check_missing_responses` instead.

Response Selector

- The field `template_name` will be deprecated in Rasa 3.0.0. Please use `utter_action` instead. Please see [here](https://legacy-docs-oss.rasa.com/docs/rasa/components#selectors) for more details.
- The field `response_templates` will be deprecated in Rasa 3.0.0. Please use `responses` instead. Please see [here](https://legacy-docs-oss.rasa.com/docs/rasa/components#selectors) for more details.

## Rasa 2.3.3 to Rasa 2.3.4 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-233-to-rasa-234 "Direct link to heading")

##### caution

This is a release **breaking backwards compatibility of machine learning models**.
It is not possible to load previously trained models if they were trained with `model_confidence=cosine` or
`model_confidence=inner` setting. Please make sure to re-train the assistant before trying to use it with this improved version.

### Machine Learning Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#machine-learning-components-4 "Direct link to heading")

Rasa `2.3.0` introduced the option of using cosine similarities for model confidences by setting `model_confidence=cosine`. Some post-release experiments revealed that using `model_confidence=cosine` is wrong as it can change the order of predicted labels. That's why this option was removed in Rasa version `2.3.4`.

`model_confidence=inner` is deprecated as it produces an unbounded range of confidences which can break
the logic of assistants in various other places.

We encourage you to try `model_confidence=linear_norm` which will produce a linearly normalized version of dot product similarities with each value in the range `[0,1]`. This can be done with the following config:

Copy

\- name: DIETClassifier

model\_confidence: linear\_norm

constrain\_similarities: True

If you trained a model with `model_confidence=cosine` or `model_confidence=inner` setting using previous versions of Rasa, please re-train by either removing the `model_confidence` option from the configuration or setting it to `linear_norm`.

## Rasa 2.2 to Rasa 2.3 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-22-to-rasa-23 "Direct link to heading")

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general "Direct link to heading")

If you want to use Tensorboard for `DIETClassifier`, `ResponseSelector`, or `TEDPolicy` and log metrics after
every (mini)batch, please use 'batch' instead of 'minibatch' as 'tensorboard\_log\_level'.

### Machine Learning Components [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#machine-learning-components-5 "Direct link to heading")

A few changes have been made to the loss function inside machine learning (ML)
components `DIETClassifier`, `ResponseSelector` and `TEDPolicy`. These include:

1. Configuration option `loss_type=softmax` is now deprecated and will be removed in Rasa 3.0.0. Use `loss_type=cross_entropy` instead.
2. The default loss function (`loss_type=cross_entropy`) can add an optional sigmoid cross-entropy loss of all similarity values to constrain
them to an approximate range. You can turn on this option by setting `constrain_similarities=True`. This should help the models to perform better on real world test sets.

A new option `model_confidence` has been added to each ML component. It affects how the model's confidence for each label is computed during inference. It can take one of three values:

1. `softmax` \- Dot product similarities between input and label embeddings are post-processed with a softmax function, as a result of which confidence for all labels sum up to 1.
2. `cosine` \- Cosine similarity between input and label embeddings. Confidence for each label will be in the range `[-1,1]`.
3. `linear_norm` \- Dot product similarities between input and label embeddings are post-processed with a linear normalization function. Confidence for each label will be in the range `[0,1]`.

The default value is `softmax`, but we recommend trying `linear_norm`. This should make it easier to [tune thresholds for triggering fallback](https://legacy-docs-oss.rasa.com/docs/rasa/fallback-handoff#fallbacks).
The value of this option does not affect how confidences are computed for entity predictions in `DIETClassifier`.

We encourage you to try both the above recommendations. This can be done with the following config:

Copy

\- name: DIETClassifier

model\_confidence: linear\_norm

constrain\_similarities: True

...

Once the assistant is re-trained with the above configuration, users should also [tune fallback confidence thresholds](https://legacy-docs-oss.rasa.com/docs/rasa/fallback-handoff#fallbacks).

**EDIT**: Some post-release experiments revealed that using `model_confidence=cosine` is wrong as it can change the order of predicted labels. That's why this option was removed in Rasa version `2.3.4`.

## Rasa 2.1 to Rasa 2.2 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-21-to-rasa-22 "Direct link to heading")

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general-1 "Direct link to heading")

`TEDPolicy`'s `transformer_size`, `number_of_transformer_layers`,
and `dense_dimensions` parameters have been renamed.
Please update your configuration files using the following mapping:

| Old Model Parameter | New Model Parameter |
| --- | --- |
| `transformer_size` | dictionary `transformer_size` with keys |
|  | `text`, `action_text`, `label_action_text`, `dialogue` |
| `number_of_transformer_layers` | dictionary `number_of_transformer_layers` with keys |
|  | `text`, `action_text`, `label_action_text`, `dialogue` |
| `dense_dimension` | dictionary `dense_dimension` with keys |
|  | `text`, `action_text`, `label_action_text`, `intent`, |
|  | `action_name`, `label_action_name`, `entities`, `slots`, |
|  | `active_loop` |

For example:

config.yml

Copy

policies:

-name: TEDPolicy

transformer\_size:

text:128

action\_text:128

label\_action\_text:128

dialogue:128

number\_of\_transformer\_layers:

text:1

action\_text:1

label\_action\_text:1

dialogue:1

dense\_dimension:

text:128

action\_text:128

label\_action\_text:128

intent:20

action\_name:20

label\_action\_name:20

entities:20

slots:20

active\_loop:20

### Deprecations [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#deprecations-1 "Direct link to heading")

#### Markdown Data [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#markdown-data-1 "Direct link to heading")

Training and test data in Markdown format is now deprecated. This includes:

- reading and writing of story files in Markdown format
- reading and writing of NLU data in Markdown format
- reading and writing of retrieval intent data in Markdown format

Support for Markdown data will be removed entirely in Rasa 3.0.0.

Please convert your existing Markdown data by using the commands
described [here](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#training-data-files).

### Policies [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#policies "Direct link to heading")

[Policies](https://legacy-docs-oss.rasa.com/docs/rasa/policies) now require a `**kwargs` argument in their constructor and `load` method.
Policies without `**kwargs` will be supported until Rasa version `3.0.0`.
However when using [incremental training](https://legacy-docs-oss.rasa.com/docs/rasa/command-line-interface#incremental-training)`**kwargs` **must** be included.

#### Other [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#other "Direct link to heading")

- `Domain.random_template_for` is deprecated and will be removed in Rasa
3.0.0. You can alternatively use the `TemplatedNaturalLanguageGenerator`.
- `Domain.action_names` is deprecated and will be removed in Rasa
3.0.0. Please use `Domain.action_names_or_texts` instead.

## Rasa 2.0 to Rasa 2.1 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-20-to-rasa-21 "Direct link to heading")

### Deprecations [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#deprecations-2 "Direct link to heading")

`ConveRTTokenizer` is now deprecated. [ConveRTFeaturizer](https://legacy-docs-oss.rasa.com/docs/rasa/components#convertfeaturizer) now implements
its behaviour. To migrate, replace `ConveRTTokenizer` with any other tokenizer, for e.g.:

Copy

pipeline:

-name: WhitespaceTokenizer

-name: ConveRTFeaturizer

model\_url: <Remote/Local path to model files>

...

`HFTransformersNLP` and `LanguageModelTokenizer` components are now deprecated.
[LanguageModelFeaturizer](https://legacy-docs-oss.rasa.com/docs/rasa/components#languagemodelfeaturizer) now implements their behaviour.
To migrate, replace both the above components with any tokenizer and specify the model architecture and model weights
as part of `LanguageModelFeaturizer`, for e.g.:

Copy

pipeline:

-name: WhitespaceTokenizer

-name: LanguageModelFeaturizer

model\_name:"bert"

model\_weights:"rasa/LaBSE"

...

## Rasa 1.10 to Rasa 2.0 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-110-to-rasa-20 "Direct link to heading")

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general-2 "Direct link to heading")

A lot has changed in version 2.0. Make sure you read
through this guide thoroughly, to make sure all parts of your bot are updated.
A lot of updates can be done automatically with inbuilt commands, others will need
some manual conversion. If you have any feedback about these updates or the migration process, please post it
in the [forum](https://forum.rasa.com/t/rasa-open-source-2-0-is-out-now-internal-draft/35577).

### Training data files [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#training-data-files "Direct link to heading")

As of version 2.0, the new default training data format is yaml. Markdown is still supported,
but this will be deprecated in Rasa 3.0.0.

You can convert existing NLU, Stories, and NLG (i.e. `responses.md`) training data
files in the Markdown format to the new YAML format using following commands:

Copy

rasa data convert nlu -f yaml --data={SOURCE\_DIR} --out={TARGET\_DIR}

rasa data convert nlg -f yaml --data={SOURCE\_DIR} --out={TARGET\_DIR}

rasa data convert core -f yaml --data={SOURCE\_DIR} --out={TARGET\_DIR}

Converted files will have the same names as the original ones but with a
`_converted.yml` suffix.

If you are using [forms](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#forms) or [response selectors](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#response-selectors),
some additional changes will need to be made as described in their respective sections.

### Policies [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#policies-1 "Direct link to heading")

With the introduction of [rules](https://legacy-docs-oss.rasa.com/docs/rasa/rules) and the [RulePolicy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#rule-policy),
the following policies are deprecated:

- [Mapping Policy](/content/docs/rasa/2.x/policies#mapping-policy/index.html)
- [Fallback Policy](/content/docs/rasa/2.x/policies#fallback-policy/index.html)
- [Two-Stage Fallback Policy](/content/docs/rasa/2.x/policies#two-stage-fallback-policy/index.html)
- [Form Policy](/content/docs/rasa/2.x/policies#form-policy/index.html)

To migrate the policies automatically, you can run the following command:

Copy

rasa data convert config

This command will take care of updating your `config.yml` and `domain.yml`, while
making backups of your existing files using the `.bak` suffix. It will also add a
`rules.yml` if necessary.

Your forms will still function as normal in the old format after this update, but this command
does not convert them into the new format automatically. This should be done manually, as
described in the section on [forms](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#forms).

You can also migrate the individual policies manually, if you don't want to use the automatic conversion command.

#### Manually migrating from the Mapping Policy [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#manually-migrating-from-the-mapping-policy "Direct link to heading")

If you previously used the [Mapping Policy](/content/docs/rasa/2.x/policies#mapping-policy/index.html), you
can follow the documentation on [FAQs](https://legacy-docs-oss.rasa.com/docs/rasa/chitchat-faqs) to convert your mapped
intents to rules. Suppose you previously mapped an intent `ask_is_bot` as follows:

domain.yml

Copy

intents:

-ask\_is\_bot:

triggers: action\_is\_bot

This becomes the following rule:

rules.yml

Copy

rules:

-rule: Rule to map \`ask\_is\_bot\` intent

steps:

-intent: ask\_is\_bot

-action: action\_is\_bot

And you can safely remove any `triggers:` from your domain:

domain.yml

Copy

intents:

- ask\_is\_bot

Finally, you can replace the Mapping Policy with the
[Rule Policy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#rule-policy) in your model configuration:

config.yml

Copy

policies:

\# Other policies

-name: RulePolicy

#### Manually migrating from the Fallback Policy [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#manually-migrating-from-the-fallback-policy "Direct link to heading")

If you previously used the [Fallback Policy](/content/docs/rasa/2.x/policies#fallback-policy/index.html), the following model
configuration would translate as follows given a previous configuration like this:

config.yml

Copy

policies:

-name:"FallbackPolicy"

nlu\_threshold:0.4

core\_threshold:0.3

fallback\_action\_name:"action\_default\_fallback"

ambiguity\_threshold:0.1

The new configuration would then look like:

config.yml

Copy

recipe: default.v1

pipeline:

\# Other components

-name: FallbackClassifier

threshold:0.4

ambiguity\_threshold:0.1

policies:

\# Other policies

-name: RulePolicy

core\_fallback\_threshold:0.3

core\_fallback\_action\_name:"action\_default\_fallback"

In addition, you need to add a [rule](https://legacy-docs-oss.rasa.com/docs/rasa/rules) to specify which action to run
in case of low NLU confidence:

rules.yml

Copy

rules:

-rule: Ask the user to rephrase whenever they send a message with low NLU confidence

steps:

-intent: nlu\_fallback

-action: utter\_please\_rephrase

See the documentation on [fallback](https://legacy-docs-oss.rasa.com/docs/rasa/fallback-handoff#fallbacks) for more
information.

#### Manually migrating from the Two-Stage-Fallback Policy [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#manually-migrating-from-the-two-stage-fallback-policy "Direct link to heading")

If you previously used the
[Two-Stage Fallback Policy](/content/docs/rasa/2.x/policies#two-stage-fallback-policy/index.html), with a configuration
like this for example:

config.yml

Copy

policies:

-name: TwoStageFallbackPolicy

nlu\_threshold:0.4

ambiguity\_threshold:0.1

core\_threshold:0.3

fallback\_core\_action\_name:"action\_default\_fallback"

fallback\_nlu\_action\_name:"action\_default\_fallback"

deny\_suggestion\_intent\_name:"out\_of\_scope"

The new configuration would look like this:

config.yml

Copy

recipe: default.v1

pipeline:

\# Other components

-name: FallbackClassifier

threshold:0.4

ambiguity\_threshold:0.1

policies:

\# Other policies

-name: RulePolicy

core\_fallback\_threshold:0.3

core\_fallback\_action\_name:"action\_default\_fallback"

In addition you need to add a [rule](https://legacy-docs-oss.rasa.com/docs/rasa/rules) to activate the Two-Stage Fallback for
messages with low NLU confidence.

rules.yml

Copy

rules:

-rule: Implementation of the TwoStageFallbackPolicy

steps:

\# This intent is automatically triggered by the \`FallbackClassifier\` in the NLU

\# pipeline in case the intent confidence was below the specified threshold.

-intent: nlu\_fallback

\# The Fallback is now implemented as a form.

-action: action\_two\_stage\_fallback

-active\_loop: action\_two\_stage\_fallback

Note that the previous parameters `fallback_nlu_action_name` and
`deny_suggestion_intent_name` are no longer configurable and have the fixed values
`action_default_fallback` and `out_of_scope`.

See the [fallback](https://legacy-docs-oss.rasa.com/docs/rasa/fallback-handoff#fallbacks) documentation for more
information.

### Forms [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#forms-1 "Direct link to heading")

As of version 2.0 the logic for [forms](https://legacy-docs-oss.rasa.com/docs/rasa/forms) has been moved from the
Rasa SDK to Rasa to simplify implementation and make it easier to write
action servers in other languages.

This means that forms are no longer implemented using a `FormAction`, but instead
defined in the domain. Any customizations around requesting slots or
[slot validation](https://legacy-docs-oss.rasa.com/docs/rasa/forms#validating-form-input) can be handled with a `FormValidationAction`.

Consider a custom form action from 1.x like this:

Copy

from typing import Text, List, Any, Dict, Union

from rasa\_sdk import Tracker

from rasa\_sdk.executor import CollectingDispatcher

from rasa\_sdk.forms import FormAction

classRestaurantForm(FormAction):

defname(self)-> Text:

return"restaurant\_form"

@staticmethod

defrequired\_slots(tracker: Tracker)-> List\[Text\]:

return\["cuisine"\]

defslot\_mappings(self)-> Dict\[Text, Union\[Dict, List\[Dict\]\]\]:

return{

"cuisine": self.from\_entity(entity="cuisine", not\_intent="chitchat"),

}

@staticmethod

defcuisine\_db()-> List\[Text\]:

"""Database of supported cuisines"""

return\["caribbean","chinese","french"\]

defvalidate\_cuisine(

self,

value: Text,

dispatcher: CollectingDispatcher,

tracker: Tracker,

domain: Dict\[Text, Any\],

)-> Dict\[Text, Any\]:

"""Validate cuisine value."""

if value.lower()in self.cuisine\_db():

\# validation succeeded, set the value of the "cuisine" slot to value

return{"cuisine": value}

else:

dispatcher.utter\_message(template="utter\_wrong\_cuisine")

\# validation failed, set this slot to None, meaning the

\# user will be asked for the slot again

return{"cuisine":None}

defsubmit(

self,

dispatcher: CollectingDispatcher,

tracker: Tracker,

domain: Dict\[Text, Any\],

)-> List\[Dict\]:

"""Define what the form has to do

after all required slots are filled"""

\# utter submit template

dispatcher.utter\_message(template="utter\_submit")

return\[\]

Start the migration by removing the FormPolicy and adding the [RulePolicy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#rule-policy)
(if not there already) to your model configuration:

config.yml

Copy

policies:

\# Other policies

\# ...

-name: RulePolicy

Then you need to define the form, required slots and their slot mappings
in the domain as described in the documentation on [forms](https://legacy-docs-oss.rasa.com/docs/rasa/forms#defining-a-form):

domain.yml

Copy

forms:

restaurant\_form:

cuisine:

-type: from\_entity

entity: cuisine

not\_intent: chitchat

If you ran the command to [convert your stories](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#training-data-Files),
you will have a story that handles form activation and deactivation like this:

stories.yml

Copy

stories:

-story: cuisine form

steps:

-intent: request\_restaurant

-action: restaurant\_form

-active\_loop: restaurant\_form

-active\_loop:null

-action: utter\_submit

This will work fine, but the best way to handle form behavior is to remove this story and instead
define two separate rules for form activation and submission:

rules.yml

Copy

rules:

-rule: Activate form

steps:

-intent: request\_restaurant

-action: restaurant\_form

-active\_loop: restaurant\_form

-rule: Submit form

condition:

\# Condition that form is active.

-active\_loop: restaurant\_form

steps:

-action: restaurant\_form

-active\_loop:null

\# The action we want to run when the form is submitted.

-action: utter\_submit

The last step is to implement a custom action to validate the form slots. Start by
adding the custom action to your domain:

domain.yml

Copy

actions:

\# Other actions

\# ...

- validate\_restaurant\_form

Then add a custom action which validates the `cuisine` slot:

Copy

from typing import Text, List, Any, Dict, Union

from rasa\_sdk import Tracker

from rasa\_sdk.executor import CollectingDispatcher

from rasa\_sdk import FormValidationAction

from rasa\_sdk.types import DomainDict

classRestaurantFormValidator(FormValidationAction):

defname(self)-> Text:

return"validate\_restaurant\_form"

@staticmethod

defcuisine\_db()-> List\[Text\]:

"""Database of supported cuisines"""

return\["caribbean","chinese","french"\]

defvalidate\_cuisine(

self,

slot\_value: Any,

dispatcher: CollectingDispatcher,

tracker: Tracker,

domain: DomainDict,

)-> Dict\[Text, Any\]:

"""Validate cuisine value."""

if slot\_value.lower()in self.cuisine\_db():

\# validation succeeded, set the value of the "cuisine" slot to value

return{"cuisine": slot\_value}

else:

\# validation failed, set this slot to None, meaning the

\# user will be asked for the slot again

return{"cuisine":None}

You can also migrate forms from Rasa SDK to Rasa 2 iteratively. You can for
example migrate one form to the Rasa 2 implementation while continue using
the deprecated Rasa SDK implementation for another form. To continue to use
the deprecated Rasa SDK `FormAction`s, add a custom action with the name of your form to your domain. Note that you should complete the migration as soon as possible as the deprecated `FormAction`
will be removed from the Rasa SDK in Rasa 3.

domain.yml

Copy

actions:

\# Adding a custom action for a form will

\# instruct Rasa to use the

\# deprecated Rasa SDK implementation of forms.

- my\_form

forms:

my\_form:

See the [forms](https://legacy-docs-oss.rasa.com/docs/rasa/forms) documentation for more details.

### Response Selectors [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#response-selectors "Direct link to heading")

Response Selectors are a stable feature as of version 2.0.

The [conversion command](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#training-data-files) will automatically
convert your `responses.md` file, stories and nlu training data to the new yaml format.
It will also take care of adding the `utter_` prefix to your responses.
Additionally you will need to rename the `respond_` actions in your stories files to use the
`utter_` prefix instead. Run the following command to apply these changes:

Copy

rasa data convert responses --data {SOURCE\_DIR} --out={TARGET\_DIR}

You can also apply these changes manually. For example:

Copy

stories:

-story: chitchat

steps:

-intent: chitchat

-action: respond\_chitchat

becomes

Copy

stories:

-story: chitchat

steps:

-intent: chitchat

-action: utter\_chitchat

and you will need to add the `utter_` prefix to the response names in your `responses.md`
as well. For example:

Copy

responses:

chitchat/ask\_name:

-text: Oh yeah, I am called the retrieval bot.

chitchat/ask\_weather:

-text: Oh, it does look sunny right now in Berlin.

becomes

Copy

responses:

utter\_chitchat/ask\_name:

-text: Oh yeah, I am called the retrieval bot.

utter\_chitchat/ask\_weather:

-text: Oh, it does look sunny right now in Berlin.

Finally, you should remove any actions with the `respond_` prefix from the actions
list in your domain.

This behavior will work fine when defined as a story, but even better when defined
as a rule. You should consider transferring your retrieval stories to rules. More information
on what that looks like in the [chitchat and FAQs documentation](https://legacy-docs-oss.rasa.com/docs/rasa/chitchat-faqs).

Response Selectors are now trained on retrieval intent labels by default instead
of the actual response text. For most models, this should improve training time
and accuracy of the `ResponseSelector`.

If you want to revert to the pre-2.0 default behavior, add the `use_text_as_label: true`
parameter to your `ResponseSelector` component:

Copy

pipeline:

\# other components

-name: ResponseSelector

use\_text\_as\_label:true

The output schema of `ResponseSelector` has changed. An example output looks like this:

Copy

{

"response\_selector":{

"all\_retrieval\_intents":\[\
\
"faq"\
\
\],

"default":{

"response":{

"id":1388783286124362000,

"confidence":1,

"intent\_response\_key":"faq/is\_legit",

"response\_templates":\[\
\
{\
\
"text":"absolutely",\
\
"image":"https://i.imgur.com/nGF1K8f.jpg"\
\
},\
\
{\
\
"text":"I think so."\
\
}\
\
\]

"template\_name":"utter\_faq/is\_legit"

},

"ranking":\[\
\
{\
\
"id":1388783286124362000,\
\
"confidence":1,\
\
"intent\_response\_key":"faq/is\_legit"\
\
}\
\
\]

}

}

}

As a result of this, if you were previously querying for the key `full_retrieval_intent` as:

Copy

response\_selector\_output.get("default")

.get("full\_retrieval\_intent")

you should instead now do this:

Copy

response\_selector\_output.get("default")

.get("response")

.get("intent\_response\_key")

### Unfeaturized Slots [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#unfeaturized-slots "Direct link to heading")

[Slots](https://legacy-docs-oss.rasa.com/docs/rasa/domain#slots) of type `unfeaturized` are
deprecated and will be removed in version 3.0. To ignore slot values during
a conversation, set the `influence_conversation` property of the slot to `false`.

The following snippet is an example of the deprecated unfeaturized slot usage:

Copy

slots:

username:

type: unfeaturized

To update this to the new format, you can specify the expected data type `text` and
define that the slot should be ignored during the conversation.

Copy

slots:

username:

type: text

\# Set \`influence\_conversation\` to \`false\`

\# to ignore the slot value during the conversation.

influence\_conversation:false

If you don't require the slot to have a specific data type, you can use the new slot
type [any](https://legacy-docs-oss.rasa.com/docs/rasa/domain#any-slot). This slot type is always ignored during a conversation
and does not make any assumptions regarding the data type of the slot value.

Copy

slots:

username:

type: any

Please see the updated [slots documentation](https://legacy-docs-oss.rasa.com/docs/rasa/domain#slots) for more information.

### Conversation sessions [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#conversation-sessions "Direct link to heading")

[Conversation sessions](https://legacy-docs-oss.rasa.com/docs/rasa/domain#session-configuration) are now enabled by default
if your [Domain](https://legacy-docs-oss.rasa.com/docs/rasa/domain) does not contain a session configuration. Previously a
missing session configuration was treated as if conversation sessions were disabled.
You can explicitly disable conversation sessions using the following snippet:

domain.yml

Copy

session\_config:

\# A session expiration time of \`0\`

\# disables conversation sessions

session\_expiration\_time:0

### Dialogue Featurization [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#dialogue-featurization "Direct link to heading")

This section is only relevant if you explicitly defined [featurizers](https://legacy-docs-oss.rasa.com/docs/rasa/policies#featurizers)
in your policy configuration.

LabelTokenizerSingleStateFeaturizer is deprecated and will be removed in the future.
It should be replaced with SingleStateFeaturizer and some changes should be made to the NLU pipeline.
Add a `Tokenizer` with the option `intent_tokenization_flag: True` and `CountVectorsFeaturizer`
to the NLU pipeline.

For example:

Copy

language: en

pipeline:

-name: WhitespaceTokenizer

intent\_tokenization\_flag:True

-name: CountVectorsFeaturizer

\# other components

policies:

\# other policies

-name: TEDPolicy

featurizer:

-name: SingleStateFeaturizer

BinarySingleStateFeaturizer is deprecated and will be removed in the future.
You should replace it with `SingleStateFeaturizer` and a NLU pipeline
where `intent_tokenization_flag` of a Tokenizer is set to `False`.

For example:

Copy

language: en

pipeline:

-name: WhitespaceTokenizer

intent\_tokenization\_flag:False

\# other components

policies:

\# other policies

-name: TEDPolicy

featurizer:

-name: SingleStateFeaturizer

### Deprecations [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#deprecations-3 "Direct link to heading")

The deprecated [event brokers](https://legacy-docs-oss.rasa.com/docs/rasa/event-brokers) FileProducer, KafkaProducer, PikaProducer
and SQLProducer have been removed. If you used these brokers in your
`endpoints.yml` make sure to use the renamed variants instead:

- FileProducer became FileEventBroker
- KafkaProducer became KafkaEventBroker
- PikaProducer became PikaEventBroker
- SQLProducer became SQLEventBroker

The deprecated EmbeddingIntentClassifier has been removed. If you used this
component in your pipeline configuration (`config.yml`) you can replace it
with [DIETClassifier](https://legacy-docs-oss.rasa.com/docs/rasa/components#dietclassifier).
It accepts the same configuration parameters.

The deprecated KerasPolicy has been removed. If you used this
component in your policies configuration (`config.yml`) you can replace it
with [TEDPolicy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#ted-policy). It accepts the same configuration parameters.

## Rasa 1.7 to Rasa 1.8 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-17-to-rasa-18 "Direct link to heading")

##### caution

This is a release **breaking backwards compatibility**.
It is not possible to load previously trained models. Please make sure to retrain a
model before trying to use it with this improved version.

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general-3 "Direct link to heading")

- The [TED Policy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#ted-policy) replaced the `keras_policy` as recommended machine
learning policy. New projects generated with `rasa init` will automatically use
this policy. In case you want to change your existing model configuration to use the
[TED Policy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#ted-policy) add this to the `policies` section in your `config.yml`
and remove potentially existing `KerasPolicy` entries:

Copy

policies:

\# - ... other policies

-name: TEDPolicy

max\_history:5

epochs:100

The given snippet specifies default values for the parameters `max_history` and
`epochs`. `max_history` is particularly important and strongly depends on your stories.
Please see the docs of the [TED Policy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#ted-policy) if you want to customize them.

- All pre-defined pipeline templates are deprecated. **Any templates you use will be**
**mapped to the new configuration, but the underlying architecture is the same**.
Take a look at [Tuning Your Model](https://legacy-docs-oss.rasa.com/docs/rasa/tuning-your-model) to decide on what components you should use
in your configuration file.

- The Embedding Policy was renamed to [TED Policy](https://legacy-docs-oss.rasa.com/docs/rasa/policies#ted-policy). The functionality of the policy stayed the same.
Please update your configuration files to use `TEDPolicy` instead of `EmbeddingPolicy`.

- Most of the model options for `EmbeddingPolicy`, `EmbeddingIntentClassifier`, and `ResponseSelector` got
renamed. Please update your configuration files using the following mapping:

| Old model option | New model option |
| --- | --- |
| hidden\_layers\_sizes\_a | dictionary “hidden\_layers\_sizes” with key “text” |
| hidden\_layers\_sizes\_b | dictionary “hidden\_layers\_sizes” with key “label” |
| hidden\_layers\_sizes\_pre\_dial | dictionary “hidden\_layers\_sizes” with key “dialogue” |
| hidden\_layers\_sizes\_bot | dictionary “hidden\_layers\_sizes” with key “label” |
| num\_transformer\_layers | number\_of\_transformer\_layers |
| num\_heads | number\_of\_attention\_heads |
| max\_seq\_length | maximum\_sequence\_length |
| dense\_dim | dense\_dimension |
| embed\_dim | embedding\_dimension |
| num\_neg | number\_of\_negative\_examples |
| mu\_pos | maximum\_positive\_similarity |
| mu\_neg | maximum\_negative\_similarity |
| use\_max\_sim\_neg | use\_maximum\_negative\_similarity |
| C2 | regularization\_constant |
| C\_emb | negative\_margin\_scale |
| droprate\_a | droprate\_dialogue |
| droprate\_b | droprate\_label |
| evaluate\_every\_num\_epochs | evaluate\_every\_number\_of\_epochs |
| evaluate\_on\_num\_examples | evaluate\_on\_number\_of\_examples |

Old configuration options will be mapped to the new names, and a warning will be thrown.
However, these will be deprecated in a future release.

- The Embedding Intent Classifier is now deprecated and will be replaced by [DIETClassifier](https://legacy-docs-oss.rasa.com/docs/rasa/components#dietclassifier)
in the future.
`DIETClassfier` performs intent classification as well as entity recognition.
If you want to get the same model behavior as the current `EmbeddingIntentClassifier`, you can use
the following configuration of `DIETClassifier`:

Copy

pipeline:

\# - ... other components

-name: DIETClassifier

hidden\_layers\_sizes:

text:\[256,128\]

number\_of\_transformer\_layers:0

weight\_sparsity:0

intent\_classification:True

entity\_recognition:False

use\_masked\_language\_model:False

BILOU\_flag:False

scale\_loss:True

use\_sparse\_input\_dropout:False

use\_dense\_input\_dropout:False

\# ... any other parameters

See [DIETClassifier](https://legacy-docs-oss.rasa.com/docs/rasa/components#dietclassifier) for more information about the new component.
Specifying `EmbeddingIntentClassifier` in the configuration maps to the above component definition, and results in
the same behaviour within the same Rasa version.

- `CRFEntityExtractor` is now deprecated and will be replaced by `DIETClassifier` in the future. If you want to
get the same model behavior as the current `CRFEntityExtractor`, you can use the following configuration:

Copy

pipeline:

\# - ... other components

-name: LexicalSyntacticFeaturizer

features:\[\
\
\
\
\["low","title","upper"\],\
\
\
\
\[\
\
\
\
"BOS",\
\
\
\
"EOS",\
\
\
\
"low",\
\
\
\
"prefix5",\
\
\
\
"prefix2",\
\
\
\
"suffix5",\
\
\
\
"suffix3",\
\
\
\
"suffix2",\
\
\
\
"upper",\
\
\
\
"title",\
\
\
\
"digit",\
\
\
\
\],\
\
\
\
\["low","title","upper"\],\
\
\
\
\]

-name: DIETClassifier

intent\_classification:False

entity\_recognition:True

use\_masked\_language\_model:False

number\_of\_transformer\_layers:0

\# ... any other parameters

`CRFEntityExtractor` featurizes user messages on its own, it does not depend on any featurizer.
We extracted the featurization from the component into the new featurizer [LexicalSyntacticFeaturizer](https://legacy-docs-oss.rasa.com/docs/rasa/components#lexicalsyntacticfeaturizer). Thus,
in order to obtain the same results as before, you need to add this featurizer to your pipeline before the
[DIETClassifier](https://legacy-docs-oss.rasa.com/docs/rasa/components#dietclassifier).
Specifying `CRFEntityExtractor` in the configuration maps to the above component definition, the behavior
is unchanged from previous versions.

- If your pipeline contains `CRFEntityExtractor` and `EmbeddingIntentClassifier` you can substitute both
components with [DIETClassifier](https://legacy-docs-oss.rasa.com/docs/rasa/components#dietclassifier). You can use the following pipeline for that:

Copy

pipeline:

\# - ... other components

-name: LexicalSyntacticFeaturizer

-name: DIETClassifier

number\_of\_transformer\_layers:0

\# ... any other parameters

## Rasa 1.6 to Rasa 1.7 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-16-to-rasa-17 "Direct link to heading")

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general-4 "Direct link to heading")

- By default, the `EmbeddingIntentClassifier`, `EmbeddingPolicy`, and `ResponseSelector` will
now normalize the top 10 confidence results if the `loss_type` is `"softmax"` (which has been
default since 1.3, see [Rasa 1.2 to Rasa 1.3](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide#rasa-12-to-rasa-13)). This is configurable via the `ranking_length`
configuration parameter; to turn off normalization to match the previous behavior, set `ranking_length: 0`.

## Rasa 1.2 to Rasa 1.3 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-12-to-rasa-13 "Direct link to heading")

##### caution

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general-5 "Direct link to heading")

- Default parameters of `EmbeddingIntentClassifier` are changed. See
the Components page for details.
Architecture implementation is changed as well, so **old trained models cannot be loaded**.
Default parameters and architecture for `EmbeddingPolicy` are changed. See [Policies](https://legacy-docs-oss.rasa.com/docs/rasa/policies) for details.
It uses transformer instead of lstm. **Old trained models cannot be loaded**.
They use `inner` similarity and `softmax` loss by default instead of
`cosine` similarity and `margin` loss (can be set in config file).
They use `balanced` batching strategy by default to counteract class imbalance problem.
The meaning of `evaluate_on_num_examples` is changed. If it is non zero, random examples will be
picked by stratified split and used as **hold out** validation set, so they will be excluded from training data.
We suggest to set it to zero (default) if data set contains a lot of unique examples of dialogue turns.
Removed `label_tokenization_flag` and `label_split_symbol` from component. Instead moved intent splitting to `Tokenizer` components via `intent_tokenization_flag` and `intent_split_symbol` flag.

- Default `max_history` for `EmbeddingPolicy` is `None` which means it'll use
the `FullDialogueTrackerFeaturizer`. We recommend to set `max_history` to
some finite value in order to use `MaxHistoryTrackerFeaturizer`
for **faster training**. See [Featurizers](https://legacy-docs-oss.rasa.com/docs/rasa/policies#featurizers) for details.
We recommend to increase `batch_size` for `MaxHistoryTrackerFeaturizer`
(e.g. `"batch_size": [32, 64]`)

- **Compare** mode of `rasa train core` allows the whole core config comparison.
Therefore, we changed the naming of trained models. They are named by config file
name instead of policy name. Old naming style will not be read correctly when
creating **compare** plots (`rasa test core`). Please remove old trained models
in comparison folder and retrain. Normal core training is unaffected.

- We updated the **evaluation metric** for our **NER**. We report the weighted precision and f1-score.
So far we included `no-entity` in this report. However, as most of the tokens actually don't have
an entity set, this will influence the weighted precision and f1-score quite a bit. From now on we
exclude `no-entity` from the evaluation. The overall metrics now only include proper entities. You
might see a drop in the performance scores when running the evaluation again.

- `/` is reserved as a delimiter token to distinguish between retrieval intent and the corresponding response text
identifier. Make sure you don't include `/` symbol in the name of your intents.

## Rasa NLU 0.14.x and Rasa Core 0.13.x to Rasa 1.0 [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#rasa-nlu-014x-and-rasa-core-013x-to-rasa-10 "Direct link to heading")

##### caution

### General [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#general-6 "Direct link to heading")

- The scripts in `rasa.core` and `rasa.nlu` can no longer be executed. To train, test, run, … an NLU or Core
model, you should now use the command line interface `rasa`. The functionality is, for the most part, the same as before.
Some changes in commands reflect the combined training and running of NLU and Core models, but NLU and Core can still
be trained and used individually. If you attempt to run one of the old scripts in `rasa.core` or `rasa.nlu`,
an error is thrown that points you to the command you
should use instead. See all the new commands at [Command Line Interface](https://legacy-docs-oss.rasa.com/docs/rasa/command-line-interface).

- If you have written a custom output channel, all `send_` methods subclassed
from the `OutputChannel` class need to take an additional `\*\*kwargs`
argument. You can use these keyword args from your custom action code or the
templates in your domain file to send any extra parameters used in your
channel's send methods.

- If you were previously importing the `Button` or `Element` classes from
`rasa_core.dispatcher`, these are now to be imported from `rasa_sdk.utils`.

- Rasa NLU and Core previously used [separate configuration files](https://legacy-docs.rasa.com/docs/nlu/0.15.1/migrations/?&_ga=2.218966814.608734414.1560704810-314462423.1543594887#id1).
These two files should be merged into a single file either named `config.yml`, or passed via the `--config` parameter.

### Script parameters [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#script-parameters "Direct link to heading")

- All script parameter names have been unified to follow the same schema.
Any underscores (`_`) in arguments have been replaced with dashes (`-`).
For example: `--max_history` has been changed to `--max-history`. You can
see all of the script parameters in the `--help` output of the commands
in the [Command Line Interface](https://legacy-docs-oss.rasa.com/docs/rasa/command-line-interface).

- The `--num_threads` parameter was removed from the `run` command. The
server will always run single-threaded, but will now run asynchronously. If you want to
make use of multiple processes, feel free to check out the [Sanic server\\
documentation](https://sanicframework.org/en/guide/deployment/running.html#gunicorn).

- To avoid conflicts in script parameter names, connectors in the `run` command now need to be specified with
`--connector`, as `-c` is no longer supported. The maximum history in the `rasa visualize` command needs to be
defined with `--max-history`. Output paths and log files cannot be specified with `-o` anymore; `--out` and
`--log-file` should be used. NLU data has been standarized to be `--nlu` and the name of
any kind of data files or directory to be `--data`.

### HTTP API [\#](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/\#http-api "Direct link to heading")

- There are numerous HTTP API endpoint changes which can be found [here](https://legacy-docs-oss.rasa.com/docs/rasa/http-api).

We collect and process your personal information for the following purposes: **Visitor Statistics, Browsing Behavior**.
[Learn more...](https://legacy-docs-oss.rasa.com/docs/rasa/migration-guide/#)

OKDecline
