SivilTaram / Persona-Dialogue-Generation

The code of ACL 2020 paper "You Impress Me: Dialogue Generation via Mutual Persona Perception"
MIT License
309 stars 46 forks source link

.dict file missing? #3

Closed qlee01 closed 4 years ago

qlee01 commented 4 years ago

Hey, while trying to run the eval or inference scripts,I get error:

RuntimeError: WARNING: Neither the specified dict file (./tmp/dict/convai2_self_seq2seq_model_b.dict) nor the model_file.dict file (./tmp/psquare/psqaure_original.model.dict) exists, check to make sure either is correct

this file does not seem to be part of the downloaded models, where to get it from ? Thanks!

SivilTaram commented 4 years ago

@qlee01 You're correct, sorry for the missing file. I'm repacking the downloaded model and will update the dropbox link later, thanks for your feedback!

SivilTaram commented 4 years ago

@qlee01 I have updated the pretrained model weights (along with the dict file). Enjoy it ! ☕

qlee01 commented 4 years ago

@SivilTaram Thanks, this kinda worked; making more progress. However, now I get a different error at a later stage:

ftfy or spacy is not installed using BERT BasicTokenizer instead of SpaCy & ftfy.
Traceback (most recent call last):
  File "eval_f1.py", line 51, in <module>
    eval_f1(opt, print_parser=parser)
  File "eval_f1.py", line 35, in eval_f1
    report = eval_model(opt, print_parser)
  File "/Users/na/workspace/Persona-Dialogue-Generation/parlai/scripts/eval_model.py", line 68, in eval_model
    agent = create_agent(opt, requireModelExists=True)
  File "/Users/na/workspace/Persona-Dialogue-Generation/parlai/core/agents.py", line 551, in create_agent
    model = load_agent_module(opt)
  File "/Users/na/workspace/Persona-Dialogue-Generation/parlai/core/agents.py", line 424, in load_agent_module
    return model_class(new_opt)
  File "/Users/na/workspace/Persona-Dialogue-Generation/agents/psquare/psquare.py", line 416, in __init__
    coherent_gpt_model = Gpt2SeqModel(opt=language_opt,
UnboundLocalError: local variable 'language_opt' referenced before assignment

I did one former change in agents.py: I hardcoded values for

module_name = "agents.psquare.psquare" class_name="PSquareAgent"

as it through an error before due to trying to access agents.dsquare.dsquare.TransformerAgent, which does not exist in the project.

SivilTaram commented 4 years ago

@qlee01 I have checked the results of eval_hits.py and eval_f1.py, and they both work fine for me. So I guess you are trying to make your custom script to inference on the downloaded models? If so, please override the model parameter, as done in the above two evaluation scripts:

model='agents.transmitter.transmitter:TransformerAgent'

as it through an error before due to trying to access agents.dsquare.dsquare.TransformerAgent, which does not exist in the project.

As for this problem, I want to clarify a litte here: the pretrianed models are trained before we submit our paper to the conference. And I have cleaned & refactored some code (e.g. move dsquare to psquare for better reading) so it is not totally suited for the current project. Fortunately, we could override any loaded dict option. BUT please attention, the model filed should refer to agents.transmitter.transmitter:TransformerAgent rather than agents.psquare.psquare.TransformerAgent. The latter one is only for training an transmitter:TransformerAgent in the self-play world using our reward, and the normal inference should be executed on the transmitter. Hope it could help you, thanks :)

qlee01 commented 4 years ago

actually, I am trying to run interaction; now hardcoding to the class you mentioned brought me one step further, many thanks! Now I am getting to the dialogue. However, after entering something, I get following error:

BOT PERSONA:
['your persona: she taught me to cook.', 'your persona: she died when i was 18.', 'your persona: my mother is from russia.', 'your persona: i have a dog.', '']
Enter Your Message: hey
Traceback (most recent call last):
  File "interactive.py", line 142, in <module>
    interactive(parser.parse_args(print_args=False), print_parser=parser)
  File "interactive.py", line 123, in interactive
    acts[1] = agents[1].act()
  File "/Users/f.kuhlmann/workspace/Persona-Dialogue-Generation/agents/transmitter/transmitter.py", line 900, in act
    return self.batch_act([self.observation])[0]
  File "/Users/f.kuhlmann/workspace/Persona-Dialogue-Generation/agents/transmitter/transmitter.py", line 865, in batch_act
    observations)
  File "/Users/f.kuhlmann/workspace/Persona-Dialogue-Generation/agents/transmitter/transmitter.py", line 807, in vectorize
    curr_lcs = list(observations[v]['label_candidates'])
TypeError: 'NoneType' object is not iterable
SivilTaram commented 4 years ago

@qlee01 I will check it tomorrow (it’s midnight in China). And I will update the interactive.py for your purpose. Please stay tuned!

qlee01 commented 4 years ago

great, thanks and good night!

SivilTaram commented 4 years ago

@qlee01 Hi bro, I have fixed the issue. Now you are expected to run interative.py. Enjoiy it! 🍰

qlee01 commented 4 years ago

superb, yes, I can confirm now it works! Thank you again.

SivilTaram commented 4 years ago

Thanks for your ongoing interest :)