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.

PBT update config in custom explore function

See original GitHub issue

I am new to ray and tune. I want to use PBT with a dynamic config. For example,

def explore(config):
    # here config['varA'] = None not something as in TrainMNIST._setup
    return config

class TrainMNIST(Trainable):
    def _setup(self, config):
        config['varA'] = something
        self.config.update(config)

pbt = PopulationBasedTraining(
        ...,        
        custom_explore_fn=explore)

tune.run(
        TrainMNIST,
        name="exp",
        scheduler=pbt,
        stop={
            "test_acc": 0.99,
            "training_iteration": 100,
        },
        resources_per_trial={
            "cpu": 2,
            "gpu": 0.25,
        },
        **{"config":
            { "args": vars(args),
              "varA": None,
              }
        }

How can I explore with config[‘varA’] = something?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
heurainbowcommented, Jun 29, 2019

I found a way to work aound this by adding trial.config.update(result[‘config’]) in on_trial_result. I use this to make the explore function adapt to each model’s performance. Say, for better performance I use small step for hyperparams.

Still, I think synchronize config is essential for robustness.

    def on_trial_result(self, trial_runner, trial, result):
        trial.config.update(result['config'])
        ...
0reactions
heurainbowcommented, Jun 29, 2019

update config when getting results

Read more comments on GitHub >

github_iconTop Results From Across the Web

ray/pbt.py at master · ray-project/ray - GitHub
config, used to filter the config. class PopulationBasedTraining(FIFOScheduler): """Implements the Population Based Training (PBT) algorithm. outperforming the ...
Read more >
ray.tune.schedulers.pbt — Ray 2.2.0 - the Ray documentation
Source code for ray.tune.schedulers.pbt ... hyperparameter. custom_explore_fn: Custom explore function applied after built-in config perturbations.
Read more >
Population-based Training Method
Population-based training (PBT) is loosely based on genetic algorithms; see the original paper or blog post for details. The motivation is that it...
Read more >
Details and advanced features - Hypothesis! - Read the Docs
Custom function execution​​ Hypothesis provides you with a hook that lets you control how it runs examples. This lets you do things like...
Read more >
How to Configure your CTRL Keyboard! - Drop
Create your keyboard configuration and compile it into a firmware file. ... you can customize its behavior by selecting another key or function...
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