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: 'str' object has no attribute 'get' #261

Closed
renatochacon opened this issue Mar 31, 2019 · 10 comments
Closed

AttributeError: 'str' object has no attribute 'get' #261

renatochacon opened this issue Mar 31, 2019 · 10 comments
Labels
waiting for answer Further information is requested

Comments

@renatochacon
Copy link

renatochacon commented Mar 31, 2019

Hello. I was able to use 'ludwig experiment' on the titanic's datasets on kaggle, just as described here https://uber.github.io/ludwig/examples/ using the suggested yaml file.

I also tried to use it to train a dataset, but got this on terminal:

$ ludwig train --data_csv train.csv --model_definition modelo.yaml


| |_ _ | | __ ()_ _
| | || / \ V V / / _ |
|
|_,_,|_/_/|_, |
|
__/
ludwig v0.1.0 - Train

Traceback (most recent call last):
File "/home/renatochacon/ludwig/venv/bin/ludwig", line 11, in
load_entry_point('ludwig==0.1.0', 'console_scripts', 'ludwig')()
File "/home/renatochacon/ludwig/venv/lib/python3.5/site-packages/ludwig-0.1.0-py3.5.egg/ludwig/cli.py", line 86, in main
File "/home/renatochacon/ludwig/venv/lib/python3.5/site-packages/ludwig-0.1.0-py3.5.egg/ludwig/cli.py", line 64, in init
File "/home/renatochacon/ludwig/venv/lib/python3.5/site-packages/ludwig-0.1.0-py3.5.egg/ludwig/cli.py", line 70, in train
File "/home/renatochacon/ludwig/venv/lib/python3.5/site-packages/ludwig-0.1.0-py3.5.egg/ludwig/train.py", line 729, in cli
File "/home/renatochacon/ludwig/venv/lib/python3.5/site-packages/ludwig-0.1.0-py3.5.egg/ludwig/train.py", line 170, in full_train
File "/home/renatochacon/ludwig/venv/lib/python3.5/site-packages/ludwig-0.1.0-py3.5.egg/ludwig/utils/defaults.py", line 137, in merge_with_defaults
AttributeError: 'str' object has no attribute 'get'

@renatochacon renatochacon changed the title I'm using titanic's datasets from kaggle, the same ones from here https://uber.github.io/ludwig/examples/. I'm using titanic's datasets from kaggle, the same ones from here https://uber.github.io/ludwig/examples/ Mar 31, 2019
@renatochacon renatochacon changed the title I'm using titanic's datasets from kaggle, the same ones from here https://uber.github.io/ludwig/examples/ AttributeError: 'str' object has no attribute 'get' Mar 31, 2019
@w4nderlust
Copy link
Collaborator

Please use the latest code from master and try again.
Uninstall Ludwig, then:
pip install http://github.com/uber/ludwig/zipball/master

@w4nderlust w4nderlust added the waiting for answer Further information is requested label Mar 31, 2019
@renatochacon
Copy link
Author

Thank you. I'd like to know one more thing, please:

I was able to work on the train.csv which contais all columns, including features (input variables) and target (output variable). But how do I use ludwig to predict on datasets like the one from test.csv which doesn't contain the target column 'Survived'?

@w4nderlust
Copy link
Collaborator

Read the docs, in the predict section of the user guide. There's a parameter --only_predict.

@vreyespue
Copy link
Contributor

vreyespue commented Jun 22, 2021

@w4nderlust I think in the last version of ludwig (0.4) this is happening again.
I get as well the mentioned error message, i.e.

$ python3 simple_model_training.py
Traceback (most recent call last):
  File "simple_model_training.py", line 25, in <module>
    logging_level=logging.INFO)
  File "lib/python3.7/site-packages/ludwig/api.py", line 193, in __init__
    self.backend = initialize_backend(backend or config.get('backend'))
AttributeError: 'str' object has no attribute 'get'

Could you maybe double check?
If so, should we reopen this issue, or create a new one?
Many thanks and best regards.

@w4nderlust
Copy link
Collaborator

@vreyespue it's a different error.
Can you please open a separate issue about it with instructions on how to reproduce it?
I run the simple_model_training.py in the examples/titanic, which I believe is what you were running, and it works fine.

@vreyespue
Copy link
Contributor

vreyespue commented Jun 23, 2021

Hi @w4nderlust I got this issue both in macos and linux, simply by doing a pip install ludwig and executing simple_model_training.py in the examples/titanic folder. Actually I think it is because here we call the api with config as str (i.e. file path), and in the api we try to get the backend from the string, which results in an error. I opened the PR #1213 to resolve the issue. Using the previously validated self.config works for me perfectly, and should work as well in all setups. Many thanks and best regards.

@w4nderlust
Copy link
Collaborator

The PR #1213 was merged.

@Judy-Bloom
Copy link

@w4nderlust Hi Pierre, I'm getting the same issue as vreyespue. Config file in same directory as python file. Replacing the config YAML with a python dictionary and works as expected. Any thoughts?
Error: AttributeError: 'str' object has no attribute 'get'

@w4nderlust
Copy link
Collaborator

@Judy-Bloom the issue has been solved but we haven't released a new version yet. You can install Ludwig by cloning the tf-legacy branch in the meantime. We are going to release a v0.4.1 this week anyway ;)

@Judy-Bloom
Copy link

Judy-Bloom commented Jan 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for answer Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants