question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested ingredients not in preset for ConfigScope

See original GitHub issue

Here’s a bare-bones example. From what I read in the docs, both a and b should be available to c.

from sacred import Ingredient, Experiment

i1 = Ingredient('a')
i2 = Ingredient('b', ingredients=[i1])
ex = Experiment('c', ingredients=[i2])

@ex.config
def cfg(a, b):
    print(a, b)

@ex.automain
def main():
    print('asdfasdfasdf')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/anaconda3/lib/python3.7/site-packages/sacred/experiment.py in _create_run(self, command_name, config_updates, named_configs, meta_info, options)
    455                          force=options.get(ForceOption.get_flag(), False),
    456                          log_level=options.get(LoglevelOption.get_flag(),
--> 457                                                None))
    458         run.meta_info['command'] = command_name
    459         run.meta_info['options'] = options

/anaconda3/lib/python3.7/site-packages/sacred/initialize.py in create_run(experiment, command_name, config_updates, named_configs, force, log_level)
    394     for scaffold in scaffolding.values():
    395         scaffold.gather_fallbacks()
--> 396         scaffold.set_up_config()
    397 
    398         # update global config

/anaconda3/lib/python3.7/site-packages/sacred/initialize.py in set_up_config(self)
    106             fixed=self.config_updates,
    107             preset=self.config,
--> 108             fallback=self.fallback)
    109 
    110         self.get_config_modifications()

/anaconda3/lib/python3.7/site-packages/sacred/config/utils.py in chain_evaluate_config_scopes(config_scopes, fixed, preset, fallback)
    104         cfg = config(fixed=fixed,
    105                      preset=final_config,
--> 106                      fallback=fallback)
    107         config_summaries.append(cfg)
    108         final_config.update(cfg)

/anaconda3/lib/python3.7/site-packages/sacred/config/config_scope.py in __call__(self, fixed, preset, fallback)
     67                 raise KeyError("'{}' not in preset for ConfigScope. "
     68                                "Available options are: {}"
---> 69                                .format(arg, available_entries))
     70             if arg in preset:
     71                 cfg_locals[arg] = preset[arg]

KeyError: "'a' not in preset for ConfigScope. Available options are: {'b', '_log'}"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
beasteerscommented, Sep 6, 2019

Ah understood. The nested ingredient docs are wrong then. They explicitly explain nested ingredients getting flattened so that should probably be changed at some point.

Nesting Ingredients

It is possible to use Ingredients in other Ingredients

data_ingredient = Ingredient('dataset', ingredients=[my_subingredient])

In the configuration of the Experiment there will be all the used Ingredients and sub-Ingredients.

0reactions
stale[bot]commented, Dec 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

named_config: Variable "not in preset for ConfigScope ...
The arguments of a named config can only refer to updates passed from the commandline. So calling the first version with ex.run(named_configs=[' ...
Read more >
Ingredients — Sacred 0.8.3 documentation
Ingredients are a way of defining a configuration with associated ... will see two entries: dataset and paths ( paths is not nested...
Read more >
Filtering in angular table is working with only current page
The requirement is to filter the entire data set not only the current page. ... activeConfigView=view; break; case'config': $scope.
Read more >
See raw diff - Hugging Face
Assumes weights of 1 if not provided. - collapse: boolean, optional (default=False) - If True, collapses survival table into lifetable to show events...
Read more >
Magento 1.4 Themes Design
Chapter 5, Non-default Magento Themes, covers the building blocks of ... If the handle is not <default>, the updates in the nested XML...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found