Skip to content

Failed to run minimal code example #117

Closed
@iCSawyer

Description

@iCSawyer

I tried to run the minimal code example with this configuration file but failed. It reported this error:

Traceback (most recent call last):
  File "code2seq_example.py", line 34, in <module>
    train(__config)
  File "code2seq_example.py", line 24, in train
    trainer = Trainer(max_epochs=config.hyper_parameters.n_epochs)
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 354, in __getattr__
    key=key, value=None, cause=e, type_override=ConfigAttributeError
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/base.py", line 196, in _format_and_raise
    type_override=type_override,
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/_utils.py", line 821, in format_and_raise
    _raise(ex, cause)
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/_utils.py", line 719, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set end OC_CAUSE=1 for full backtrace
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 351, in __getattr__
    return self._get_impl(key=key, default_value=_DEFAULT_MARKER_)
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 438, in _get_impl
    node = self._get_node(key=key, throw_on_missing_key=True)
  File "/home/junkaichen/miniconda3/envs/d2l/lib/python3.7/site-packages/omegaconf/dictconfig.py", line 470, in _get_node
    raise ConfigKeyError(f"Missing key {key}")
omegaconf.errors.ConfigAttributeError: Missing key hyper_parameters
    full_key: hyper_parameters
    object_type=dict

What I did:

  1. Copy the code example to a .py file and this configutation file to a .yaml file
  2. Download the data from the url https://s3.eu-west-1.amazonaws.com/datasets.ml.labs.aws.intellij.net/java-paths-methods/java-small.tar.gz in the configuration file and compress it.
  3. Change the first line of the .yaml file (data_folder) to the location of data.
  4. Run this script python xxx.py xxx.yaml

I noticed that this error was related to "yaml" but I don't know where exactly the problem lies. I want to run a demo of code2seq model by this library. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions