question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Evaluation: AttributeError: 'Namespace' object has no attribute 'caption_model'

See original GitHub issue

When running eval.py on python2.7, I get this error:

File "eval.py", line 99, in <module> model = models.setup(opt) File "/path/to/neuraltalk2.pytorch/models.py", line 16, in setup if opt.caption_model == 'show_tell': AttributeError: 'Namespace' object has no attribute 'caption_model'

It looks like the “caption_model” argument is missing from the Argument Parser in eval.py, causing an error to be thrown when model.py attempts to access it.

I see that there are model settings are in “opts.py”. Are we somehow meant to import these?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ruotianluocommented, Jul 26, 2017

ignore = [“id”, “batch_size”, “beam_size”, “start_from”, “language_eval”] for k in vars(infos[‘opt’]).keys(): if k not in ignore: if k in vars(opt): assert vars(opt)[k] == vars(infos[‘opt’])[k], k + ’ option not consistent’ else: vars(opt).update({k: vars(infos[‘opt’])[k]}) # copy over options from model

This part of the code is copying options from the infos.pkl. If you are using the infos.pkl, can you check if caption_model is included in the infos’s option.

0reactions
ruotianluocommented, Jul 27, 2017

I uploaded a corrected one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'Namespace' object has no attribute
You're parsing command line arguments into args , which is a Namespace with attributes set to the parsed arguments.
Read more >
attributeerror: 'namespace' object has no attribute
means that the property is not defined in the args parameter. In this case, you expected to define an argument of the name...
Read more >
221 fedpkg without arguments: AttributeError: 'Namespace' ...
#221 fedpkg without arguments: AttributeError: 'Namespace' object has no attribute 'command' (PY3). Closed: Fixed 4 years ago Opened 4 years ago by churchyard....
Read more >
'Namespace' object has no attribute 'brokeName'
Thread Modes. AttributeError: 'Namespace' object has no attribute 'brokeName' ... Anyway, there is no SantBrk defined in the above code.
Read more >
How to run tests: AttributeError: 'Namespace' object has no ...
How to run tests: AttributeError: 'Namespace' object has no attribute 'arguments' ... Done Test parallel calculation with "gpaw -P 4 test".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found