Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstractor validation : ValueError (too many values to unpack) #5

Closed
astariul opened this issue Aug 26, 2019 · 2 comments
Closed

Abstractor validation : ValueError (too many values to unpack) #5

astariul opened this issue Aug 26, 2019 · 2 comments

Comments

@astariul
Copy link

astariul commented Aug 26, 2019

I ran the Abstractor validation with following command :

python train.py -task abs 
-mode validate 
-batch_size 3000 
-test_batch_size 500 
-bert_data_path ~/PreSumm/bert_data/cnndm 
-log_file ../logs/val_abs_bert_cnndm 
-model_path ../models/BertSumExtAbs 
-sep_optim true 
-use_interval true 
-visible_gpus 1 
-max_pos 512 
-max_length 200 
-alpha 0.95 
-min_length 50 
-result_path ../logs/abs_bert_cnndm 
-test_all

But at test time (after evaluating every checkpoints on valid dataset), I got this error :

Traceback (most recent call last):
File "train.py", line 124, in
validate_abs(args, device_id)
File "[...]/PreSumm/src/train_abstractive.py", line 140, in validate_abs
test_abs(args, device_id, cp, step)
File "[...]/PreSumm/src/train_abstractive.py", line 225, in test_abs
predictor.translate(test_iter, step)
File "[...]/PreSumm/src/models/predictor.py", line 157, in translate
translations = self.from_batch(batch_data)
File "[...]/PreSumm/src/models/predictor.py", line 110, in from_batch
batch.tgt_str, batch.src))
ValueError: too many values to unpack (expected 5)

@astariul
Copy link
Author

astariul commented Aug 26, 2019

I replaced :

preds, pred_score, gold_score, tgt_str, src = list(zip(translation_batch["predictions"],
translation_batch["scores"],
translation_batch["gold_score"],
batch.tgt_str, batch.src))

into :

preds, pred_score, gold_score, tgt_str, src =  translation_batch["predictions"], \
                                               translation_batch["scores"], \
                                               translation_batch["gold_score"], \
                                               batch.tgt_str, batch.src

And it seems to work fine.


I keep the issue open to see the author's opinion, if this change is needed or not.

@astariul astariul reopened this Aug 26, 2019
@nlpyang
Copy link
Owner

nlpyang commented Aug 26, 2019

Yes, this is a bug and this has been fixed.

@nlpyang nlpyang closed this as completed Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants