TypeError: stat: path should be string, bytes, os.PathLike or integer, not TrainingResult

2.1k views Asked by At

this is my code :

from rasa.jupyter import chat 
endpoints = "endpoints.yml"
chat(model_path, endpoints)

It gives Error:

TypeError Traceback (most recent call last) in 2 3 endpoints = "endpoints.yml" ----> 4 chat(model_path, endpoints)

C:\anaconda\envs\newrasa\lib\site-packages\rasa\jupyter.py in chat(model_path, endpoints, agent, interpreter) 35 from rasa.run import create_agent 36 ---> 37 agent = create_agent(model_path, endpoints) 38 39 elif agent is not None and interpreter is not None:

C:\anaconda\envs\newrasa\lib\site-packages\rasa\run.py in create_agent(model, endpoints) 72 _lock_store = LockStore.create(_endpoints.lock_store) 73 ---> 74 return Agent.load( 75 model, 76 generator=_endpoints.nlg,

C:\anaconda\envs\newrasa\lib\site-packages\rasa\core\agent.py in load(cls, model_path, interpreter, generator, tracker_store, lock_store, action_endpoint, model_server, remote_storage, path_to_model_archive, new_config, finetuning_epoch_fraction) 414 if not model_path: 415 raise ModelNotFound("No path specified.") --> 416 if not os.path.exists(model_path): 417 raise ModelNotFound(f"No file or directory at '{model_path}'.") 418 if os.path.isfile(model_path):

C:\anaconda\envs\newrasa\lib\genericpath.py in exists(path) 17 """Test whether a path exists. Returns False for broken symbolic links""" 18 try: ---> 19 os.stat(path) 20 except (OSError, ValueError): 21 return False

TypeError: stat: path should be string, bytes, os.PathLike or integer, not TrainingResult

2

There are 2 answers

1
Сергей Стёпин On
chat(model_path.model, endpoints)
0
José On

The error is due to the fact that the function expects a string containing the path to the generated tar.gz, and not an object. The path is in model_path.model