Switched to multi-threading, added export - #1569
Open
alexunderch wants to merge 4 commits into
Open
Conversation
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.
Dear @lanctot,
With python3.14 approaching, there is some room to upgrade with AZ. Python 3.14 changed the default start method on POSIX from
forktoforkserverwhich is not the same on Linux, for example. This would require a lot of monkey patching or there is a risk of the race condition with the import ofspawn.py. That's why I decided to propose to switch to multi-threading instead with Python 3.13+.Current implementation has N actors and M evaluators. Each actor/evaluator is a separate spawned process with its own JAX runtime. This means:
The learner saves to disk, then broadcasts the path string. Every actor then can probably retrigger a lot of computations: recompile, for example. Also, it cause disk I/O + deserialisation bottlenecks. To alleviate the issue, I did a single-node adjustments (because we have an ed implementation after all). There is single learner thread that takes all the computation and two queues of actors and evaluators, with shared model state to avoid I/O. and instantiate the model once (see README).
What do you think about this?
Additionally, I modified the export_model part, and it should allow to export the model to onyx/jit for web or on-device demoes. At least it now has some purpose.
Looking forward to reading your thoughts.