Add Tinker API server for supervised fine-tuning with SkyRL backend #986
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
This PR adds the Tinker HTTP API server that enables external training orchestration using the SkyRL-Train backend. This allows tools like
tinker-cookbookto run supervised fine-tuning (SFT) by making HTTP calls to control training, rather than embedding training logic directly.Key capabilities:
forward_backward()andoptim_step()operationsChanges
New directories:
skyrl_train/tinker/- Tinker API server and engineapi.py- FastAPI server with training endpointsengine.py- Background process handling training requestsbackends/skyrl_train.py- SkyRL backend implementationtypes.py- Type definitions for API contractsloss_fns.py- Loss function implementations (JAX made optional)skyrl_train/tx_utils/- Shared utilitiesgenerator.py,log.py,models.py, etc.Key modifications:
tx.*toskyrl_train.*skyrl_train.tinker.engineArchitecture
Usage
Start the Tinker API server:
Run supervised fine-tuning from tinker-cookbook:
Test Results
Successfully tested with
sl_loop.pyfrom tinker-cookbook:Background
This integration was needed to enable external training orchestration for SFT workloads. The original Tinker code lived in
skyrl-txbut required Flash Attention which had environment issues. Copying intoskyrl-trainallows it to use the working Flash Attention installation and existing SkyRL infrastructure.Next Steps
🤖 Generated with Claude Code