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

[WIP] Fix length normalization when evaluating on dev set #201

Merged
merged 2 commits into from
Oct 11, 2017

Conversation

neubig
Copy link
Contributor

@neubig neubig commented Oct 11, 2017

Currently it seems that activating length normalization will cause crashing on the second epoch when evaluating on the dev set. This adds a unit test to demonstrate the breakage with the following error:

 Start training in minibatch mode...   
 Epoch 1.0000: train_loss/word=3.066 (words=140, words/sec=5200.58, time=0-00:00:00)   
 initialized PolynomialNormalization({'apply_during_search': True, 'm': 1})   
 > Checkpoint   
   Epoch 1.0000 dev [auxiliary] BLEU4: 0   
   Epoch 1.0000 dev Loss: 2.994 (words=140, words/sec=4514.20, time=0-00:00:00)   
   Epoch 1.0000: best dev score, writing model to examples/output/standard.mod   
 Epoch 2.0000: train_loss/word=2.994 (words=140, words/sec=1628.74, time=0-00:00:00)   
 Traceback (most recent call last):
   File "xnmt/xnmt_run_experiments.py", line 166, in <module>
        sys.exit(main())   
   File "xnmt/xnmt_run_experiments.py", line 127, in main
        xnmt_trainer.run_epoch()   
   File "/Users/neubig/work/xnmt/xnmt/xnmt_train.py", line 245, in run_epoch
        self.dev_evaluation()   
   File "/Users/neubig/work/xnmt/xnmt/xnmt_train.py", line 264, in dev_evaluation
        xnmt.xnmt_decode.xnmt_decode(self.decode_args, model_elements=(self.corpus_parser, self.model))   
   File "/Users/neubig/work/xnmt/xnmt/xnmt_decode.py", line 70, in xnmt_decode
        generator.initialize_generator(**args.params_as_dict)   
   File "/Users/neubig/work/xnmt/xnmt/translator.py", line 98, in initialize_generator
        len_norm = xnmt.serializer.YamlSerializer().initialize_object(kwargs["len_norm_type"])   
   File "/Users/neubig/work/xnmt/xnmt/serializer.py", line 51, in initialize_object
        self.set_serialize_params_recursive(deserialized_yaml)   
   File "/Users/neubig/work/xnmt/xnmt/serializer.py", line 79, in set_serialize_params_recursive
        raise ValueError("unknown init parameter for %s: %s" % (obj.yaml_tag, name))   
 ValueError   :    unknown init parameter for !PolynomialNormalization: context   

I'm not sure the cause of this, but perhaps it's related to argument parsing? Any ideas @msperber or @psjanani ?

@msperber
Copy link
Contributor

This should fix it!

@neubig neubig merged commit 1fd5305 into master Oct 11, 2017
@neubig
Copy link
Contributor Author

neubig commented Oct 11, 2017

Thanks!

@neubig neubig deleted the polynomial-broken branch October 11, 2017 11:15
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

Successfully merging this pull request may close these issues.

None yet

2 participants