Open SchweitzerGAO opened 1 year ago
same question
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!
Hi there @ChrisGeishauser I tried to modify as what you said: but there is still not any responses: 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.
@SchweitzerGAO Just to clarify, is the problem for you the warning or that the policy model is not loaded?
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.
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!
Hi there @ChrisGeishauser I tried to modify as what you said: but there is still not any responses: 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.
Thanks, that helps! @zqwerty By the way, I wonder if you provide any tutorials on training with CrossWoz
Is there a CrossWOZ T5NLU, T5DST, and T5NLG pre-trained model that can be tested? Thank you!
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.
Thanks and I will try
@pen-ho @SchweitzerGAO I've tried T5NLU, T5DST, and T5NLG for CrossWOZ using multilingual T5 (mT5). Have a try!
@pen-ho @SchweitzerGAO I've tried T5NLU, T5DST, and T5NLG for CrossWOZ using multilingual T5 (mT5). Have a try!
Cool, Thank you!
@pen-ho @SchweitzerGAO I've tried T5NLU, T5DST, and T5NLG for CrossWOZ using multilingual T5 (mT5). Have a try!
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"
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.
I'll wait for this. And I've tested T5NLG for CrossWOZ, it seems better than template-based NLG.
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?
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
@ChrisGeishauser Hi dear it still didn't work
@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.
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?