ConvLab / ConvLab-3

Apache License 2.0
107 stars 30 forks source link

WARNING:root:nlu info_dict is not initialized[BUG] #116

Open SchweitzerGAO opened 1 year ago

SchweitzerGAO commented 1 year ago

Describe the bug When I execute the code in getting_started in Pycharm, it warned as the title without outputting any responds, I am not sure how to solve this. By the way, I downloaded the pretrained DDPT model manually and I put the model in convlab/policy/vtrace_DPT. Is this the correct directory?

pen-ho commented 1 year ago

same question

ChrisGeishauser commented 1 year ago

Hi!

This is a safety warning that you can ignore :)

For the DDPT model, you can basically put it wherever you want. It is just important that you then give the correct path to it. For instance, if you want to start a RL training with the pre-trained DDPT model on semantic level, specify the model path here: https://github.com/ConvLab/ConvLab-3/blob/master/convlab/policy/vtrace_DPT/semantic_level_config.json#L4

Note: in the load_path, omit the ending .pol.mdl please. When the training starts, it should print in the terminal a sentence that the dialogue policy has been loaded using your specified load path.

Hope that helps!

SchweitzerGAO commented 1 year ago

Hi there @ChrisGeishauser I tried to modify as what you said: image but there is still not any responses: image Here is my code, I just copied this from the colab notebook:

from convlab.base_models.t5.nlu import T5NLU
from convlab.base_models.t5.dst import T5DST
from convlab.base_models.t5.nlg import T5NLG
from convlab.policy.vector.vector_nodes import VectorNodes
from convlab.policy.vtrace_DPT import VTRACE
from convlab.dialog_agent import PipelineAgent, BiSession
from convlab.evaluator.multiwoz_eval import MultiWozEvaluator
from pprint import pprint
import random
import numpy as np
import torch

if __name__ == '__main__':
    # go to README.md of each model for more information
    sys_nlu = T5NLU(speaker='user', context_window_size=0, model_name_or_path='ConvLab/t5-small-nlu-multiwoz21')
    sys_dst = T5DST(dataset_name='multiwoz21', speaker='user', context_window_size=100,
                    model_name_or_path='ConvLab/t5-small-dst-multiwoz21')
    # Download pre-trained DDPT model
    vectorizer = VectorNodes(dataset_name='multiwoz21',
                             use_masking=True,
                             manually_add_entity_names=True,
                             seed=0,
                             filter_state=True)
    sys_policy = VTRACE(is_train=False,
                        seed=0,
                        vectorizer=vectorizer,
                        load_path="convlab/policy/vtrace_DPT/supervised")
    sys_nlg = T5NLG(speaker='system', context_window_size=0, model_name_or_path='ConvLab/t5-small-nlg-multiwoz21')
    # assemble
    sys_agent = PipelineAgent(sys_nlu, sys_dst, sys_policy, sys_nlg, name='sys')
    sys_agent.init_session()
    sys_agent.response("Hi there")

What is the problem then? Many thanks if you can help me with this.

ChrisGeishauser commented 1 year ago

@SchweitzerGAO Just to clarify, is the problem for you the warning or that the policy model is not loaded?

SchweitzerGAO commented 1 year ago

I think it may be the problem that the model is not loaded. Does this have anything to do with the hardware? I don't have a GPU on my machine.

ChrisGeishauser commented 1 year ago

No it does not depend on the hardware, i also just have a CPU on my laptop. When I copy your code and use it, it prints for me ... Load actions from file.. Dimension of system actions: 208 Dimension of user actions: 79 State dimension: 361 Loaded policy checkpoint from file: convlab/policy/vtrace_DPT/supervised.pol.mdl WARNING:root:nlu info_dict is not initialized WARNING:root:dst info_dict is not initialized WARNING:root:nlg info_dict is not initialized ...

I put the file in the path convlab/policy/vtrace_DPT/ (but you also said you did that). I used the policy model stored in ConvLabddpt-policy-multiwoz21

Could you check again whether your passed path exists? If it does not work, you can go to the function below

https://github.com/ConvLab/ConvLab-3/blob/master/convlab/policy/vtrace_DPT/vtrace.py#L334

and debug there. Let me know if it works!

zqwerty commented 1 year ago

Hi there @ChrisGeishauser I tried to modify as what you said: image but there is still not any responses: image Here is my code, I just copied this from the colab notebook:

