feat(algorithms)!: unify PyTorch runtime contracts - #95
Draft
jiangxt2 wants to merge 1 commit into
Draft
Conversation
Signed-off-by: jiangxt2 <jiangxt2@vip.qq.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.
Description
This PR replaces Tributo's divergent PyTorch algorithm integration paths with one versioned contract and one Core-owned Ray Train runtime.
TorchRecipecovers Core-owned training loops,RayTorchAdaptercovers framework-owned worker loops, and both execute throughDistributionStrategy.RAY_TRAIN_TORCHand runtime IDtributo.ray_train_torchundertorch_runtime_api_version=1.The previous
TorchTrainingRecipeandTrainingRecipeV2surfaces both reached the same training implementation, while complex PyTorch algorithms bypassed that path by constructing their ownTorchTrainer. The new boundary makesTorchPolicy.execution_planthe single source of truth and assigns Trainer construction, role routing, collective alignment, checkpoint transport, execution evidence, and Bundle publication to Core; algorithm Wheels retain model, loss, metric, framework-adaptation, and artifact-signature responsibilities.Key changes:
TorchPolicy, single-stage and component-stage execution plans, role-routed datasets, typed runtime and stage contexts, and publicTorchRecipeandRayTorchAdapterSPIs.tributo.ray_train_torchruntime with Torch-only preflight, invocation-local one-shot lease transfer, Core-ownedTorchTrainerorchestration, exact split and bounded replication routing, and explicit final-stage selection.ray-torch-recipe-v1withray-torch-v1, split Recipe reconstruction from Adapter export-source handling, and route both through the existingBundleExportService.This is intentionally one atomic implementation change because the public Policy, SPI, Runtime, Checkpoint, Evidence, and Source Provider identities must move together; merging an intermediate subset would leave installed PyTorch descriptors without a valid execution or export path.
Related issues
Additional information
Cross-repository coordination
tributo-algorithms/master.878c49f; existing candidate Wheels predate the final Core commit and are not valid evidence for this PR.Breaking changes and migration
TorchTrainingRecipe,TrainingRecipeV2,AlgorithmBuilder.from_torch_recipe(), andAlgorithmBuilder.from_training_recipe_v2().ray-torch-recipe-v1source-provider identity.TorchRecipe,RayTorchAdapter,AlgorithmBuilder.from_torch(),AlgorithmBuilder.from_torch_adapter(),RAY_TRAIN_TORCH,tributo.ray_train_torch, andray-torch-v1.TorchPolicy, the execution plan, role routing, metric reducers, state layout, and the independent Torch Runtime API version.dnn.recipe_v2,pu.recipe_v2,lstm_classifier.recipe_v2, andgru_classifier.recipe_v2to their algorithm identities and remove the.recipe_v2suffix from the LSTM and GRU implementation IDs.The companion
tributo-algorithmsmigration must be released in coordination with this Core change. Existing PyTorch Wheels implementing the removed interfaces are not compatible with the new runtime.Compatibility boundary
inference/kernel.pychange is a backward-compatible materialization fix for higher-rank nested object-array columns; it does not migrate the public inference request, binding, manifest, or runtime contracts.Local static and changed-test validation is complete; Docker Ray IT, companion Wheel conformance, and external cluster gates remain pending before merge.
Validation completed for commit 878c49f
uv run --locked --no-sync python scripts/pr-precheck.py— passed all mandatory format, dependency, CI-policy, API-stability, suppression, commit, hygiene, changed-test, CI-parity, and documentation layers on the final source tree.uv run --locked --no-sync python scripts/pr-precheck.py --skip-tests— passed after the signed commit was created, confirming the final commit message, DCO trailer, static gates, and documentation gates without repeating the completed changed-test run.git diff --check— passed.inference/kernel.pypredates this diff.Pending validation before merge
distributed-algorithm-clustermanual gate on exact Core revision878c49fand algorithm revision3d7d838to cover multi-worker Ray Jobs training, retry and cross-node recovery, Tune checkpoint behavior, Bundle publication, and Ray Data inference without skipped tests.scripts/ci_test_plan.pyfor thepyproject.toml, runtime, export, inference, and documentation changes, and record each suite as passed or explicitly not required with a concrete scope reason.Earlier development runs are useful diagnostic evidence but are not listed as final validation because the committed recovery and staging paths changed afterward.
Reviewer focus
TorchPolicy.execution_planis the only stage and routing declaration and that neither Recipe nor Adapter can create a nested Trainer or provide a competing execution plan.final_stage_idcan supply the exported Bundle.ray-torch-v1Recipe and Adapter export branches, Artifact Plan binding, required-artifact failure behavior, andcomposition_digestpropagation.Non-goals