fix: auto-fix deprecated AdamW import and handle BrokenProcessPool#87
Open
YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
Open
fix: auto-fix deprecated AdamW import and handle BrokenProcessPool#87YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
Conversation
Three related fixes for BFTS experiment execution reliability: 1. Add _sanitize_imports() that auto-replaces deprecated 'from transformers import AdamW' with 'from torch.optim import AdamW' in LLM-generated code before execution. Handles both standalone and mixed import forms. (transformers >= 4.30 removed AdamW) 2. Wrap exceptions in _process_node_wrapper() as RuntimeError before re-raising, because openai.APIStatusError and similar exceptions are not picklable, which causes BrokenProcessPool in the parent process. 3. In step(), catch BrokenProcessPool errors gracefully and recreate the executor instead of crashing the entire experiment. The journal records fewer nodes but the stage completion checks handle retry logic. 4. Add CRITICAL LIBRARY IMPORT GUIDELINES to _prompt_impl_guideline to steer LLM code generation away from deprecated imports. 5. Relax code extraction: accept completion even when nl_text is empty (return a default string), preventing unnecessary retries when the model produces valid code without a natural-language preamble. Root cause chain: LLM generates 'from transformers import AdamW' -> ImportError -> no .npy output -> metric=None -> Metric?(nan) -> infinite retry loop in BFTS stage 12.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM-generated experiment code frequently uses
from torch.optim import AdamWwhich triggers deprecation warnings (and errors in future PyTorch versions). This adds:_sanitize_imports()to auto-replace deprecated import patterns before executionRuntimeErrorwrapping for unpicklable exceptions in multiprocessing workersBrokenProcessPoolErrorrecovery with automatic pool restart