from convlab.base_models.t5.nlu import T5NLU
from convlab.base_models.t5.dst import T5DST
from convlab.base_models.t5.nlg import T5NLG
from convlab.policy.vector.vector_nodes import VectorNodes
from convlab.policy.vtrace_DPT import VTRACE
from convlab.dialog_agent import PipelineAgent, BiSession
from convlab.evaluator.multiwoz_eval import MultiWozEvaluator
from pprint import pprint
import random
import numpy as np
import torch

if __name__ == '__main__':
    # go to README.md of each model for more information
    sys_nlu = T5NLU(speaker='user', context_window_size=0, model_name_or_path='ConvLab/t5-small-nlu-multiwoz21')
    sys_dst = T5DST(dataset_name='multiwoz21', speaker='user', context_window_size=100,
                    model_name_or_path='ConvLab/t5-small-dst-multiwoz21')
    # Download pre-trained DDPT model
    vectorizer = VectorNodes(dataset_name='multiwoz21',
                             use_masking=True,
                             manually_add_entity_names=True,
                             seed=0,
                             filter_state=True)
    sys_policy = VTRACE(is_train=False,
                        seed=0,
                        vectorizer=vectorizer,
                        load_path="convlab/policy/vtrace_DPT/supervised")
    sys_nlg = T5NLG(speaker='system', context_window_size=0, model_name_or_path='ConvLab/t5-small-nlg-multiwoz21')
    # assemble
    sys_agent = PipelineAgent(sys_nlu, sys_dst, sys_policy, sys_nlg, name='sys')
    sys_agent.init_session()
    sys_agent.response("Hi there")

What is the problem then? Many thanks if you can help me with this.

Hi @SchweitzerGAO , maybe you should use print(sys_agent.response("Hi there")). In colab juptyer will auto output the return string, but in a python file the return string is not printed.

SchweitzerGAO commented 1 year ago

Thanks, that helps! @zqwerty By the way, I wonder if you provide any tutorials on training with CrossWoz

pen-ho commented 1 year ago

Is there a CrossWOZ T5NLU, T5DST, and T5NLG pre-trained model that can be tested? Thank you!

zqwerty commented 1 year ago

For CrossWOZ, you can follow the same instruction of T5. Since CrossWOZ is a Chinese dataset, using mT5 may be appropriate. For other models, you can follow their instructions and use the pre-trained models in Chinese. For example, chinese-bert

Is there a CrossWOZ T5NLU, T5DST, and T5NLG pre-trained model that can be tested?

I will train these recently.

SchweitzerGAO commented 1 year ago

Thanks and I will try

zqwerty commented 1 year ago

@pen-ho @SchweitzerGAO I've tried T5NLU, T5DST, and T5NLG for CrossWOZ using multilingual T5 (mT5). Have a try!

pen-ho commented 1 year ago

@pen-ho @SchweitzerGAO I've tried T5NLU, T5DST, and T5NLG for CrossWOZ using multilingual T5 (mT5). Have a try!

Cool, Thank you!

pen-ho commented 1 year ago

@pen-ho @SchweitzerGAO I've tried T5NLU, T5DST, and T5NLG for CrossWOZ using multilingual T5 (mT5). Have a try!

image

I have an error when executing this code on colab. How do I configure the policy model on CrossWOZ? In Covlab2, it used "from convlab2.policy.mle.crosswoz import MLE"

zqwerty commented 1 year ago

Oh, that's a potential bug. CrossWOZ has some slots with - as a concatenation character, which overlaps with the construction of dialog act vocabulary. We are working on this. And we don't have trained policy model for crosswoz yet.

pen-ho commented 1 year ago

I'll wait for this. And I've tested T5NLG for CrossWOZ, it seems better than template-based NLG.

SchweitzerGAO commented 1 year ago

I'll wait for this. And I've tested T5NLG for CrossWOZ, it seems better than template-based NLG.

I have met the same problem as yours when playing with CrossWOZ, did you solve that?

ChrisGeishauser commented 1 year ago

Hi ! Sorry for the late response. I pushed changes to master to use crosswoz with DDPT. You should be able to do inference with it without obtaining a bug now hopefully. I didnt check the supervised training properly though. Let me know if you face more issues! You can try the supervised learning using

python convlab/policy/vtrace_DPT/supervised/train_supervised.py --dataset_name=crosswoz

weizhenzhao commented 1 year ago

@ChrisGeishauser Hi dear it still didn't work

ChrisGeishauser commented 1 year ago

@weizhenzhao Can you tell me the error message? And do you use the most recent code? When you check it, please first delete the folders vtrace_DPT/supervised/data and vtrace_DPT/supervised/processed_data.