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

KeyError when using text features #56

Closed
sk- opened this issue Feb 12, 2019 · 3 comments
Closed

KeyError when using text features #56

sk- opened this issue Feb 12, 2019 · 3 comments
Labels
bug Something isn't working waiting for answer Further information is requested

Comments

@sk-
Copy link

sk- commented Feb 12, 2019

When using text features, the following error is raised:

Traceback (most recent call last):
  File "/Users/user/.virtualenvs/ml/bin/ludwig", line 10, in <module>
    sys.exit(main())
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/cli.py", line 86, in main
    CLI()
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/cli.py", line 64, in __init__
    getattr(self, args.command)()
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/cli.py", line 70, in train
    train.cli(sys.argv[2:])
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/train.py", line 663, in cli
    full_train(**vars(args))
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/train.py", line 224, in full_train
    random_seed=random_seed
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/data/preprocessing.py", line 562, in preprocess_for_training
    [training_set, validation_set, test_set]
  File "/Users/user/.virtualenvs/ml/lib/python3.6/site-packages/ludwig/data/preprocessing.py", line 777, in replace_text_feature_level
    level)
KeyError: 'name_word'

This is due to the following lines https://github.com/uber/ludwig/blob/9de6ee32f0e2e6cc6157f0772aa8c28a8d662fe8/ludwig/data/preprocessing.py#L774-L778 as it removes the columns regarding of whether they exist or not. Conditionally removing the columns fixes the issue and the model trains successfully.

The model definition I'm using is:

input_features:
    -
        name: name
        type: text
        encoder: rnn
        level: char

output_features:
    -
        name: sex
        type: category
@sk- sk- changed the title KeyError when using text features KeyError when using text features Feb 12, 2019
w4nderlust added a commit that referenced this issue Feb 12, 2019
…hen replacing text feature names concatenating their level
@w4nderlust w4nderlust added the bug Something isn't working label Feb 12, 2019
@w4nderlust
Copy link
Collaborator

The latest commit should fix it. Please confirm and I'll close the issue.

@w4nderlust w4nderlust added the waiting for answer Further information is requested label Feb 12, 2019
@sk-
Copy link
Author

sk- commented Feb 12, 2019

Thanks @w4nderlust for the quick fix. I confirm that works.

@w4nderlust
Copy link
Collaborator

You're welcome!

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

No branches or pull requests

2 participants