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

CMA optimizer error: InjectionWarning: orphanated injected solution #1609

Open
andrewjgray1001 opened this issue May 22, 2024 · 0 comments
Open

Comments

@andrewjgray1001
Copy link

Steps to reproduce

  1. create instance of ng.optimizers.CMA
  2. call minimize with a lot of workers

note:
this is using a pre-existing utility called Model_Evaluator which parallelizes requests across multiple processes/machines, it has been used extensively in optimizations and has never given any problems. In this example it is set to work with 40 processes. The threadPoolExecutor is just a device to forward multiple calls to the evaluator.

The error implies that if there is too high a degree of parallelization, the logic inside minimize fails, because the function requests (ask) somehow get out of sync with the results returned (tell). The same error occurs whether batch mode is True or False.

Observed Results

the optimizer runs for a while, probably running several hundred evaluations, then produces regular errors like:

evolution_strategy.py:2981: InjectionWarning: orphanated injected solution

then fails with error:

RuntimeError: Mean shift samples are expected but missing.
This happens if, for example, ask is called more than once, without calling tell
(because the first call removes the samples from the injection list).
cma.sigma_adaptation.CMAAdaptSigmaTPA step-size adaptation generates mean shift
samples and relies on them.

Expected Results

The optimizer should work

Relevant Code

 # Set up the optimizer
optimizer = ng.optimizers.CMA(parametrization=num_weights, budget=1000000, num_workers=num_workers)

model_eval = Model_Evaluator(config)

with futures.ThreadPoolExecutor(max_workers=optimizer.num_workers) as executor:
    recommendation = optimizer.minimize(model_eval.f_eval, executor=executor, batch_mode=True)

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

1 participant