ParlAI框架实践
训练seq2seq模型:
parlai train_model --task cornell_movie --model seq2seq --model-file tmp/model_s2s --batchsize 8 --rnn-class gru --hiddensize 200 --numlayers 2 --bidirectional True --attention dot --attention-time post --lookuptable enc_dec --num-epochs 6 --optimizer adam --learningrate 1e-3
本地交互模式:
parlai interactive --model-file zoo:dodecadialogue/empathetic_dialogues_ft/model --inference beam --beam-size 5 --beam-min-length 10 --beam-block-ngram 3 --beam-context-block-ngram 3
格式化数据集:
python parlai/scripts/convert_data_to_parlai_format.py --task cornell_movie --outfile tmp.txt
python parlai/scripts/convert_data_to_parlai_format.py -t dailydialog --outfile make_data/dailydialog.train --datatype train
构建字典
parlai build_dict -t cornell_movie --dict-file temp_dict_by_nltk.txt --dict-lower True --dict_tokenizer nltk
消息传递过程:
query = teacher.act() student.observe(query) reply = student.act() teacher.observe(reply)
python 打印调用栈
import traceback traceback.print_stack()
list of metrics
accuracy: Exact match text accuracy bleu-4: BLEU-4 of the generation, under a standardized (model-independent) tokenizer clen: Average length of context in number of tokens clip: Fraction of batches with clipped gradients ctpb: Context tokens per batch ctps: Context tokens per second ctrunc: Fraction of samples with some context truncation ctrunclen: Average length of context tokens truncated exps: Examples per second exs: Number of examples processed since last print f1: Unigram F1 overlap, under a standardized (model-independent) tokenizer gnorm: Gradient norm gpu_mem: Fraction of GPU memory used. May slightly underestimate true value. hits@1: Fraction of correct choices in 1 guess. (Similar to recall@K) hits@5: Fraction of correct choices in 5 guesses. (Similar to recall@K) interdistinct-1: Fraction of n-grams unique across all generations interdistinct-2: Fraction of n-grams unique across all generations intradictinct-2: Fraction of n-grams unique within each utterance intradistinct-1: Fraction of n-grams unique within each utterance jga: Joint Goal Accuracy llen: Average length of label in number of tokens loss: Loss lr: The most recent learning rate applied ltpb: Label tokens per batch ltps: Label tokens per second ltrunc: Fraction of samples with some label truncation ltrunclen: Average length of label tokens truncated rouge-1: ROUGE metrics rouge-2: ROUGE metrics rouge-L: ROUGE metrics token_acc: Token-wise accuracy (generative only) token_em: Utterance-level token accuracy. Roughly corresponds to perfection under greedy search (generative only) total_train_updates: Number of SGD steps taken across all batches tpb: Total tokens (context + label) per batch tps: Total tokens (context + label) per second ups: Updates per second (approximate)
print(train_report)
{
'exs': SumMetric(400),
'clen': AverageMetric(32.88),
'ctrunc': AverageMetric(0),
'ctrunclen': AverageMetric(0),
'llen': AverageMetric(13.43),
'ltrunc': AverageMetric(0),
'ltrunclen': AverageMetric(0),
'loss': AverageMetric(9.64),
'ppl': PPLMetric(1.536e+04),
'token_acc': AverageMetric(0.1015),
'token_em': AverageMetric(0),
'exps': GlobalTimerMetric(107.3),
'ltpb': GlobalAverageMetric(107.4),
'ltps': GlobalTimerMetric(1441),
'ctpb': GlobalAverageMetric(263.1),
'ctps': GlobalTimerMetric(3527),
'tpb': GlobalAverageMetric(370.5),
'tps': GlobalTimerMetric(4968),
'ups': GlobalTimerMetric(13.41),
'gnorm': GlobalAverageMetric(3.744),
'clip': GlobalAverageMetric(1),
'lr': GlobalAverageMetric(1),
'gpu_mem': GlobalAverageMetric(0.2491),
'total_train_updates': GlobalFixedMetric(50)
}
torch_agent.py的batch_act调用栈
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 939, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 903, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 804, in train_steps
world.parley()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 867, in parley
batch_act = self.batch_act(agent_idx, batch_observations[agent_idx])
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 835, in batch_act
batch_actions = a.batch_act(batch_observation)
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/torch_agent.py", line 2128, in batch_act
traceback.print_stack()
print(batch_reply)
[
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(285), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(20), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(10.44), 'ppl': PPLMetric(3.43e+04), 'token_acc': AverageMetric(0), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(10), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(33), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(10.62), 'ppl': PPLMetric(4.108e+04), 'token_acc': AverageMetric(0.06061), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(52), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(4), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(9.659), 'ppl': PPLMetric(1.565e+04), 'token_acc': AverageMetric(0), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(60), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(3), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(8.532), 'ppl': PPLMetric(5076), 'token_acc': AverageMetric(0.3333), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(9), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(24), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(10.06), 'ppl': PPLMetric(2.339e+04), 'token_acc': AverageMetric(0.125), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(14), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(20), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(8.522), 'ppl': PPLMetric(5024), 'token_acc': AverageMetric(0.4), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(5), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(21), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(10.05), 'ppl': PPLMetric(2.314e+04), 'token_acc': AverageMetric(0.1905), 'token_em': AverageMetric(0)}},
{'id': 'Seq2Seq', 'episode_done': False, 'metrics': {'clen': AverageMetric(12), 'ctrunc': AverageMetric(0), 'ctrunclen': AverageMetric(0), 'llen': AverageMetric(3), 'ltrunc': AverageMetric(0), 'ltrunclen': AverageMetric(0), 'loss': AverageMetric(10.15), 'ppl': PPLMetric(2.56e+04), 'token_acc': AverageMetric(0), 'token_em': AverageMetric(0)}}
]
batch交互过程:

