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 running example configs #570

Closed
theo-brown opened this issue Nov 26, 2024 · 7 comments
Closed

KeyError when running example configs #570

theo-brown opened this issue Nov 26, 2024 · 7 comments

Comments

@theo-brown
Copy link
Collaborator

Problem

I'm not able to run any of the examples in torax.examples from the current commit (2b47010).

To replicate

Newly cloned repo, Python 3.12, installed with pip install -e .[dev].

Running python run_simulation_main.py --config=torax.examples.basic_config raises the following error

I1126 18:38:05.371396 23356775410688 plasma_composition.py:78] 
          Config input Zeff not directly defined at rhonorm=1.0.
          Zeff_face at rhonorm=1.0 set from constant values or constant extrapolation.
          
Traceback (most recent call last):
  File "/.../torax/run_simulation_main.py", line 660, in <module>
    app.run(main)
  File "/.../python3.12/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/.../python3.12/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/.../torax/run_simulation_main.py", line 488, in main
    config_loader.build_sim_and_runtime_params_from_config_module(
  File "/.../torax/torax/config/config_loader.py", line 51, in build_sim_and_runtime_params_from_config_module
    sim = build_sim.build_sim_from_config(config)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../torax/config/build_sim.py", line 257, in build_sim_from_config
    'set_pedestal' in config['runtime_params']['profile_conditions']
                      ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'profile_conditions'

Running python run_simulation_main.py --config=torax.examples.iterhybrid_rampup or python run_simulation_main.py --config=torax.examples.iterhybrid_predictor_corrector raises:

Traceback (most recent call last):
  File "/.../torax/run_simulation_main.py", line 660, in <module>
    app.run(main)
  File ".../python3.12/site-packages/absl/app.py", line 308, in run
    _run_main(main, args)
  File "/.../python3.12/site-packages/absl/app.py", line 254, in _run_main
    sys.exit(main(argv))
             ^^^^^^^^^^
  File "/.../torax/run_simulation_main.py", line 488, in main
    config_loader.build_sim_and_runtime_params_from_config_module(
  File "/.../torax/torax/config/config_loader.py", line 48, in build_sim_and_runtime_params_from_config_module
    new_runtime_params = build_sim.build_runtime_params_from_config(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../tab53/torax/torax/config/build_sim.py", line 312, in build_runtime_params_from_config
    return config_args.recursive_replace(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../torax/torax/config/config_args.py", line 389, in recursive_replace
    flattened_changes[key] = recursive_replace(
                             ^^^^^^^^^^^^^^^^^^
  File "/.../tab53/torax/torax/config/config_args.py", line 428, in recursive_replace
    issubclass(keys_to_types[key], enum.Enum)
               ~~~~~~~~~~~~~^^^^^
KeyError: 'Tiped'
@theo-brown
Copy link
Collaborator Author

@Nush395 I believe this bug was introduced in 1f8669e, as I'm able to run these commands on e506f63 with no issue.

@Nush395
Copy link
Collaborator

Nush395 commented Nov 26, 2024

Hey @theo-brown, thanks for raising the issue and identifying the offending commit. You're indeed right that the example configs were broken by one of my recent changes. @jcitrin is putting out a fix.

Sorry for the trouble!

@theo-brown
Copy link
Collaborator Author

No trouble at all! Exciting to see the development that's gone on. No pressure to fix urgently, I can work from e506f63 and then fast-forward later.

@theo-brown
Copy link
Collaborator Author

It might be worth adding a unit test to check that the example configs all run? I can do that if it would be helpful.

@Nush395
Copy link
Collaborator

Nush395 commented Nov 26, 2024

It might be worth adding a unit test to check that the example configs all run? I can do that if it would be helpful.

Yes, great idea. We will be doing that :)

@jcitrin
Copy link
Collaborator

jcitrin commented Nov 26, 2024

#571 . Thanks for raising!

@theo-brown
Copy link
Collaborator Author

Thanks for fixing!

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

3 participants