nextron-cloud 0.1.0rc1__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.
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .DS_Store
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0rc1
4
+
5
+ First release candidate.
6
+
7
+ - `NexTron` client: `me`, `models`, `layouts`; datasets (upload with a local format check, Hugging Face import,
8
+ wait, download link, delete); jobs (estimate with the server's checks, create with name and tags, wait, progress,
9
+ events, logs, metrics, billing, cancel, checkpoint download with sha256 checks, export).
10
+ - Data helpers: `to_messages`, `write_jsonl`, `check_file`, `prepare_file` for messages, ShareGPT, Alpaca, Dolly,
11
+ OpenOrca, prompt/completion, question/answer, problem/solution and input/output rows.
12
+ - Experiments: `sweep` (one job per combination, repeat-safe) and `report`.
13
+ - `nextron-cloud` CLI, JSON output; `nextron-cloud guide` prints the agent guide shipped in the package.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.5
2
+ Name: nextron-cloud
3
+ Version: 0.1.0rc1
4
+ Summary: Official Python client for the NexTron Cloud fine-tuning API.
5
+ Project-URL: Homepage, https://nextron.physionlabs.ai
6
+ Project-URL: Issues, https://github.com/Physion-Labs/nextron-python/issues
7
+ Author-email: Physion Labs <support@physionlabs.ai>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: fine-tuning,nextron,physion,training
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: httpx<1,>=0.27
20
+ Requires-Dist: pydantic<3,>=2.9
21
+ Description-Content-Type: text/markdown
22
+
23
+ # nextron-cloud
24
+
25
+ > **Release candidate.** The API may still change before 0.1.0; install with `--prerelease=allow`.
26
+
27
+ Python SDK and CLI for [NexTron Cloud](https://nextron.physionlabs.ai): fine-tune open models with one request
28
+ (model + dataset + settings) and download the trained checkpoint.
29
+
30
+ ```bash
31
+ uv venv && uv pip install --prerelease=allow nextron-cloud # or, in a uv project: uv add --prerelease=allow nextron-cloud
32
+ export NEXTRON_API_KEY="nk_live_..." # API keys page on nextron.physionlabs.ai
33
+ uv run nextron-cloud models # what can be trained now, at what price
34
+ ```
35
+
36
+ Commands below are written as `nextron-cloud ...`; run them with `uv run` (or activate `.venv`).
37
+
38
+ ```python
39
+ from nextron_cloud import NexTron
40
+
41
+ client = NexTron()
42
+ dataset = client.datasets.wait(client.datasets.upload("train.jsonl").id) # checked locally, then by the server
43
+ draft = dict(model="qwen3.8-27b", dataset_id=dataset.id, params={"train_type": "lora", "learning_rate": 1e-4})
44
+ print(client.jobs.estimate(**draft)) # cost in US cents: get a yes first
45
+
46
+ job = client.jobs.wait(client.jobs.create(**draft, name="first try").id) # only after the cost is approved
47
+ print(job.state, client.jobs.metrics(job.id)[-1])
48
+
49
+ client.jobs.wait_checkpoint(job.id) # later: weights stay 30 days
50
+ client.jobs.download_checkpoint(job.id, f"checkpoints/{job.id}")
51
+ ```
52
+
53
+ ## Start with an agent
54
+
55
+ Install, set the key, then paste this to your coding agent (Claude Code, Codex, ...) and fill in the brackets:
56
+
57
+ ```text
58
+ Run a fine-tuning experiment for me on NexTron Cloud, a managed training service: one request trains a model on
59
+ its GPUs and leaves a checkpoint to download.
60
+
61
+ Setup
62
+ - Install the SDK with uv in this project: `uv venv && uv pip install --prerelease=allow nextron-cloud`
63
+ (in a uv project: `uv add --prerelease=allow nextron-cloud`). Run its commands with `uv run`, e.g.
64
+ `uv run nextron-cloud guide`.
65
+ - My API key is in the environment variable NEXTRON_API_KEY. Never print it or write it into a file.
66
+ - Before anything else run `uv run nextron-cloud guide` and read all of it. At each step read its topic too:
67
+ `nextron-cloud guide data`, `... training`, `... monitoring`, `... checkpoints`, `... api`. Follow its rules.
68
+
69
+ The experiment
70
+ - Goal: [what the model should do better, e.g. "answer our support tickets in our tone and format"]
71
+ - Data: [file path or Hugging Face link, and which fields are the input and which the answer]
72
+ - How I will judge it: [e.g. "held-out tickets, compared with the base model"]
73
+ - Model: [a model id, or "pick one from `nextron-cloud models` and tell me why"]
74
+ - Budget: at most $[N] for this experiment unless I approve more.
75
+
76
+ How to work
77
+ - Prepare and check the data, hold out a validation set, upload, and plan a small first run.
78
+ - Before anything that costs money, show me the model, settings, estimated cost, steps, time and warnings, and
79
+ wait for my yes. Never start a job I have not approved.
80
+ - Give every job a name and a tag for this experiment.
81
+ - While jobs run, watch them (`nextron-cloud jobs progress` / `jobs events`) and tell me at once if one fails or
82
+ stalls.
83
+ - When training ends, report loss and validation loss, what was charged, what you conclude, and what you would try
84
+ next. Download checkpoints only when I ask.
85
+ - Keep everything you write in this project directory.
86
+ ```
87
+
88
+ ## Documentation
89
+
90
+ The guide is written for people and coding agents alike, in [skills/nextron-cloud](skills/nextron-cloud/SKILL.md):
91
+
92
+ - [SKILL.md](skills/nextron-cloud/SKILL.md): setup, rules, an experiment end to end
93
+ - [data.md](skills/nextron-cloud/references/data.md): the sample format, what training learns from, checks
94
+ - [training.md](skills/nextron-cloud/references/training.md): models, params, batch, cost and time, sweeps
95
+ - [monitoring.md](skills/nextron-cloud/references/monitoring.md): states, metrics, failures, API errors
96
+ - [checkpoints.md](skills/nextron-cloud/references/checkpoints.md): download, serve, evaluate
97
+ - [api.md](skills/nextron-cloud/references/api.md): every SDK call and CLI command
98
+ - [examples/compare_outputs.py](examples/compare_outputs.py): answer held-out prompts with the fine-tuned and the base
99
+ model side by side
100
+
101
+ Claude Code: `/plugin install nextron-cloud --marketplace Physion-Labs/nextron-python` installs it as a skill.
102
+ Other agents: point them at [AGENTS.md](AGENTS.md).
@@ -0,0 +1,80 @@
1
+ # nextron-cloud
2
+
3
+ > **Release candidate.** The API may still change before 0.1.0; install with `--prerelease=allow`.
4
+
5
+ Python SDK and CLI for [NexTron Cloud](https://nextron.physionlabs.ai): fine-tune open models with one request
6
+ (model + dataset + settings) and download the trained checkpoint.
7
+
8
+ ```bash
9
+ uv venv && uv pip install --prerelease=allow nextron-cloud # or, in a uv project: uv add --prerelease=allow nextron-cloud
10
+ export NEXTRON_API_KEY="nk_live_..." # API keys page on nextron.physionlabs.ai
11
+ uv run nextron-cloud models # what can be trained now, at what price
12
+ ```
13
+
14
+ Commands below are written as `nextron-cloud ...`; run them with `uv run` (or activate `.venv`).
15
+
16
+ ```python
17
+ from nextron_cloud import NexTron
18
+
19
+ client = NexTron()
20
+ dataset = client.datasets.wait(client.datasets.upload("train.jsonl").id) # checked locally, then by the server
21
+ draft = dict(model="qwen3.8-27b", dataset_id=dataset.id, params={"train_type": "lora", "learning_rate": 1e-4})
22
+ print(client.jobs.estimate(**draft)) # cost in US cents: get a yes first
23
+
24
+ job = client.jobs.wait(client.jobs.create(**draft, name="first try").id) # only after the cost is approved
25
+ print(job.state, client.jobs.metrics(job.id)[-1])
26
+
27
+ client.jobs.wait_checkpoint(job.id) # later: weights stay 30 days
28
+ client.jobs.download_checkpoint(job.id, f"checkpoints/{job.id}")
29
+ ```
30
+
31
+ ## Start with an agent
32
+
33
+ Install, set the key, then paste this to your coding agent (Claude Code, Codex, ...) and fill in the brackets:
34
+
35
+ ```text
36
+ Run a fine-tuning experiment for me on NexTron Cloud, a managed training service: one request trains a model on
37
+ its GPUs and leaves a checkpoint to download.
38
+
39
+ Setup
40
+ - Install the SDK with uv in this project: `uv venv && uv pip install --prerelease=allow nextron-cloud`
41
+ (in a uv project: `uv add --prerelease=allow nextron-cloud`). Run its commands with `uv run`, e.g.
42
+ `uv run nextron-cloud guide`.
43
+ - My API key is in the environment variable NEXTRON_API_KEY. Never print it or write it into a file.
44
+ - Before anything else run `uv run nextron-cloud guide` and read all of it. At each step read its topic too:
45
+ `nextron-cloud guide data`, `... training`, `... monitoring`, `... checkpoints`, `... api`. Follow its rules.
46
+
47
+ The experiment
48
+ - Goal: [what the model should do better, e.g. "answer our support tickets in our tone and format"]
49
+ - Data: [file path or Hugging Face link, and which fields are the input and which the answer]
50
+ - How I will judge it: [e.g. "held-out tickets, compared with the base model"]
51
+ - Model: [a model id, or "pick one from `nextron-cloud models` and tell me why"]
52
+ - Budget: at most $[N] for this experiment unless I approve more.
53
+
54
+ How to work
55
+ - Prepare and check the data, hold out a validation set, upload, and plan a small first run.
56
+ - Before anything that costs money, show me the model, settings, estimated cost, steps, time and warnings, and
57
+ wait for my yes. Never start a job I have not approved.
58
+ - Give every job a name and a tag for this experiment.
59
+ - While jobs run, watch them (`nextron-cloud jobs progress` / `jobs events`) and tell me at once if one fails or
60
+ stalls.
61
+ - When training ends, report loss and validation loss, what was charged, what you conclude, and what you would try
62
+ next. Download checkpoints only when I ask.
63
+ - Keep everything you write in this project directory.
64
+ ```
65
+
66
+ ## Documentation
67
+
68
+ The guide is written for people and coding agents alike, in [skills/nextron-cloud](skills/nextron-cloud/SKILL.md):
69
+
70
+ - [SKILL.md](skills/nextron-cloud/SKILL.md): setup, rules, an experiment end to end
71
+ - [data.md](skills/nextron-cloud/references/data.md): the sample format, what training learns from, checks
72
+ - [training.md](skills/nextron-cloud/references/training.md): models, params, batch, cost and time, sweeps
73
+ - [monitoring.md](skills/nextron-cloud/references/monitoring.md): states, metrics, failures, API errors
74
+ - [checkpoints.md](skills/nextron-cloud/references/checkpoints.md): download, serve, evaluate
75
+ - [api.md](skills/nextron-cloud/references/api.md): every SDK call and CLI command
76
+ - [examples/compare_outputs.py](examples/compare_outputs.py): answer held-out prompts with the fine-tuned and the base
77
+ model side by side
78
+
79
+ Claude Code: `/plugin install nextron-cloud --marketplace Physion-Labs/nextron-python` installs it as a skill.
80
+ Other agents: point them at [AGENTS.md](AGENTS.md).
@@ -0,0 +1,57 @@
1
+ [project]
2
+ name = "nextron-cloud"
3
+ dynamic = ["version"]
4
+ description = "Official Python client for the NexTron Cloud fine-tuning API."
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.10"
9
+ authors = [{ name = "Physion Labs", email = "support@physionlabs.ai" }]
10
+ keywords = ["nextron", "physion", "fine-tuning", "training"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Typing :: Typed",
19
+ ]
20
+ # Upper bounds at the next major: an unbounded httpx once resolved to a 1.0 dev release that broke Client().
21
+ dependencies = ["httpx>=0.27,<1", "pydantic>=2.9,<3"]
22
+
23
+ [project.scripts]
24
+ nextron-cloud = "nextron_cloud.cli:main"
25
+
26
+ [project.urls]
27
+ Homepage = "https://nextron.physionlabs.ai"
28
+ Issues = "https://github.com/Physion-Labs/nextron-python/issues"
29
+
30
+ [dependency-groups]
31
+ dev = ["pytest>=8.0", "mypy>=1.13"]
32
+
33
+ [build-system]
34
+ requires = ["hatchling"]
35
+ build-backend = "hatchling.build"
36
+
37
+ [tool.hatch.version]
38
+ path = "src/nextron_cloud/_version.py"
39
+
40
+ [tool.hatch.build.targets.sdist]
41
+ only-include = ["src", "skills", "README.md", "LICENSE", "CHANGELOG.md", "pyproject.toml"]
42
+
43
+ [tool.hatch.build.targets.wheel]
44
+ packages = ["src/nextron_cloud"]
45
+
46
+ # The agent guide ships inside the package: `nextron-cloud guide` prints it after a plain pip install.
47
+ [tool.hatch.build.targets.wheel.force-include]
48
+ "skills/nextron-cloud" = "nextron_cloud/guide"
49
+
50
+ [tool.pytest.ini_options]
51
+ testpaths = ["tests"]
52
+ addopts = "-q"
53
+
54
+ [tool.mypy]
55
+ python_version = "3.10"
56
+ strict = true
57
+ files = ["src/nextron_cloud"]
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: nextron-cloud
3
+ description: Run fine-tuning experiments on NexTron Cloud with the `nextron-cloud` Python SDK or CLI — choose a model, prepare and check JSONL training data, upload or import datasets from Hugging Face, estimate cost, start and watch training jobs, compare runs, download checkpoints and evaluate them. Use whenever the user wants to fine-tune, train, SFT or LoRA a model on NexTron, prepare data for it, check on a NexTron job, or run a training experiment.
4
+ ---
5
+
6
+ # NexTron Cloud
7
+
8
+ NexTron Cloud fine-tunes open models on its own H100s. One request = one whole training run: you send a model, a
9
+ dataset and a few settings, the service trains and leaves a checkpoint (a Hugging Face model directory) to download.
10
+ There is no per-step API, and nothing heavy runs on the user's machine. Text-only supervised fine-tuning (full or
11
+ LoRA) today.
12
+
13
+ Everything below works from Python (`from nextron_cloud import NexTron`) or the shell (`nextron-cloud ...`, every
14
+ command prints JSON). Read the reference for each step when you reach it (`nextron-cloud guide <topic>` prints it,
15
+ e.g. `nextron-cloud guide data`; this page is `nextron-cloud guide`):
16
+
17
+ | step | read |
18
+ |---|---|
19
+ | choose a model, settings, cost and time; run a sweep | [references/training.md](references/training.md) |
20
+ | build, convert and check data; what is trained on | [references/data.md](references/data.md) |
21
+ | watch a job, read its metrics, fix a failure | [references/monitoring.md](references/monitoring.md) |
22
+ | download, serve and evaluate the checkpoint | [references/checkpoints.md](references/checkpoints.md) |
23
+ | every SDK call and CLI command | [references/api.md](references/api.md) |
24
+
25
+ ## Setup
26
+
27
+ ```bash
28
+ uv venv && uv pip install --prerelease=allow nextron-cloud # in a uv project: uv add --prerelease=allow nextron-cloud
29
+ export NEXTRON_API_KEY="nk_live_..."
30
+ uv run nextron-cloud me # works = ready; prints the organisation and its balance in US cents
31
+ ```
32
+
33
+ Use uv, not plain pip. Commands in this guide are written `nextron-cloud ...`: run them as `uv run nextron-cloud ...`
34
+ (Python as `uv run python ...`), or activate `.venv` first.
35
+
36
+ No key yet: accounts are by invitation (ask Physion Labs, support@physionlabs.ai). The owner signs in at
37
+ https://nextron.physionlabs.ai, opens **API keys** (only an organisation owner can create one) and adds credit under
38
+ **Billing**. Never print the key or write it into files you commit.
39
+
40
+ ## Rules
41
+
42
+ 1. **Jobs cost the owner money. Ask before starting one.** Run `jobs.estimate` with the exact arguments you will
43
+ create with, tell the owner the cost (`credits` / 100 = US dollars), the model and the plan, and wait for a yes.
44
+ The CLI enforces this: `nextron-cloud jobs create ...` without `--yes` prints the estimate and starts nothing.
45
+ 2. **Take models and limits from `client.models()`**, never from memory or this file: model ids, which methods each
46
+ trains (`full`, `lora`), the longest sample per method, prices, GPU setups and whether one is free now.
47
+ `jobs.estimate` runs the same checks as creating the job (it raises with the reason when the job would be refused)
48
+ and returns the settings, about how many steps, and warnings: show those to the owner with the price.
49
+ 3. **Never start the same job twice.** `jobs.create` retries safely with one idempotency key. If your own process
50
+ died mid-create, pass the same `idempotency_key=` (CLI `--idempotency-key`) or check `jobs.list()` first.
51
+ 4. **Check data before uploading** (`check_file`, CLI `datasets check`) and read what the server reports after its
52
+ check (`dataset.errors`, `dataset.tokens`).
53
+ 5. **Label every job**: `name=` says what the run tests, `tags=` groups runs (a sweep tags its jobs `sweep:<name>`).
54
+ `jobs.list()` returns the whole organisation's jobs, other members' included; `jobs.list(tag=...)` finds yours.
55
+ `nextron-cloud report --tag ...` compares them.
56
+ 6. **Training and the checkpoint are separate steps.** `jobs.wait` returns when training is over; read the results
57
+ then. The checkpoint uploads afterwards (minutes to an hour by model size) and stays downloadable for 30 days:
58
+ `jobs.wait_checkpoint` / `download_checkpoint` only when the owner needs the weights.
59
+ 7. **Poll slowly** (jobs every 30 s or more) and do not leave a job unwatched without telling the owner its id.
60
+ 8. Text only: samples with images, audio or video are refused.
61
+
62
+ ## An experiment, end to end
63
+
64
+ ```python
65
+ from nextron_cloud import NexTron
66
+ from nextron_cloud.data import prepare_file
67
+
68
+ client = NexTron()
69
+
70
+ # 1. Model: pick one that trains the method and length the data needs, and is free or has a short queue.
71
+ for m in client.models():
72
+ print(m.id, {k: (v.max_seq_len, v.price_per_mtok) for k, v in m.methods.items()},
73
+ {l: (x.available, x.queued) for l, x in m.layouts.items()})
74
+
75
+ # 2. Data: convert, check, hold out a validation set, upload.
76
+ prepare_file("tickets.csv", "data", prompt_column="ticket", response_column="reply") # data/train.jsonl, data/val.jsonl
77
+ train = client.datasets.wait(client.datasets.upload("data/train.jsonl").id)
78
+ val = client.datasets.wait(client.datasets.upload("data/val.jsonl").id)
79
+ assert train.state == val.state == "ready", (train.errors, val.errors)
80
+
81
+ # 3. Cost, then the owner's yes.
82
+ draft = dict(model="qwen3.8-27b", dataset_id=train.id,
83
+ params={"train_type": "lora", "learning_rate": 1e-4, "num_train_epochs": 2, "val_dataset_id": val.id})
84
+ quote = client.jobs.estimate(**draft) # quote.credits / 100 dollars; quote.enough
85
+
86
+ # 4. Train, watch, read the results. client.jobs.progress(job.id) says at any time where it is and how long is left.
87
+ job = client.jobs.create(**draft, name="support lora lr=1e-4 2ep", tags=["support-v1"])
88
+ job = client.jobs.wait(job.id) # or: for line in client.jobs.logs(job.id, follow=True)
89
+ print(job.state, job.error, job.notices, client.jobs.metrics(job.id)[-1], client.jobs.billing(job.id).charged_credits)
90
+
91
+ # 5. Later, when the owner wants the weights (kept 30 days).
92
+ client.jobs.wait_checkpoint(job.id)
93
+ client.jobs.download_checkpoint(job.id, f"checkpoints/{job.id}")
94
+ ```
95
+
96
+ The same from the shell:
97
+
98
+ ```bash
99
+ nextron-cloud models
100
+ nextron-cloud datasets prepare tickets.csv --out-dir data --prompt-column ticket --response-column reply
101
+ nextron-cloud datasets upload data/train.jsonl # waits for the server's check
102
+ nextron-cloud jobs create --model qwen3.8-27b --dataset ds_... --param train_type=lora --param learning_rate=1e-4 \
103
+ --name "support lora" --tag support-v1
104
+ # -> prints the estimate (exit code 3); after the owner agrees, the same command with --yes
105
+ nextron-cloud jobs progress job_... # phase, queue, ETA, upload bytes
106
+ nextron-cloud jobs events job_... --follow # state changes, steps, validation, checkpoint stages
107
+ nextron-cloud sweep --name lr --model qwen3.8-27b --dataset ds_... --param train_type=lora \
108
+ --grid learning_rate=5e-5,1e-4,2e-4 # estimates; --yes starts all of them
109
+ nextron-cloud report --tag sweep:lr --table
110
+ nextron-cloud jobs wait-checkpoint job_... && nextron-cloud jobs download job_... checkpoints/job_...
111
+ ```
112
+
113
+ A first run on new data should be a small one: `max_steps: 3` on the smallest GPU setup proves the data and settings
114
+ work for a fraction of the cost. Datasets of a few thousand short samples are smaller than one training step; read
115
+ "Small datasets" in training.md before planning them.