1

`from rasa_nlu.training_data import load_data from rasa_nlu.config import RasaNLUModelConfig from rasa_nlu.model import Trainer from rasa_nlu import config

Load training data

training_data = load_data("intent.md")

Use trainer to load configuration data the needs to be learnt by the model

trainer = Trainer(config.load("config.yml"))

Train model on training data

interpreter = trainer.train(training_data)

Save Model

model_directory = trainer.persist("./models/nlu")`

This is the error that I am getting, this is when I am trying to load the config.yml file ->

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-77-03eebd55ea43> in <module>
      8 
      9 # Use trainer to load configuration data the needs to be learnt by the model
---> 10 trainer = Trainer(config.load("config.yml"))
     11 
     12 # Train model on training data

~\anaconda3\envs\py36\lib\site-packages\rasa_nlu\config.py in load(filename, **kwargs)
     42     if filename is not None:
     43         try:
---> 44             file_config = utils.read_yaml_file(filename)
     45         except yaml.parser.ParserError as e:
     46             raise InvalidConfigError("Failed to read configuration file "

~\anaconda3\envs\py36\lib\site-packages\rasa_nlu\utils\__init__.py in read_yaml_file(filename)
    234 def read_yaml_file(filename):
    235     fix_yaml_loader()
--> 236     return yaml.load(read_file(filename, "utf-8"))
    237 
    238 

TypeError: load() missing 1 required positional argument: 'Loader'

Please help me find a solution for this.

1 Answers1

0

Now, the load() function requires parameter loader=Loader.

If your YAML file contains just simple YAML (str, int, lists), try to use yaml.safe_load() instead of yaml.load(). And If you need FullLoader, you can use yaml.full_load().

Starting from pyyaml>=5.4, it doesn't have any discovered critical vulnerabilities, pyyaml status.

source: https://stackoverflow.com/a/1774043/13755823

Chandan Gupta
  • 684
  • 4
  • 11