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.1k forks source link

How to style style_gen C75-D+ Generator #3191

Closed plkmo closed 3 years ago

plkmo commented 4 years ago

Hi there, I have been trying out the style_gen model in the model zoo (https://parl.ai/docs/zoo.html#style-controlled-generation-c75-d-generator).

I run the following interactive command: parlai interactive --model projects.style_gen.style_gen:StyleGenAgent --model-file zoo:style_gen/c75_labeled_dialogue_generator/model --use-style-frac 1.00

However, I can't seem to be able to find any documentations (neither here or in the paper) on how exactly the output can be conditioned. Do I append say '[Open]' as a style token before/after my chat inputs? I've tried and it didn't seem to work.

stephenroller commented 4 years ago

@EricMichaelSmith

stephenroller commented 4 years ago

(seems like we need an interactive mode perhaps?)

EricMichaelSmith commented 4 years ago

Cool, good idea - will target working on this during the middle of next week.

plkmo commented 4 years ago

Great, thank you

EricMichaelSmith commented 3 years ago

Hi plkmo! Unfortunately I don't have time to release a full interactive mode for this given my current roadmap. However, it shouldn't be hard to do this yourself: the key is to, in the dictionary-like object that gets passed to the bot agent through its .observe() method, set the 'personality' key to the style that you want the bot to respond with. (If you're not familiar with ParlAI, these dictionary-like objects are Messages: https://parl.ai/docs/core/messages.html?highlight=message#module-parlai.core.message)

github-actions[bot] commented 3 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.

NannaMarcher commented 2 years ago

Hi! I am also curious to know how to pass a personality style to the style_gen model. I am trying to input the personality as a part of a dictionary in the interactive mode, e.g., {personality: sad, text: I have had a bad day}. It does, however, not seem to work - probably since it parses the input from interactive mode as a string and not a dictionary. I am very interested in getting this working, can you help me with this? Thank you in advance!

EricMichaelSmith commented 2 years ago

Hi @NannaMarcher! To get this working with interactive mode, you could for instance write a subclass of InteractiveWorld that parses the user input string to see if a style is included, and then stick that style into the 'personality' field of the Message representing the user's input.

NannaMarcher commented 2 years ago

Thank you so much! Will try that :-)