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

data_file KeyError #11

Open
fonnesbeck opened this issue Jun 11, 2021 · 1 comment
Open

data_file KeyError #11

fonnesbeck opened this issue Jun 11, 2021 · 1 comment

Comments

@fonnesbeck
Copy link

fonnesbeck commented Jun 11, 2021

Attempting to run any of the models using the approach in the test script results in a KeyError. For example,

models = pyro_models.load()
model_dict = models['arm.radon_intercept']
model = model_dict['model']
data = pyro_models.data(model_dict)

Results in:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Untitled-1 in 
      5 model_dict = models['arm.radon_intercept']
      6 model = model_dict['model']
----> 7 data = pyro_models.data(model_dict)
      8 # guide = AutoDelta(model)

~/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/Pyro_Models-0.0.0-py3.7.egg/pyro_models/utils.py in data(model)
     49 
     50 def data(model):
---> 51     data = json_file_to_mem_format(model['data_file'])
     52     foo = model['module']
     53 

KeyError: 'data_file'

Looking at the model_dict, there is indeed no 'data_file' key:

model_dict
{'dataset': 'arm',
 'source_file': '/home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/Pyro_Models-0.0.0-py3.7.egg/pyro_models/arm/radon_intercept.py',
 'name': 'radon_intercept',
 'module': <module 'model.radon_intercept' from '/home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/Pyro_Models-0.0.0-py3.7.egg/pyro_models/arm/radon_intercept.py'>,
 'model': functools.partial(<function load.<locals>.model_wrapped at 0x7f7c1fcf8830>, <module 'model.radon_intercept' from '/home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/Pyro_Models-0.0.0-py3.7.egg/pyro_models/arm/radon_intercept.py'>)}
@fonnesbeck
Copy link
Author

Confirming that even when the test suite is run from the command line, the same error is triggered:

❯ python test_models.py 
Traceback (most recent call last):
  File "/Users/cfonnesbeck/GitHub/pyro-models/tests/test_models.py", line 57, in <module>
    main(args)
  File "/Users/cfonnesbeck/GitHub/pyro-models/tests/test_models.py", line 39, in main
    data = pyro_models.data(model_dict)
  File "/Users/cfonnesbeck/miniforge3/envs/pyro/lib/python3.9/site-packages/Pyro_Models-0.0.0-py3.9.egg/pyro_models/utils.py", line 51, in data
    data = json_file_to_mem_format(model['data_file'])
KeyError: 'data_file'

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