Skip to content

fix: import load_from_optimizer lazily to break a spawn-time cycle - #368

Merged
luciaquirke merged 1 commit into
mainfrom
fix/trainer-import-cycle
Jul 29, 2026
Merged

fix: import load_from_optimizer lazily to break a spawn-time cycle#368
luciaquirke merged 1 commit into
mainfrom
fix/trainer-import-cycle

Conversation

@luciaquirke

Copy link
Copy Markdown
Collaborator

No description provided.

Importing it at module scope pulls in bergson.gradients, which re-enters the
package __init__ and reaches magic.cli -> validate -> magic.trainer. In-process
that resolves, but a spawned worker unpickling through magic.cli hits
magic.trainer half-initialized and fails on TrainerState, taking out
test_grad_accum_matches_full_batch.
@luciaquirke
luciaquirke merged commit f824782 into main Jul 29, 2026
1 check was pending
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

Successfully merging this pull request may close these issues.

1 participant