metrics.report调用栈
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 941, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 905, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 842, in train_steps
yield self.log()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 751, in log
train_report = self.world.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 963, in report
return self.world.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 392, in report
m = a.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/teachers.py", line 225, in report
return self.metrics.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/metrics.py", line 914, in report
traceback.print_stack()
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 941, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 905, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 842, in train_steps
yield self.log()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 751, in log
train_report = self.world.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 963, in report
return self.world.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 392, in report
m = a.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/torch_agent.py", line 1172, in report
report = self.global_metrics.report()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/metrics.py", line 914, in report
traceback.print_stack()
clear metric的调用栈:
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 941, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 905, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 842, in train_steps
yield self.log()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 753, in log
self.world.reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 977, in reset_metrics
self.world.reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 272, in reset_metrics
a.reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/teachers.py", line 239, in reset_metrics
self.metrics.clear()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/metrics.py", line 934, in clear
traceback.print_stack()
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 941, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 905, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 842, in train_steps
yield self.log()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/scripts/train_model.py", line 753, in log
self.world.reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 977, in reset_metrics
self.world.reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/worlds.py", line 272, in reset_metrics
a.reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/torch_generator_agent.py", line 638, in reset_metrics
super().reset_metrics()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/torch_agent.py", line 2103, in reset_metrics
self.global_metrics.clear()
File "/mnt/hdd2/yanghh/ParlAI-master/parlai/core/metrics.py", line 934, in clear
traceback.print_stack()
eval_step()调用栈:
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 935, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 899, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 850, in train_steps
stop_training = self.validate()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 500, in validate
self.valid_worlds, opt, 'valid', opt['validation_max_exs']
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 627, in _run_eval
task_report = self._run_single_eval(opt, v_world, max_exs_per_worker)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 593, in _run_single_eval
valid_world.parley()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/worlds.py", line 865, in parley
batch_act = self.batch_act(agent_idx, batch_observations[agent_idx])
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/worlds.py", line 833, in batch_act
batch_actions = a.batch_act(batch_observation)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/torch_agent.py", line 2208, in batch_act
traceback.print_stack()
_set_text_vec调用栈:
File "/home/lee/anaconda3/envs/pariai/bin/parlai", line 33, in <module>
sys.exit(load_entry_point('parlai', 'console_scripts', 'parlai')())
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/__main__.py", line 14, in main
superscript_main()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/script.py", line 324, in superscript_main
return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/script.py", line 107, in _run_from_parser_and_opt
return script.run()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 935, in run
return self.train_loop.train()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 899, in train
for _train_log in self.train_steps():
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/scripts/train_model.py", line 802, in train_steps
world.parley()
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/worlds.py", line 873, in parley
obs = self.batch_observe(other_index, batch_act, agent_idx)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/worlds.py", line 817, in batch_observe
observation = agents[index].observe(observation)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/torch_agent.py", line 1855, in observe
label_truncate=self.label_truncate,
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/torch_generator_agent.py", line 656, in vectorize
return super().vectorize(*args, **kwargs)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/torch_agent.py", line 1590, in vectorize
self._set_text_vec(obs, history, text_truncate)
File "/mnt/hdd2/yanghh/experiments/ParlAI-master/parlai/core/torch_agent.py", line 1439, in _set_text_vec
traceback.print_stack()
Transformer某一层的参数:
"encoder.layers.6.attention.q_lin.weight", "encoder.layers.6.attention.q_lin.bias", "encoder.layers.6.attention.k_lin.weight", "encoder.layers.6.attention.k_lin.bias", "encoder.layers.6.attention.v_lin.weight", "encoder.layers.6.attention.v_lin.bias", "encoder.layers.6.attention.out_lin.weight", "encoder.layers.6.attention.out_lin.bias", "encoder.layers.6.norm1.weight", "encoder.layers.6.norm1.bias", "encoder.layers.6.ffn.lin1.weight", "encoder.layers.6.ffn.lin1.bias", "encoder.layers.6.ffn.lin2.weight", "encoder.layers.6.ffn.lin2.bias", "encoder.layers.6.norm2.weight", "encoder.layers.6.norm2.bias", "decoder.layers.6.self_attention.q_lin.weight", "decoder.layers.6.self_attention.q_lin.bias", "decoder.layers.6.self_attention.k_lin.weight", "decoder.layers.6.self_attention.k_lin.bias", "decoder.layers.6.self_attention.v_lin.weight", "decoder.layers.6.self_attention.v_lin.bias", "decoder.layers.6.self_attention.out_lin.weight", "decoder.layers.6.self_attention.out_lin.bias", "decoder.layers.6.norm1.weight", "decoder.layers.6.norm1.bias", "decoder.layers.6.encoder_attention.q_lin.weight", "decoder.layers.6.encoder_attention.q_lin.bias", "decoder.layers.6.encoder_attention.k_lin.weight", "decoder.layers.6.encoder_attention.k_lin.bias", "decoder.layers.6.encoder_attention.v_lin.weight", "decoder.layers.6.encoder_attention.v_lin.bias", "decoder.layers.6.encoder_attention.out_lin.weight", "decoder.layers.6.encoder_attention.out_lin.bias", "decoder.layers.6.norm2.weight", "decoder.layers.6.norm2.bias", "decoder.layers.6.ffn.lin1.weight", "decoder.layers.6.ffn.lin1.bias", "decoder.layers.6.ffn.lin2.weight", "decoder.layers.6.ffn.lin2.bias", "decoder.layers.6.norm3.weight", "decoder.layers.6.norm3.bias",
[ training... ]
fffffffffff ['\n who saved you ?']
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
===================================
gggggggggggg ["i __unk__ . i had i my my i i ' i had i i my . ' . ."]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
+++++++++++++++++++++++++++++++++++
fffffffffff ['\n who saved you ?']
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
===================================
gggggggggggg ["i __unk__ . i had i my my i i ' i had i i my . ' . ."]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
+++++++++++++++++++++++++++++++++++
fffffffffff ['\n who saved you ?']
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
===================================
gggggggggggg ["i __unk__ . i had i my my i i ' i had i i my . ' . ."]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
+++++++++++++++++++++++++++++++++++
fffffffffff ['\n who saved you ?']
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
===================================
gggggggggggg ["i __unk__ . i had i my my i i ' i had i i my . ' . ."]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
+++++++++++++++++++++++++++++++++++
fffffffffff ['\n who saved you ?']
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
===================================
gggggggggggg ["i __unk__ . i had i my my i i ' i had i i my . ' . ."]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
+++++++++++++++++++++++++++++++++++
fffffffffff ["\n who saved you ? \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n someone paid off my student loans for me ? i ' m shocked !"]
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ Someone paid off my student loans for me? I'm shocked!
__newln__ Holy cow! That's amazing! Congrats!
===================================
gggggggggggg ["that , , that ' s a , i . i"]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
+++++++++++++++++++++++++++++++++++
fffffffffff ["\n who saved you ? \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n someone paid off my student loans for me ? i ' m shocked !"]
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ Someone paid off my student loans for me? I'm shocked!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
===================================
gggggggggggg ["that , , that ' s a , i . i"]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
+++++++++++++++++++++++++++++++++++
fffffffffff ["\n who saved you ? \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n someone paid off my student loans for me ? i ' m shocked !"]
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ Someone paid off my student loans for me? I'm shocked!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
===================================
gggggggggggg ["that , , that ' s a , i . i"]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
+++++++++++++++++++++++++++++++++++
fffffffffff ["\n who saved you ? \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n someone paid off my student loans for me ? i ' m shocked !"]
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ Someone paid off my student loans for me? I'm shocked!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
===================================
gggggggggggg ["that , , that ' s a , i . i"]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
+++++++++++++++++++++++++++++++++++
fffffffffff ["\n who saved you ? \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n someone paid off my student loans for me ? i ' m shocked !"]
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ Someone paid off my student loans for me? I'm shocked!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
===================================
gggggggggggg ["that , , that ' s a , i . i"]
+++++++++++++++++++++++++++++++++++
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ i __unk__ . i had i my my i i ' i had i i my . ' . .
__newln__ that ' s nice . i ' m i ' m i had a nice .
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
__newln__ that , , that ' s a , i . i
__newln__ i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m i ' m
+++++++++++++++++++++++++++++++++++
fffffffffff ["\n who saved you ? \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n my sister thought i was playing around but when she realized i was really in trouble she grabbed me . \n someone paid off my student loans for me ? i ' m shocked ! \n holy cow ! that ' s amazing ! __unk__ ! \n holy cow ! that ' s amazing ! __unk__ ! \n holy cow ! that ' s amazing ! __unk__ ! \n holy cow ! that ' s amazing ! __unk__ ! \n holy cow ! that ' s amazing ! __unk__ ! \n yes , it ' s going to help me out so much !"]
===================================
__newln__ who saved you?
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ My sister thought I was playing around but when she realized I was really in trouble she grabbed me.
__newln__ Someone paid off my student loans for me? I'm shocked!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Holy cow! That's amazing! Congrats!
__newln__ Yes, it's going to help me out so much!
__newln__ That's really amazing. How generous.
===================================
^CTraceback (most recent call last):
File "train.py", line 248, in <module>
ReinforceLoop(setup_rl_args().parse_args()).train()
File "train.py", line 224, in train
world.parley()
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/rl/worlds.py", line 88, in parley
actions = self.rollout(initial_action)
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/rl/worlds.py", line 197, in rollout
return roll(initial, self.opt['dialog_rounds'])
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/rl/worlds.py", line 186, in roll
roll(active_action, num_rollouts - 1))
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/rl/worlds.py", line 144, in roll
act = self.static_agent.act()
File "/home/ztl301/yanghh/ParlAI-master/parlai/core/torch_agent.py", line 2290, in act
response = self.batch_act([self.observation])[0]
File "/home/ztl301/yanghh/ParlAI-master/parlai/core/torch_agent.py", line 2386, in batch_act
output = self.eval_step(batch)
File "/home/ztl301/yanghh/ParlAI-master/parlai/core/torch_generator_agent.py", line 902, in eval_step
beam_preds_scores, beams = self._generate(batch, self.beam_size, maxlen)
File "/home/ztl301/yanghh/ParlAI-master/parlai/core/torch_generator_agent.py", line 1242, in _generate
score, incr_state = model.decoder(decoder_input, encoder_states, incr_state)
File "/home/ztl301/anaconda3/envs/bot/lib/python3.7/site-packages/torch-1.10.2-py3.7-linux-x86_64.egg/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/transformer/modules/decoder.py", line 390, in forward
tensor, encoder_output, encoder_mask, incr_state
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/transformer/modules/decoder.py", line 346, in forward_layers
incr_state=incr_state.get(idx),
File "/home/ztl301/anaconda3/envs/bot/lib/python3.7/site-packages/torch-1.10.2-py3.7-linux-x86_64.egg/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/transformer/modules/decoder.py", line 125, in forward
static_kv=True,
File "/home/ztl301/anaconda3/envs/bot/lib/python3.7/site-packages/torch-1.10.2-py3.7-linux-x86_64.egg/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ztl301/yanghh/ParlAI-master/parlai/agents/transformer/modules/attention.py", line 243, in forward
attentioned = attn_weights.bmm(v)
KeyboardInterrupt
未完待续。。。。。。
浙公网安备 33010602011771号