triotune 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. triotune-0.1.1/MANIFEST.in +3 -0
  2. triotune-0.1.1/PKG-INFO +213 -0
  3. triotune-0.1.1/README.md +196 -0
  4. triotune-0.1.1/pyproject.toml +45 -0
  5. triotune-0.1.1/setup.cfg +4 -0
  6. triotune-0.1.1/triotune/__init__.py +26 -0
  7. triotune-0.1.1/triotune/api/__init__.py +55 -0
  8. triotune-0.1.1/triotune/api/cli_args.py +1061 -0
  9. triotune-0.1.1/triotune/api/client_api.py +215 -0
  10. triotune-0.1.1/triotune/api/loss_api.py +743 -0
  11. triotune-0.1.1/triotune/dataset/__init__.py +44 -0
  12. triotune-0.1.1/triotune/dataset/examples.py +181 -0
  13. triotune-0.1.1/triotune/dataset/load.py +65 -0
  14. triotune-0.1.1/triotune/dataset/prepare.py +451 -0
  15. triotune-0.1.1/triotune/dataset/prompt.py +243 -0
  16. triotune-0.1.1/triotune/dataset/swe_sft/__init__.py +18 -0
  17. triotune-0.1.1/triotune/dataset/swe_sft/prepare.py +202 -0
  18. triotune-0.1.1/triotune/dataset/swe_sft/schema.py +187 -0
  19. triotune-0.1.1/triotune/dataset/swe_sft/trajectory.py +503 -0
  20. triotune-0.1.1/triotune/trainer/__init__.py +180 -0
  21. triotune-0.1.1/triotune/trainer/dpo/__init__.py +7 -0
  22. triotune-0.1.1/triotune/trainer/dpo/loss.py +90 -0
  23. triotune-0.1.1/triotune/trainer/dpo/state.py +22 -0
  24. triotune-0.1.1/triotune/trainer/dpo_trainer.py +755 -0
  25. triotune-0.1.1/triotune/trainer/opd/__init__.py +77 -0
  26. triotune-0.1.1/triotune/trainer/opd/contracts.py +287 -0
  27. triotune-0.1.1/triotune/trainer/opd/datum.py +65 -0
  28. triotune-0.1.1/triotune/trainer/opd/execution.py +219 -0
  29. triotune-0.1.1/triotune/trainer/opd/loss.py +144 -0
  30. triotune-0.1.1/triotune/trainer/opd/metrics.py +180 -0
  31. triotune-0.1.1/triotune/trainer/opd/rollout.py +128 -0
  32. triotune-0.1.1/triotune/trainer/opd/targets.py +64 -0
  33. triotune-0.1.1/triotune/trainer/opd/teacher_phase.py +98 -0
  34. triotune-0.1.1/triotune/trainer/opd_trainer.py +590 -0
  35. triotune-0.1.1/triotune/trainer/ppo/__init__.py +77 -0
  36. triotune-0.1.1/triotune/trainer/ppo/actor.py +155 -0
  37. triotune-0.1.1/triotune/trainer/ppo/advantages.py +184 -0
  38. triotune-0.1.1/triotune/trainer/ppo/contracts.py +116 -0
  39. triotune-0.1.1/triotune/trainer/ppo/critic.py +315 -0
  40. triotune-0.1.1/triotune/trainer/ppo/datum.py +99 -0
  41. triotune-0.1.1/triotune/trainer/ppo/gae.py +192 -0
  42. triotune-0.1.1/triotune/trainer/ppo/loss.py +159 -0
  43. triotune-0.1.1/triotune/trainer/ppo/rollout.py +146 -0
  44. triotune-0.1.1/triotune/trainer/rl_trainer.py +423 -0
  45. triotune-0.1.1/triotune/trainer/sft/__init__.py +7 -0
  46. triotune-0.1.1/triotune/trainer/sft/state.py +12 -0
  47. triotune-0.1.1/triotune/trainer/sft_trainer.py +343 -0
  48. triotune-0.1.1/triotune/utils/__init__.py +55 -0
  49. triotune-0.1.1/triotune/utils/checkpoint.py +32 -0
  50. triotune-0.1.1/triotune/utils/config.py +78 -0
  51. triotune-0.1.1/triotune/utils/dataloader.py +59 -0
  52. triotune-0.1.1/triotune/utils/datums.py +174 -0
  53. triotune-0.1.1/triotune/utils/metrics.py +211 -0
  54. triotune-0.1.1/triotune/utils/reporting.py +145 -0
  55. triotune-0.1.1/triotune/utils/scoring.py +236 -0
  56. triotune-0.1.1/triotune/utils/updates.py +120 -0
  57. triotune-0.1.1/triotune.egg-info/PKG-INFO +213 -0
  58. triotune-0.1.1/triotune.egg-info/SOURCES.txt +59 -0
  59. triotune-0.1.1/triotune.egg-info/dependency_links.txt +1 -0
  60. triotune-0.1.1/triotune.egg-info/requires.txt +12 -0
  61. triotune-0.1.1/triotune.egg-info/top_level.txt +1 -0
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ prune docs
3
+ prune tests
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: triotune
3
+ Version: 0.1.1
4
+ Summary: PyTRIO-native training utilities and recipes
5
+ Requires-Python: <3.13,>=3.12
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: datasets==5.0.1
8
+ Requires-Dist: numpy==2.5.3
9
+ Requires-Dist: pytrio==0.2.9
10
+ Requires-Dist: pyyaml==6.0.3
11
+ Requires-Dist: swanlab==0.10.1
12
+ Requires-Dist: tqdm==4.70.1
13
+ Provides-Extra: dpo
14
+ Requires-Dist: torch>=2.3; extra == "dpo"
15
+ Provides-Extra: ppo
16
+ Requires-Dist: torch>=2.3; extra == "ppo"
17
+
18
+ # Triotune
19
+
20
+ **PyTRIO-native training recipes and trainer building blocks.**
21
+
22
+ Triotune is a small, text-only training cookbook built on the public PyTRIO
23
+ client API. The name combines **Trio**, from PyTRIO, with **tune**, inspired by
24
+ Torchtune. It keeps model execution, tokenization, sampling, and optimization
25
+ in PyTRIO, while providing the client-side data preparation, reward and
26
+ advantage calculation, token alignment, and training-loop orchestration.
27
+
28
+ <p align="center">
29
+ <a href="README_CN.md">δΈ­ζ–‡ζ–‡ζ‘£</a>
30
+ </p>
31
+
32
+ > **Project status:** Triotune is an early-stage cookbook. It currently offers
33
+ > built-in text-training workflows and examples; a general API for registering
34
+ > arbitrary custom model modules is not yet part of the project.
35
+
36
+ ## πŸ—‚οΈ Contents
37
+
38
+ - [Introduction](#introduction)
39
+ - [News](#news)
40
+ - [Installation](#installation)
41
+ - [Quick start](#quick-start)
42
+ - [Algorithms](#algorithms)
43
+ - [Data contracts](#data-contracts)
44
+ - [Python API](#python-api)
45
+ - [Documentation](#documentation)
46
+ - [Repository layout](#repository-layout)
47
+ - [Current scope](#current-scope)
48
+
49
+ ## πŸ‘‹ Introduction
50
+
51
+ Triotune provides a trainer-shaped interface for a few PyTRIO-backed training
52
+ algorithms. The package is intentionally client-side: PyTRIO remains
53
+ responsible for model weights, LoRA training clients, tokenizers, sampling,
54
+ forward/backward execution, optimizer steps, and checkpoint storage.
55
+
56
+ The current trainers are:
57
+
58
+ - **PPO**: one asynchronous trainer for PPO, GRPO, RLOO, GSPO, SAPO,
59
+ CISPO, DAPO, and related presets.
60
+ - **DPO**: chosen/rejected preference pairs, optional reference-policy scoring,
61
+ and a local pairwise loss submitted through PyTRIO.
62
+ - **SFT**: text-only supervised fine-tuning with prompt/completion masking and
63
+ an asynchronous training path.
64
+ - **OPD**: on-policy distillation in which a student samples completions and a
65
+ fixed teacher supplies token-level scores.
66
+
67
+ PPO, DPO, and OPD include asynchronous training paths where
68
+ the underlying PyTRIO client supports them. Shared utilities handle text,
69
+ token-ID, and chat-message inputs, checkpoint naming, and SwanLab metrics.
70
+
71
+ ## πŸ“° News
72
+
73
+ - **2026-10-12:** Triotune 0.1.0 (`pytrio-cookbook`) was published to [PyPI](https://pypi.org/project/pytrio-cookbook/).
74
+
75
+ ## πŸ“¦ Installation
76
+
77
+ ### βœ… Requirements
78
+
79
+ - Python 3.12 (the package currently declares `>=3.12,<3.13`)
80
+ - Access to a PyTRIO-compatible training service and the models used by your
81
+ recipe
82
+
83
+ Using [uv](https://docs.astral.sh/uv/) is recommended because `uv.lock` pins
84
+ the repository environment:
85
+
86
+ ```bash
87
+ uv sync
88
+ uv run python -c "import trio_cookbook; print(trio_cookbook.__name__)"
89
+ ```
90
+
91
+ Install the optional PyTorch dependency when using DPO:
92
+
93
+ ```bash
94
+ uv sync --extra dpo
95
+ ```
96
+
97
+ The published package can also be installed directly:
98
+
99
+ ```bash
100
+ pip install triotune==0.1.1
101
+ ```
102
+
103
+ For a source checkout with pip:
104
+
105
+ ```bash
106
+ pip install -r requirements.txt
107
+ pip install -e .
108
+ ```
109
+
110
+ The distribution name is `triotune`; the Python import name remains
111
+ `trio_cookbook`.
112
+
113
+ ## πŸš€ Quick start
114
+
115
+ The GSM8K recipe prepares a JSONL dataset and then runs the PPO trainer with
116
+ its GRPO preset. The preparation command does not create a PyTRIO client, so it is a
117
+ safe first check for the local environment:
118
+
119
+ ```bash
120
+ # From the repository root
121
+ bash triotune/scripts/train_grpo_gms8k.sh --prepare-only
122
+
123
+ # Start training with the default YAML configuration
124
+ bash triotune/scripts/train_grpo_gms8k.sh
125
+ ```
126
+
127
+ Useful overrides include `--steps`, `--batch-size`, `--group-size`,
128
+ `--max-examples`, and `--help`. The default configuration uses a Qwen model,
129
+ LoRA, SwanLab logging, and the GSM8K boxed-answer reward. Change the model and
130
+ training settings in `triotune/configs/grpo_gms8k.yaml` for your setup.
131
+
132
+ ## πŸ”§ Support Matrix
133
+
134
+ ### 🧠 Algorithms
135
+
136
+ | Algorithm | Documentation | Paper | Configuration |
137
+ | --- | --- | --- | --- |
138
+ | **GRPO** | - | [πŸ“„ Paper](https://arxiv.org/abs/2402.03300) | [πŸ”— GSM8K Example](triotune/configs/grpo_gms8k.yaml) |
139
+ | **PPO** | - | [πŸ“„ Paper](https://arxiv.org/abs/1707.06347) | [πŸ”— GSM8K Example](triotune/configs/ppo_gsm8k.yaml) |
140
+ | **DPO** | - | [πŸ“„ Paper](https://arxiv.org/abs/2305.18290) | [πŸ”— HH-RLHF Example](triotune/configs/dpo_rlhf.yaml) |
141
+ | **OPD** | - | | [πŸ”— DeepMath-103K Example](triotune/configs/opd_deepmath.yaml) |
142
+ | **SFT** | - | | [πŸ”— Huanhuan Chat Example](triotune/configs/sft_huanhuan.yaml) |
143
+
144
+ ### πŸ“– Models
145
+
146
+ PyTRIO currently supports the following models:
147
+
148
+ - `Qwen/Qwen3.5-4B`
149
+ - `Qwen/Qwen3.5-9B`
150
+ - `Qwen/Qwen3.8-27B`
151
+
152
+ ## 🧩 Data contracts
153
+
154
+ The trainers accept a deliberately small set of input representations:
155
+
156
+ - a string;
157
+ - a non-empty list of token IDs; or
158
+ - a non-empty list of `{role, content}` chat messages.
159
+
160
+ Algorithm-specific fields are:
161
+
162
+ - **GRPO:** `messages` and a string `answer` used by the reward function;
163
+ - **DPO:** shared `messages`, plus `chosen` and `rejected` responses;
164
+ - **SFT:** `text`, `messages`, `prompt`/`completion`, or pre-tokenized
165
+ `input_ids` (optionally with `labels`);
166
+ - **OPD:** prompt rows; the teacher scores the student's sampled completion.
167
+
168
+ See the [trainer guide](triotune/trainer/README.md) and [script guide](triotune/scripts/README.md)
169
+ for validation rules and complete JSONL examples.
170
+
171
+ ## 🐍 Python API
172
+
173
+ The public imports are grouped by algorithm:
174
+
175
+ ```python
176
+ import asyncio
177
+
178
+ from trio_cookbook.trainer import PPOConfig, PPOTrainer
179
+
180
+ rows = [
181
+ {
182
+ "messages": [{"role": "user", "content": "What is 2 + 2?"}],
183
+ "answer": "4",
184
+ },
185
+ ]
186
+
187
+ trainer = PPOTrainer(
188
+ model="your-pytrio-model-id",
189
+ reward_fn=your_reward_function,
190
+ args=PPOConfig.for_algorithm("grpo", num_generations=4, max_steps=100),
191
+ train_dataset=rows,
192
+ )
193
+ asyncio.run(trainer.train())
194
+ ```
195
+
196
+ ## πŸ—ƒοΈ Repository layout
197
+
198
+ ```text
199
+ triotune/
200
+ β”œβ”€β”€ configs/ # YAML configurations for the built-in workflows
201
+ β”œβ”€β”€ recipes/ # Trainer-based and standalone PyTRIO examples
202
+ β”œβ”€β”€ scripts/ # Shell launchers and dataset preparation guides
203
+ └── trainer/ # Trainers plus shared config, dataset, and client contracts
204
+ ```
205
+
206
+ ## 🎯 Current scope
207
+
208
+ Triotune currently targets text-only, PyTRIO-backed experiments. It does not
209
+ claim to provide a Web UI, Megatron integration, multimodal training, or a
210
+ universal plugin/registry system. If you need a custom model module, first
211
+ adapt it to the public PyTRIO client contract and use the existing recipe or
212
+ trainer interfaces; first-class custom-module registration is planned work,
213
+ not a supported promise of version 0.1.1.
@@ -0,0 +1,196 @@
1
+ # Triotune
2
+
3
+ **PyTRIO-native training recipes and trainer building blocks.**
4
+
5
+ Triotune is a small, text-only training cookbook built on the public PyTRIO
6
+ client API. The name combines **Trio**, from PyTRIO, with **tune**, inspired by
7
+ Torchtune. It keeps model execution, tokenization, sampling, and optimization
8
+ in PyTRIO, while providing the client-side data preparation, reward and
9
+ advantage calculation, token alignment, and training-loop orchestration.
10
+
11
+ <p align="center">
12
+ <a href="README_CN.md">δΈ­ζ–‡ζ–‡ζ‘£</a>
13
+ </p>
14
+
15
+ > **Project status:** Triotune is an early-stage cookbook. It currently offers
16
+ > built-in text-training workflows and examples; a general API for registering
17
+ > arbitrary custom model modules is not yet part of the project.
18
+
19
+ ## πŸ—‚οΈ Contents
20
+
21
+ - [Introduction](#introduction)
22
+ - [News](#news)
23
+ - [Installation](#installation)
24
+ - [Quick start](#quick-start)
25
+ - [Algorithms](#algorithms)
26
+ - [Data contracts](#data-contracts)
27
+ - [Python API](#python-api)
28
+ - [Documentation](#documentation)
29
+ - [Repository layout](#repository-layout)
30
+ - [Current scope](#current-scope)
31
+
32
+ ## πŸ‘‹ Introduction
33
+
34
+ Triotune provides a trainer-shaped interface for a few PyTRIO-backed training
35
+ algorithms. The package is intentionally client-side: PyTRIO remains
36
+ responsible for model weights, LoRA training clients, tokenizers, sampling,
37
+ forward/backward execution, optimizer steps, and checkpoint storage.
38
+
39
+ The current trainers are:
40
+
41
+ - **PPO**: one asynchronous trainer for PPO, GRPO, RLOO, GSPO, SAPO,
42
+ CISPO, DAPO, and related presets.
43
+ - **DPO**: chosen/rejected preference pairs, optional reference-policy scoring,
44
+ and a local pairwise loss submitted through PyTRIO.
45
+ - **SFT**: text-only supervised fine-tuning with prompt/completion masking and
46
+ an asynchronous training path.
47
+ - **OPD**: on-policy distillation in which a student samples completions and a
48
+ fixed teacher supplies token-level scores.
49
+
50
+ PPO, DPO, and OPD include asynchronous training paths where
51
+ the underlying PyTRIO client supports them. Shared utilities handle text,
52
+ token-ID, and chat-message inputs, checkpoint naming, and SwanLab metrics.
53
+
54
+ ## πŸ“° News
55
+
56
+ - **2026-10-12:** Triotune 0.1.0 (`pytrio-cookbook`) was published to [PyPI](https://pypi.org/project/pytrio-cookbook/).
57
+
58
+ ## πŸ“¦ Installation
59
+
60
+ ### βœ… Requirements
61
+
62
+ - Python 3.12 (the package currently declares `>=3.12,<3.13`)
63
+ - Access to a PyTRIO-compatible training service and the models used by your
64
+ recipe
65
+
66
+ Using [uv](https://docs.astral.sh/uv/) is recommended because `uv.lock` pins
67
+ the repository environment:
68
+
69
+ ```bash
70
+ uv sync
71
+ uv run python -c "import trio_cookbook; print(trio_cookbook.__name__)"
72
+ ```
73
+
74
+ Install the optional PyTorch dependency when using DPO:
75
+
76
+ ```bash
77
+ uv sync --extra dpo
78
+ ```
79
+
80
+ The published package can also be installed directly:
81
+
82
+ ```bash
83
+ pip install triotune==0.1.1
84
+ ```
85
+
86
+ For a source checkout with pip:
87
+
88
+ ```bash
89
+ pip install -r requirements.txt
90
+ pip install -e .
91
+ ```
92
+
93
+ The distribution name is `triotune`; the Python import name remains
94
+ `trio_cookbook`.
95
+
96
+ ## πŸš€ Quick start
97
+
98
+ The GSM8K recipe prepares a JSONL dataset and then runs the PPO trainer with
99
+ its GRPO preset. The preparation command does not create a PyTRIO client, so it is a
100
+ safe first check for the local environment:
101
+
102
+ ```bash
103
+ # From the repository root
104
+ bash triotune/scripts/train_grpo_gms8k.sh --prepare-only
105
+
106
+ # Start training with the default YAML configuration
107
+ bash triotune/scripts/train_grpo_gms8k.sh
108
+ ```
109
+
110
+ Useful overrides include `--steps`, `--batch-size`, `--group-size`,
111
+ `--max-examples`, and `--help`. The default configuration uses a Qwen model,
112
+ LoRA, SwanLab logging, and the GSM8K boxed-answer reward. Change the model and
113
+ training settings in `triotune/configs/grpo_gms8k.yaml` for your setup.
114
+
115
+ ## πŸ”§ Support Matrix
116
+
117
+ ### 🧠 Algorithms
118
+
119
+ | Algorithm | Documentation | Paper | Configuration |
120
+ | --- | --- | --- | --- |
121
+ | **GRPO** | - | [πŸ“„ Paper](https://arxiv.org/abs/2402.03300) | [πŸ”— GSM8K Example](triotune/configs/grpo_gms8k.yaml) |
122
+ | **PPO** | - | [πŸ“„ Paper](https://arxiv.org/abs/1707.06347) | [πŸ”— GSM8K Example](triotune/configs/ppo_gsm8k.yaml) |
123
+ | **DPO** | - | [πŸ“„ Paper](https://arxiv.org/abs/2305.18290) | [πŸ”— HH-RLHF Example](triotune/configs/dpo_rlhf.yaml) |
124
+ | **OPD** | - | | [πŸ”— DeepMath-103K Example](triotune/configs/opd_deepmath.yaml) |
125
+ | **SFT** | - | | [πŸ”— Huanhuan Chat Example](triotune/configs/sft_huanhuan.yaml) |
126
+
127
+ ### πŸ“– Models
128
+
129
+ PyTRIO currently supports the following models:
130
+
131
+ - `Qwen/Qwen3.5-4B`
132
+ - `Qwen/Qwen3.5-9B`
133
+ - `Qwen/Qwen3.8-27B`
134
+
135
+ ## 🧩 Data contracts
136
+
137
+ The trainers accept a deliberately small set of input representations:
138
+
139
+ - a string;
140
+ - a non-empty list of token IDs; or
141
+ - a non-empty list of `{role, content}` chat messages.
142
+
143
+ Algorithm-specific fields are:
144
+
145
+ - **GRPO:** `messages` and a string `answer` used by the reward function;
146
+ - **DPO:** shared `messages`, plus `chosen` and `rejected` responses;
147
+ - **SFT:** `text`, `messages`, `prompt`/`completion`, or pre-tokenized
148
+ `input_ids` (optionally with `labels`);
149
+ - **OPD:** prompt rows; the teacher scores the student's sampled completion.
150
+
151
+ See the [trainer guide](triotune/trainer/README.md) and [script guide](triotune/scripts/README.md)
152
+ for validation rules and complete JSONL examples.
153
+
154
+ ## 🐍 Python API
155
+
156
+ The public imports are grouped by algorithm:
157
+
158
+ ```python
159
+ import asyncio
160
+
161
+ from trio_cookbook.trainer import PPOConfig, PPOTrainer
162
+
163
+ rows = [
164
+ {
165
+ "messages": [{"role": "user", "content": "What is 2 + 2?"}],
166
+ "answer": "4",
167
+ },
168
+ ]
169
+
170
+ trainer = PPOTrainer(
171
+ model="your-pytrio-model-id",
172
+ reward_fn=your_reward_function,
173
+ args=PPOConfig.for_algorithm("grpo", num_generations=4, max_steps=100),
174
+ train_dataset=rows,
175
+ )
176
+ asyncio.run(trainer.train())
177
+ ```
178
+
179
+ ## πŸ—ƒοΈ Repository layout
180
+
181
+ ```text
182
+ triotune/
183
+ β”œβ”€β”€ configs/ # YAML configurations for the built-in workflows
184
+ β”œβ”€β”€ recipes/ # Trainer-based and standalone PyTRIO examples
185
+ β”œβ”€β”€ scripts/ # Shell launchers and dataset preparation guides
186
+ └── trainer/ # Trainers plus shared config, dataset, and client contracts
187
+ ```
188
+
189
+ ## 🎯 Current scope
190
+
191
+ Triotune currently targets text-only, PyTRIO-backed experiments. It does not
192
+ claim to provide a Web UI, Megatron integration, multimodal training, or a
193
+ universal plugin/registry system. If you need a custom model module, first
194
+ adapt it to the public PyTRIO client contract and use the existing recipe or
195
+ trainer interfaces; first-class custom-module registration is planned work,
196
+ not a supported promise of version 0.1.1.
@@ -0,0 +1,45 @@
1
+ [project]
2
+ name = "triotune"
3
+ version = "0.1.1"
4
+ description = "PyTRIO-native training utilities and recipes"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12,<3.13"
7
+ dependencies = [
8
+ "datasets==5.0.1",
9
+ "numpy==2.5.3",
10
+ "pytrio==0.2.9",
11
+ "pyyaml==6.0.3",
12
+ "swanlab==0.10.1",
13
+ "tqdm==4.70.1",
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ dpo = ["torch>=2.3"]
18
+ ppo = ["torch>=2.3"]
19
+
20
+ [build-system]
21
+ requires = ["setuptools>=68"]
22
+ build-backend = "setuptools.build_meta"
23
+
24
+ [tool.setuptools]
25
+ packages = [
26
+ "trio_cookbook",
27
+ "trio_cookbook.api",
28
+ "trio_cookbook.dataset",
29
+ "trio_cookbook.dataset.swe_sft",
30
+ "trio_cookbook.trainer",
31
+ "trio_cookbook.trainer.dpo",
32
+ "trio_cookbook.trainer.sft",
33
+ "trio_cookbook.trainer.opd",
34
+ "trio_cookbook.trainer.ppo",
35
+ "trio_cookbook.utils",
36
+ ]
37
+
38
+ [tool.setuptools.package-dir]
39
+ trio_cookbook = "triotune"
40
+ "trio_cookbook.trainer" = "triotune/trainer"
41
+
42
+ [tool.uv]
43
+ # Install the ``triotune`` source directory under the stable public import
44
+ # name ``trio_cookbook`` via the setuptools mapping above.
45
+ package = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,26 @@
1
+ """Client-side training utilities for PyTRIO.
2
+
3
+ The package intentionally contains no model implementation. Model weights,
4
+ tokenization backends, sampling and optimization stay behind the PyTRIO
5
+ clients supplied by the caller.
6
+ """
7
+
8
+ from . import utils
9
+ from .api.client_api import call, call_async, wait, wait_async
10
+ from .trainer import DPOConfig, DPOTrainer, OPDConfig, OPDTrainer
11
+ from .trainer import PPOConfig, PPOTrainer, RenderedPrompt, render_prompt
12
+
13
+ __all__ = [
14
+ "DPOConfig",
15
+ "DPOTrainer",
16
+ "OPDConfig",
17
+ "OPDTrainer",
18
+ "PPOConfig",
19
+ "PPOTrainer",
20
+ "RenderedPrompt",
21
+ "call",
22
+ "call_async",
23
+ "render_prompt",
24
+ "wait",
25
+ "wait_async",
26
+ ]
@@ -0,0 +1,55 @@
1
+ """Public configuration and client contracts for trainer algorithms."""
2
+
3
+ from .cli_args import (
4
+ BaseTrainerConfig,
5
+ DPOConfig,
6
+ NormConfig,
7
+ OPDConfig,
8
+ PPOConfig,
9
+ SFTConfig,
10
+ )
11
+ from .client_api import (
12
+ call,
13
+ call_async,
14
+ optimizer_params,
15
+ sampling_params,
16
+ sdk_object,
17
+ submit_async,
18
+ wait,
19
+ wait_async,
20
+ )
21
+ from .loss_api import (
22
+ BUILTIN_LOSS_FNS,
23
+ CE_LOSS_FNS,
24
+ POLICY_LOSS_FNS,
25
+ BuiltinObjective,
26
+ BuiltinPyTrioObjective,
27
+ LossSpec,
28
+ PolicyLossInput,
29
+ SupervisedLossInput,
30
+ )
31
+
32
+ __all__ = [
33
+ "BUILTIN_LOSS_FNS",
34
+ "CE_LOSS_FNS",
35
+ "POLICY_LOSS_FNS",
36
+ "BaseTrainerConfig",
37
+ "BuiltinObjective",
38
+ "BuiltinPyTrioObjective",
39
+ "DPOConfig",
40
+ "LossSpec",
41
+ "NormConfig",
42
+ "OPDConfig",
43
+ "PPOConfig",
44
+ "PolicyLossInput",
45
+ "SFTConfig",
46
+ "SupervisedLossInput",
47
+ "call",
48
+ "call_async",
49
+ "optimizer_params",
50
+ "sampling_params",
51
+ "sdk_object",
52
+ "submit_async",
53
+ "wait",
54
+ "wait_async",
55
+ ]