facebookresearch / ParlAI

A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
https://parl.ai
MIT License
10.48k stars 2.09k forks source link

how to deploy pretrained agents for conversations within python (i.e. no CLI) #2472

Closed rbroc closed 4 years ago

rbroc commented 4 years ago

Hi there!

I am trying to use ParlAI for a cognitive science project that requires chatbots interacting with humans over repeated iterations, taking into account the whole history of the conversation and storing the resulting conversations for later analysis.

For my setting, I'm mostly using pretrained models and have to use ParlAI's functionality within python (no command line). Finding out how to set up ParlAI agents and worlds from pretrained models without using CLI is proving really challenging.

Would it be possible to request an example script or a tutorial that could pedagogically introduced uninitiated users to deploying agents for purposes that are not training or fine-tuning new models? For my case use, that'd basically include examples of how to initialize agents and worlds from pretrained models, how to set them to 'interaction' mode, how to feed them at each conversational turn with the whole previous history of the conversation, and, potentially, how to store the conversation itself (this latter point should be trivial though, once figured out the previous ones).

I'm mostly planning on using LIGHT models, but figuring out the routine for any model would be absolutely fine.

Thank you in advance, and hope the question makes sense!

stephenroller commented 4 years ago

You’re not wrong, our APIs make this somewhat complicated. I’m planning on writing a very extensive tutorial in the next month, with a draft in the next couple weeks. I can email you an early copy if you’re interested in providing feedback.

rbroc commented 4 years ago

That would be awesome, and I'd be very happy to provide feedback! You can reach me at roberta.rocca@austin.utexas.edu. Thanks a lot! 😊

DasShubhadeep commented 4 years ago

Hi @rbroc and @stephenroller I have a similar requirement. I want to access blender90M model using python and without using CLI. I just want to pass text to it using my python script and get back a response. Is this tutorial ready and can it be shared with me well? Reach me at shubhadeepdas007@gmail.com.

Thanks in advance!

RegisSaffi commented 4 years ago

I would like to get that tutorial to, i have such requirement reach me at regissaffi@gmail.com

stephenroller commented 4 years ago

I did write a version of the tutorial. You can find it in this colab notebook. It makes it so that you can call standard scripts from python code, without going through the command line, but it's still very procedurally oriented. I think the original ask of a minimal example isn't quite there, but would love to see feedback on this colab notebook.

delgermurun commented 4 years ago

Hello @stephenroller,

I have a similar requirement too. Is this tutorial ready? Please share with me (pdelgermurun@gmail.com)

Thanks!

github-actions[bot] commented 4 years ago

This issue has not had activity in 30 days. Please feel free to reopen if you have more issues. You may apply the "never-stale" tag to prevent this from happening.

andyfangaf commented 3 years ago

I'm also interested in taking a look at the Colab (andy@boringordinary.com). Currently I'm using Rasa (tracking conversations) together with ParlAI (training model), but it would be great if I could get rid of the Rasa part. Is this something on the roadmap for ParlAI @stephenroller ?

stephenroller commented 3 years ago

Yes, you can find the latest parlai colab tutorial here.

Edit: for anyone in the future, check https://parl.ai/docs/ for up to date links.

andyfangaf commented 3 years ago

@stephenroller I think that notebook is private, because I'm getting this:

image

stephenroller commented 3 years ago

I was able to access the notebook in an incognito window which wasn't logged into google. Can you try again, or check your google account?