I am a beginner to this forum and i am trying to run my train_init.py code to train my BOT. But i get the below error. can someone please help? i am not able to identify which function is giving a none response. I compared the agent.py and domain.py in github and looks like they are recent .
train_init.p
from future import absolute_import from future import division from future import unicode_literals
import logging
from rasa_core.agent import Agent from rasa_core.policies.keras_policy import KerasPolicy from rasa_core.policies.memoization import MemoizationPolicy
if name == ’ main ': logging.basicConfig(level=‘INFO’)
training_data_file = './data/stories.md'
model_path = './models/dialogue'
agent = Agent('weather_domain.yml', policies = [MemoizationPolicy(max_history=2), KerasPolicy(max_history=4)])
data = agent.load_data(training_data_file)
agent.train(data)
agent.persist(model_path)
Below is my Domain.yaml slots: location: type: text
intents:
- greet
- goodbye
- request
entities:
- location
templates: utter_greet:
- ‘Hello! How can i help?’ utter_goodbye:
- ‘See you soon.’
- ‘Bye.’ utter_ask_location:
- ‘In what location?’
actions:
- utter_greet
- utter_goodbye
- utter_ask_location
- actions_weather
Error i receive:
/Applications/anaconda3/lib/python3.7/site-packages/rasa_core/ init .py:12: UserWarning: The ‘rasa_core’ package has been renamed. You should change your imports to use ‘rasa.core’ instead.
UserWarning, WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter_greet’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template. WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter_goodbye’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template. WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter_goodbye’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template. WARNING:rasa.core.domain:Deprecated: Templates should not be strings anymore. Utterance template ‘utter_ask_location’ should contain either '- text: ’ or '- custom: ’ attribute to be a proper template.
AttributeError Traceback (most recent call last) in 15 model_path = ‘./models/dialogue’ 16 —> 17 agent = Agent(‘weather_domain.yml’, policies = [MemoizationPolicy(max_history=2), KerasPolicy(max_history=4)]) 18 data = agent.load_data(training_data_file) 19 agent.train(data)
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/agent.py in init (self, domain, policies, interpreter, generator, tracker_store, action_endpoint, fingerprint, model_directory, model_server, remote_storage) 287 ): 288 # Initializing variables with the passed parameters. –> 289 self.domain = self._create_domain(domain) 290 if self.domain: 291 self.domain.add_requested_slot()
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/agent.py in _create_domain(domain) 806 807 if isinstance(domain, str): –> 808 domain = Domain.load(domain) 809 domain.check_missing_templates() 810 return domain
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in load(cls, paths, skill_imports) 76 domain = Domain.empty() 77 for path in paths: —> 78 other = cls.from_path(path, skill_imports) 79 domain = domain.merge(other) 80
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from_path(cls, path, skill_imports) 90 91 if os.path.isfile(path): —> 92 domain = cls.from_file(path) 93 elif os.path.isdir(path): 94 domain = cls.from_directory(path, skill_imports)
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from_file(cls, path) 103 @classmethod 104 def from_file(cls, path: Text) -> “Domain”: –> 105 return cls.from_yaml(rasa.utils.io.read_file(path)) 106 107 @classmethod
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from_yaml(cls, yaml) 113 114 data = rasa.utils.io.read_yaml(yaml) –> 115 return cls.from_dict(data) 116 117 @classmethod
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in from_dict(cls, data) 118 def from_dict(cls, data: Dict) -> “Domain”: 119 utter_templates = cls.collect_templates(data.get(“templates”, {})) –> 120 slots = cls.collect_slots(data.get(“slots”, {})) 121 additional_arguments = data.get(“config”, {}) 122 intent_properties = cls.collect_intent_properties(data.get(“intents”, {}))
/Applications/anaconda3/lib/python3.7/site-packages/rasa/core/domain.py in collect_slots(slot_dict) 207 slots = [] 208 for slot_name in sorted(slot_dict): –> 209 slot_class = Slot.resolve_by_type(slot_dict[slot_name].get(“type”)) 210 if “type” in slot_dict[slot_name]: 211 del slot_dict[slot_name][“type”]
AttributeError: ‘NoneType’ object has no attribute ‘get’