Training and Loading Multiple Models From Same Project

My aim is to train different models from the same project.

Basically I am having two different models with different intents i.e Weather and Restaurent models.

How can i train and load this models. Thanks in Adavance.

@Quresh_Abrar you can train different models by specifying project name, and you can load them in server. by specify the project name, you can use them.

python -m rasa_nlu.server -c nlu.yml --path models/nlu --port 5003

we can use any of these.

1-http://localhost:5003/parse?q=hi&project=resturant
2- http://localhost:5003/parse?q=hi&project=hotel

it is possible for nlu only. I am looking the same for rasa core. But I did not get the solution up till now

Thank you @azizullah2017 for your reply.

you explained about loading the models,

But How to train multiple models in a same project. and what will be the configuration files for multiple models, and should i need to specify separate yml file for each or how ?

are you asking about rasa nlu or rasa core ?

@azizullah2017 rasa nlu

$ python -m rasa_nlu.train
–config config.yml
–data nlu_data/
–path projects

@azizullah2017 Thank you

1 Like

Even I am looking for the same in rasa core. Please tell me if you find anything.

Rasa core does not support multiple models. You have to write your custom code. you have to create multiple agents this is my code

def train_dialogue(domain_file = 'domain.yml',
					model_path = './models/dialogue',
					training_data_file = './data/stories.md'):
					
	agent = Agent(domain_file, policies = [MemoizationPolicy(), KerasPolicy(max_history=3, epochs=200, batch_size=50)])
	data = agent.load_data(training_data_file)	
	

	agent.train(data)
				
	agent.persist(model_path)
	return agent
	
def run_weather_bot(serve_forever=True):
	interpreter = RasaNLUInterpreter('./models/nlu/Auto/Auto')
	domain = TemplateDomain.load("models/dialogue/domain.yml")
	action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
        tracker_store = RedisTrackerStore(domain,host="localhost", port=6379, db= 13)

	agent = Agent.load('domain', interpreter=interpreter,tracker_store=tracker_store, action_endpoint=action_endpoint)
	rasa_core.run.serve_application(agent ,channel='cmdline')
		
	return agent
	
if __name__ == '__main__':
	run_weather_bot()

you can get help

3 Likes

Hi, I’m very new in Rasa. I’m not getting that how can we give custom names to the models, trained and saved as zip|tar folder inside models directory? And, Is there any other way to train multiple models withing same project using mysql and without using Redis?

1 Like