trloom 0.1.0__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 (46) hide show
  1. trloom-0.1.0/.gitignore +71 -0
  2. trloom-0.1.0/LICENSE +176 -0
  3. trloom-0.1.0/PKG-INFO +305 -0
  4. trloom-0.1.0/README.md +256 -0
  5. trloom-0.1.0/docs/api.md +45 -0
  6. trloom-0.1.0/docs/assets/trloom.png +0 -0
  7. trloom-0.1.0/docs/cli.md +56 -0
  8. trloom-0.1.0/docs/getting-started.md +132 -0
  9. trloom-0.1.0/docs/guides/configuration.md +202 -0
  10. trloom-0.1.0/docs/guides/datasets.md +105 -0
  11. trloom-0.1.0/docs/guides/examples.md +41 -0
  12. trloom-0.1.0/docs/guides/modal.md +125 -0
  13. trloom-0.1.0/docs/guides/wandb.md +71 -0
  14. trloom-0.1.0/docs/index.md +61 -0
  15. trloom-0.1.0/examples/data/sample_sft.jsonl +3 -0
  16. trloom-0.1.0/examples/dpo_wandb.yaml +35 -0
  17. trloom-0.1.0/examples/grpo_modal.yaml +48 -0
  18. trloom-0.1.0/examples/modal_smoke/README.md +91 -0
  19. trloom-0.1.0/examples/modal_smoke/config.yaml +52 -0
  20. trloom-0.1.0/examples/modal_smoke/run.py +113 -0
  21. trloom-0.1.0/examples/sft_hub.yaml +34 -0
  22. trloom-0.1.0/examples/sft_local.yaml +28 -0
  23. trloom-0.1.0/mkdocs.yml +95 -0
  24. trloom-0.1.0/pyproject.toml +94 -0
  25. trloom-0.1.0/src/trloom/__init__.py +19 -0
  26. trloom-0.1.0/src/trloom/__main__.py +8 -0
  27. trloom-0.1.0/src/trloom/cli.py +148 -0
  28. trloom-0.1.0/src/trloom/config/__init__.py +22 -0
  29. trloom-0.1.0/src/trloom/config/loader.py +36 -0
  30. trloom-0.1.0/src/trloom/config/schema.py +185 -0
  31. trloom-0.1.0/src/trloom/data/__init__.py +7 -0
  32. trloom-0.1.0/src/trloom/data/dataset.py +210 -0
  33. trloom-0.1.0/src/trloom/job.py +109 -0
  34. trloom-0.1.0/src/trloom/logging_utils/__init__.py +106 -0
  35. trloom-0.1.0/src/trloom/modal_support/__init__.py +7 -0
  36. trloom-0.1.0/src/trloom/modal_support/runner.py +293 -0
  37. trloom-0.1.0/src/trloom/rewards.py +81 -0
  38. trloom-0.1.0/src/trloom/trainers/__init__.py +13 -0
  39. trloom-0.1.0/src/trloom/trainers/builder.py +149 -0
  40. trloom-0.1.0/src/trloom/trainers/registry.py +221 -0
  41. trloom-0.1.0/tests/test_cli.py +25 -0
  42. trloom-0.1.0/tests/test_config.py +95 -0
  43. trloom-0.1.0/tests/test_dataset.py +56 -0
  44. trloom-0.1.0/tests/test_job_wandb.py +62 -0
  45. trloom-0.1.0/tests/test_modal.py +65 -0
  46. trloom-0.1.0/tests/test_registry.py +55 -0
