quentin-burthier / DCA

PyTorch implementation of Deep Communicating Agents for Abstractive Summarization
MIT License
8 stars 2 forks source link

What does 'extended_voc_sz' in multi_agents.py means? NameError: name 'extended_voc_sz' is not defined #4

Open zide05 opened 4 years ago

zide05 commented 4 years ago

File "teacher_forcing.py", line 140, in teacher_forcing_training(args) File "teacher_forcing.py", line 130, in teacher_forcing_training trainer.fit(summarizer_module) File "/remote-home/yrchen/anaconda3/envs/pytorch1.2_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 754, in fit self.single_gpu_train(model) File "/remote-home/yrchen/anaconda3/envs/pytorch1.2_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 802, in single_gpu_train self.run_pretrain_routine(model) File "/remote-home/yrchen/anaconda3/envs/pytorch1.2_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1043, in run_pretrain_routine self.evaluate(model, self.get_val_dataloaders(), self.nb_sanity_val_steps, self.testing) File "/remote-home/yrchen/anaconda3/envs/pytorch1.2_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 611, in evaluate test) File "/remote-home/yrchen/anaconda3/envs/pytorch1.2_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 569, in evaluation_forward output = model.validation_step(*args) File "teacher_forcing.py", line 54, in validation_step return self.training_step(batch, batch_nb) File "teacher_forcing.py", line 50, in training_step prev_input, prev_input_length) File "teacher_forcing.py", line 42, in forward prev_input, prev_input_length) File "/remote-home/yrchen/anaconda3/envs/pytorch1.2_p37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call__ result = self.forward(*input, **kwargs) File "/remote-home/yrchen/tasks/summarization/DCA/model/multi_agents.py", line 65, in forward torch.zeros(extended_voc_sz, device=self.device))) NameError: name 'extended_voc_sz' is not defined

zide05 commented 4 years ago

how to get the extended_voc_sz?

quentin-burthier commented 4 years ago

The extended vocabulary is the concatenation of the vocabulary and the out-of-vocabulary words present in the article, and is used for the copy mechanism. I have not yet implement this mechanism. You can find implementations here and here.