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

AttributeError: 'EnsembleModel' object has no attribute 'incremental_states' #11

Open
lidongxing opened this issue Feb 24, 2022 · 0 comments

Comments

@lidongxing
Copy link

When I run the shell, " python sgnmt/decode.py --config_file fairseq.ini:, the errors ocurr:

sgnmt> Why is it rare to discover new marine mammal species ?
2022-02-24 15:02:31,595 INFO: Start time: 1645686151.5952792
2022-02-24 15:02:31,595 INFO: Next sentence (ID: 1): Why is it rare to discover new marine mammal species ?
2022-02-24 15:02:31,597 DEBUG: BPE segmentation: 'Why is it rare to discover new marine mammal species ?' => 'Why is it rare to discover new marine mam@@ mal species ?' (5933 18 39 7019 9 7631 75 2269 21907 6082 988 185)
2022-02-24 15:02:31,612 CRITICAL: Attribute error at sentence id 1: 'EnsembleModel' object has no attribute 'incremental_states'. This often indicates an error in the predictor configuration which could not be detected in initialisation. Stack trace: Traceback (most recent call last):
File "/home/lidongxing/anaconda3/envs/sgnmt_env/lib/python3.7/cmd.py", line 214, in onecmd
func = getattr(self, 'do_' + cmd)
AttributeError: 'SGNMTPrompt' object has no attribute 'do_Why'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/lidongxing/sgnmt/cam/sgnmt/decode_utils.py", line 905, in do_decode
hypos = [hypo for hypo in decoder.decode(src)
File "/home/lidongxing/sgnmt/cam/sgnmt/decoding/beam.py", line 186, in decode
self.initialize_predictors(src_sentence)
File "/home/lidongxing/sgnmt/cam/sgnmt/decoding/core.py", line 840, in initialize_predictors
p.initialize(src_sentence)
File "/home/lidongxing/sgnmt/cam/sgnmt/predictors/pytorch_fairseq.py", line 133, in initialize
self.model.incremental_states[model] = {}
File "/home/lidongxing/anaconda3/envs/sgnmt_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1178, in getattr
type(self).name, name))
AttributeError: 'EnsembleModel' object has no attribute 'incremental_states'

How to sove it ? Thanks.

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

1 participant