fix: repair broken internal imports, CPU training, and config packaging (OpenAdapt#999)#63
Merged
Merged
Conversation
Fixes the openadapt-ml side of OpenAdaptAI/OpenAdapt#999: - Add missing update_current_symlink_to_latest() to training/trainer.py; cmd_serve imported it but it never existed, so `openadapt serve` failed with a misleading "openadapt-ml not installed" error (bug 2) - scripts/train.py: capture_to_episode(goal=) -> instruction=, matching the actual signature (bug 3) - scripts/demo_policy.py: import generate_synthetic_episodes instead of the non-existent generate_synthetic_sessions (bug 4) - Ship configs/ inside the wheel (hatch force-include) and add resolve_config_path() so installed packages find bundled configs instead of failing on repo-relative paths (bug 5) - training/trl_trainer.py: pass use_cpu/bf16/fp16 to SFTConfig based on CUDA availability so CPU-only training no longer raises ValueError (bug 7) Verified: py_compile on all changed files, isolated functional test of the symlink helper, and wheel build confirming configs are included. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- use_cpu now stays False on Apple Silicon (MPS) so the previous accelerated path isn't regressed; only true CPU-only setups get use_cpu=True - update_current_symlink_to_latest prefers directories containing training_log.json or dashboard.html so a stray top-level "checkpoints" directory from the old flat layout can't win Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These two files fail 'ruff format --check' on main as well; formatting them here so the test matrix can actually run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
abrichr
added a commit
to OpenAdaptAI/OpenAdapt
that referenced
this pull request
Jun 12, 2026
…ds (#1001) * fix: repair broken openadapt-ml imports in serve and train CLI commands Fixes #999 (bug 1 and the train_start equivalent): - `openadapt serve` imported non-existent `serve_dashboard` from openadapt_ml.cloud.local; the actual entry point is `cmd_serve`, which takes an argparse Namespace. Build the Namespace and open the browser from the CLI side (cmd_serve has no open option). - `openadapt train start` imported non-existent `train_main` from openadapt_ml.scripts.train and called it with kwargs that don't exist; the actual entry point is `main(config_path, capture_path, output_dir, open_dashboard, ...)`. Select a device-appropriate default config when none is given (resolved against packaged configs when available). - except ImportError blocks now print the underlying error and point at pip install "openadapt-ml[training]" instead of masking internal import failures as "openadapt-ml not installed" (the misleading error that prompted the issue). Companion to OpenAdaptAI/openadapt-ml#63. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: honor --output in serve, clear error for unresolvable configs - serve now points openadapt_ml.cloud.local.TRAINING_OUTPUT at the requested --output directory instead of silently ignoring the flag - train start exits with a clear message when the config path can't be resolved (older openadapt-ml without bundled configs), instead of a FileNotFoundError traceback Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * style: ruff format cli.py Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Fixes the
openadapt-mlside of OpenAdaptAI/OpenAdapt#999 (reported by @ultimus247), where several CLI commands failed with misleading "openadapt-ml not installed" errors caused by broken internal imports.cmd_serveimports non-existentupdate_current_symlink_to_latesttraining/trainer.py: scans job dirs, atomically pointscurrentat the most recent (same temp-link + rename pattern assetup_job_directory).regenerate_local_dashboardalready exists on main.scripts/train.pycallscapture_to_episode(capture_path, goal=goal)instruction=goal, matching the actual signaturescripts/demo_policy.pyimports non-existentgenerate_synthetic_sessionsgenerate_synthetic_episodes(returnsList[Episode]directly; removed the session flattening)configs/missing from the pip package; repo-relative paths fail when installedconfigs/via hatchforce-include, and newresolve_config_path()incloud/local.pyfalls back to the packaged copies.cmd_trainuses it.ValueError: Your setup doesn't support bf16/gpuSFTConfignow setsuse_cpu/bf16/fp16based ontorch.cuda.is_available()(Unsloth branch untouched — Unsloth requires GPU)Bugs 1 (in
OpenAdapt'scli.py), 6 (training extras — largely addressed on main already), and 8 (Qwen/Qwen2.5-VL-2B-Instruct— configs now referenceQwen/Qwen3-VL-2B-Instruct, which exists) are handled separately; a companion PR fixes theOpenAdaptCLI.Verification
python -m py_compileon all changed filesupdate_current_symlink_to_latest: empty base →None, picks latest by mtime, creates/repoints the symlink atomically, idempotent re-run, nonexistent base →Nonepyproject-build --wheelthen inspected the wheel: 10 files now present underopenadapt_ml/configs/🤖 Generated with Claude Code