@@ -0,0 +1,71 @@
1
+ # Byte-compiled / cache
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+ env/
28
+
29
+ # Testing / coverage
30
+ .coverage
31
+ .coverage.*
32
+ htmlcov/
33
+ .pytest_cache/
34
+ .ruff_cache/
35
+ .mypy_cache/
36
+ .tox/
37
+ .nox/
38
+
39
+ # IDE / OS
40
+ .idea/
41
+ .vscode/
42
+ *.swp
43
+ .DS_Store
44
+ Thumbs.db
45
+
46
+ # Training artifacts
47
+ outputs/
48
+ output/
49
+ wandb/
50
+ runs/
51
+ checkpoints/
52
+ *.pt
53
+ *.bin
54
+ *.safetensors
55
+
56
+ # Secrets / local config
57
+ .env
58
+ .env.*
59
+ !.env.example
60
+ secrets/
61
+ *.pem
62
+
63
+ # Modal
64
+ .modal/
65
+
66
+ # Docs build
67
+ site/
68
+
69
+ # Local article drafts (not part of the library)
70
+ medium-trloom-tutorial.md
71
+ *-medium*.md
trloom-0.1.0/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
trloom-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,305 @@
1
+ Metadata-Version: 2.5
2
+ Name: trloom
3
+ Version: 0.1.0
4
+ Summary: YAML-driven end-to-end fine-tuning on top of Hugging Face TRL, with W&B and Modal support.
5
+ Project-URL: Homepage, https://github.com/saqlain2204/trloom
6
+ Project-URL: Repository, https://github.com/saqlain2204/trloom
7
+ Project-URL: Documentation, https://saqlain2204.github.io/trloom/
8
+ Project-URL: Issues, https://github.com/saqlain2204/trloom/issues
9
+ Author: TRLoom contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: fine-tuning,modal,rlhf,transformers,trl,wandb,yaml
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: accelerate>=1.0.0
24
+ Requires-Dist: datasets>=3.0.0
25
+ Requires-Dist: huggingface-hub>=0.26.0
26
+ Requires-Dist: peft>=0.14.0
27
+ Requires-Dist: pydantic>=2.7
28
+ Requires-Dist: pyyaml>=6.0
29
+ Requires-Dist: transformers>=4.51.0
30
+ Requires-Dist: trl>=0.24.0
31
+ Provides-Extra: all
32
+ Requires-Dist: bitsandbytes>=0.45.0; extra == 'all'
33
+ Requires-Dist: modal>=0.73.0; extra == 'all'
34
+ Requires-Dist: wandb>=0.18.0; extra == 'all'
35
+ Provides-Extra: bitsandbytes
36
+ Requires-Dist: bitsandbytes>=0.45.0; extra == 'bitsandbytes'
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
39
+ Requires-Dist: pytest>=8.0; extra == 'dev'
40
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
41
+ Provides-Extra: docs
42
+ Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
43
+ Requires-Dist: mkdocstrings[python]>=0.26.0; extra == 'docs'
44
+ Provides-Extra: modal
45
+ Requires-Dist: modal>=0.73.0; extra == 'modal'
46
+ Provides-Extra: wandb
47
+ Requires-Dist: wandb>=0.18.0; extra == 'wandb'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # TRLoom
51
+
52
+ <p align="center">
53
+ <img src="assets/trloom.png" alt="TRLoom" width="280" />
54
+ </p>
55
+
56
+ **TRLoom** weaves a single YAML config into an end-to-end [Hugging Face TRL](https://huggingface.co/docs/trl) fine-tuning job.
57
+
58
+ Configure the model, dataset, trainer, Weights & Biases, and optional [Modal](https://modal.com) GPU execution — then run one command.
59
+
60
+ **Docs:** [https://saqlain2204.github.io/trloom/](https://saqlain2204.github.io/trloom/)
61
+
62
+ ## Features
63
+
64
+ - **TRL-native** — discovers trainers/configs from your installed TRL version (SFT, DPO, GRPO, KTO, Reward, RLOO, and experimental methods)
65
+ - **YAML-first** — model, dataset, training args, W&B, and Modal all live in one file
66
+ - **Datasets** — Hugging Face Hub, local files (`json`/`jsonl`/`csv`/`parquet`/…), saved `datasets` directories, and mixtures
67
+ - **W&B** — enable and configure logging entirely from YAML
68
+ - **Modal** — launch the same YAML on remote GPUs with volume-backed outputs
69
+ - **CLI + Python API** — `trloom run config.yaml` or `FineTuneJob.from_yaml(...)`
70
+
71
+ ## Installation
72
+
73
+ Requires Python 3.10+ and a working TRL / PyTorch environment for actual training.
74
+
75
+ ### One-command bootstrap (any OS)
76
+
77
+ Creates `.venv` if needed, then installs TRLoom:
78
+
79
+ ```bash
80
+ # Local only (no Modal auth)
81
+ python scripts/bootstrap.py
82
+
83
+ # Local + Modal extra + `modal setup`
84
+ python scripts/bootstrap.py --modal
85
+ ```
86
+
87
+ Optional flags: `--wandb`, `--dev`, `--all`, `--skip-modal-setup`.
88
+
89
+ Then activate the venv:
90
+
91
+ ```bash
92
+ # macOS / Linux
93
+ source .venv/bin/activate
94
+
95
+ # Windows PowerShell
96
+ .venv\Scripts\Activate.ps1
97
+ ```
98
+
99
+ ### Manual install
100
+
101
+ ```bash
102
+ pip install -e .
103
+
104
+ # Optional extras
105
+ pip install -e ".[wandb]"
106
+ pip install -e ".[modal]"
107
+ pip install -e ".[docs]"
108
+ pip install -e ".[all]"
109
+ pip install -e ".[dev]"
110
+ ```
111
+
112
+ ## Quickstart
113
+
114
+ ### 1. Write a config
115
+
116
+ ```yaml
117
+ # sft.yaml
118
+ method: sft
119
+
120
+ model:
121
+ model_name_or_path: Qwen/Qwen2.5-0.5B-Instruct
122
+ use_peft: true
123
+ lora_r: 16
124
+ lora_alpha: 32
125
+
126
+ dataset:
127
+ path: trl-lib/Capybara
128
+ train_split: train
129
+
130
+ training:
131
+ output_dir: ./outputs/sft
132
+ learning_rate: 2.0e-4
133
+ num_train_epochs: 1
134
+ per_device_train_batch_size: 2
135
+ gradient_accumulation_steps: 4
136
+ report_to: none
137
+
138
+ wandb:
139
+ enabled: false
140
+
141
+ modal:
142
+ enabled: false
143
+ ```
144
+
145
+ ### 2. Run
146
+
147
+ ```bash
148
+ trloom validate sft.yaml
149
+ trloom run sft.yaml
150
+ ```
151
+
152
+ Or from Python:
153
+
154
+ ```python
155
+ from trloom import FineTuneJob, run_from_yaml
156
+
157
+ # One-liner
158
+ run_from_yaml("sft.yaml")
159
+
160
+ # Or step through the API
161
+ job = FineTuneJob.from_yaml("sft.yaml")
162
+ job.run()
163
+ ```
164
+
165
+ ## Documentation
166
+
167
+ Full guides and API reference:
168
+
169
+ - Online: [saqlain2204.github.io/trloom](https://saqlain2204.github.io/trloom/)
170
+ - Local preview:
171
+
172
+ ```bash
173
+ pip install -e ".[docs]"
174
+ mkdocs serve
175
+ ```
176
+
177
+ Coverage includes configuration reference, datasets, W&B, Modal, CLI, and the Python API.
178
+
179
+ ## Configuration reference
180
+
181
+ | Section | Purpose |
182
+ |--------|---------|
183
+ | `method` | TRL method key: `sft`, `dpo`, `grpo`, `kto`, `reward`, `rloo`, … |
184
+ | `model` | Model id + PEFT/quantization (aligned with TRL `ModelConfig`) |
185
+ | `dataset` | Hub repo, local path, or `datasets:` mixture |
186
+ | `training` | Forwarded to the TRL `*Config` class (`SFTConfig`, `DPOConfig`, …) |
187
+ | `wandb` | Weights & Biases project/entity/tags/mode |
188
+ | `modal` | Remote GPU execution on Modal |
189
+ | `reward_funcs` | Names or import paths for GRPO/RLOO-style rewards |
190
+ | `trainer_kwargs` | Extra kwargs passed to the Trainer constructor |
191
+ | `push_to_hub` / `hub_model_id` | Optional Hub upload after training |
192
+
193
+ List methods available in your environment:
194
+
195
+ ```bash
196
+ trloom methods
197
+ ```
198
+
199
+ ### Dataset examples
200
+
201
+ **Hub**
202
+
203
+ ```yaml
204
+ dataset:
205
+ path: trl-lib/Capybara
206
+ train_split: train
207
+ ```
208
+
209
+ **Local JSONL**
210
+
211
+ ```yaml
212
+ dataset:
213
+ path: ./data/train.jsonl
214
+ train_split: train
215
+ ```
216
+
217
+ **Mixture**
218
+
219
+ ```yaml
220
+ dataset:
221
+ train_split: train
222
+ datasets:
223
+ - path: stanfordnlp/imdb
224
+ split: train
225
+ weight: 0.5
226
+ - path: ./data/extra.jsonl
227
+ weight: 0.5
228
+ ```
229
+
230
+ ### Weights & Biases
231
+
232
+ ```yaml
233
+ training:
234
+ report_to: wandb # optional; set automatically when wandb.enabled is true
235
+
236
+ wandb:
237
+ enabled: true
238
+ project: my-project
239
+ entity: my-team
240
+ run_name: qwen-sft-01
241
+ tags: [sft, lora]
242
+ mode: online # online | offline | disabled
243
+ ```
244
+
245
+ ### Modal
246
+
247
+ 1. Install and authenticate: `pip install 'trloom[modal]' && modal setup`
248
+ 2. Create secrets named in the config (default: `huggingface`, `wandb`)
249
+ 3. Set `modal.enabled: true` (or pass `--modal`)
250
+
251
+ ```bash
252
+ trloom run examples/grpo_modal.yaml --modal
253
+ # or generate a standalone script
254
+ trloom modal-script examples/grpo_modal.yaml -o run_modal.py
255
+ modal run run_modal.py
256
+ ```
257
+
258
+ ## Python API
259
+
260
+ ```python
261
+ from trloom import FineTuneJob, available_methods, load_config
262
+
263
+ print(available_methods())
264
+
265
+ config = load_config("sft.yaml")
266
+ job = FineTuneJob(config)
267
+ trainer = job.build() # construct TRL trainer
268
+ job.run() # train + save (+ optional Hub push)
269
+ ```
270
+
271
+ | Method | Description |
272
+ |--------|-------------|
273
+ | `FineTuneJob.from_yaml(path)` | Load YAML into a job |
274
+ | `FineTuneJob.from_dict(data)` | Load an in-memory config |
275
+ | `job.build()` | Construct the TRL trainer |
276
+ | `job.train()` / `job.run()` | Run training end-to-end |
277
+ | `run_from_yaml(path)` | Load + run (honors `modal.enabled`) |
278
+ | `load_config(path)` | Validate and return `FineTuneConfig` |
279
+ | `available_methods()` | List TRL methods for this install |
280
+
281
+ ## Examples
282
+
283
+ See the [`examples/`](examples/) directory:
284
+
285
+ - `modal_smoke/` — **complete end-to-end Modal walkthrough** (tiny GPT-2, 3 steps, T4)
286
+ - `sft_hub.yaml` — SFT from the Hub
287
+ - `sft_local.yaml` — SFT from local JSONL
288
+ - `dpo_wandb.yaml` — DPO with W&B
289
+ - `grpo_modal.yaml` — GRPO on Modal
290
+
291
+ ## Development
292
+
293
+ ```bash
294
+ pip install -e ".[dev]"
295
+ pytest
296
+
297
+ # Documentation
298
+ pip install -e ".[docs]"
299
+ mkdocs serve
300
+ mkdocs build --strict
301
+ ```
302
+
303
+ ## License
304
+
305
+ Apache-2.0