badgr-cli 1.0.44 → 1.0.46

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.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Badgr supports many GPU workloads through two commands: `serve` for persistent endpoints, `run` for jobs.
4
4
 
5
+ > **Safety promise:** every run has `--max-cost`, live logs, automatic teardown, and a receipt. Run `badgr down <id>` any time to stop billing immediately.
6
+
5
7
  ```bash
6
8
  npm install -g badgr-cli
7
9
  ```
@@ -23,68 +25,75 @@ badgr run . --cmd "python train.py" --max-cost 5
23
25
  # 4. Serve an OpenAI-compatible inference endpoint
24
26
  badgr serve meta-llama/Llama-3.1-8B-Instruct --max-cost 10
25
27
 
26
- # 5. Use the endpoint with any OpenAI SDK client
27
- # export BADGR_ENDPOINT=<URL printed by badgr serve>
28
- # client = OpenAI(api_key=os.environ["BADGR_API_KEY"], base_url=os.environ["BADGR_ENDPOINT"])
28
+ # 5. Stop billing
29
+ badgr down <deployment-id>
29
30
 
30
- # 5. View cost, route, and retry receipts
31
+ # 6. View cost, route, and retry receipts
31
32
  badgr receipts
33
+ ```
32
34
 
33
- # 6. Stop billing
34
- badgr down <deployment-id>
35
+ `badgr serve` prints a URL you can point any OpenAI SDK client at — see [OpenAI compatibility](#openai-compatibility).
36
+
37
+ ---
38
+
39
+ ## Also try: image generation
40
+
41
+ ```bash
42
+ badgr comfyui batch --workflow sdxl-basic --prompt "a cat on a beach" --max-cost 5
35
43
  ```
36
44
 
45
+ Runs a blessed ComfyUI workflow, no setup, and prints image URLs when done. No manual teardown needed — it stops itself. Details in [`badgr comfyui batch` options](#badgr-comfyui-batch-options).
46
+
37
47
  ---
38
48
 
39
49
  ## Commands
40
50
 
51
+ ```text
52
+ login
53
+ run
54
+ serve
55
+ status
56
+ logs
57
+ down
58
+ receipts
59
+ test
60
+ ```
61
+
41
62
  | Command | What it does |
42
63
  |---------|-------------|
43
64
  | `badgr login` | Save API key to `~/.badgr/config.json` |
44
- | `badgr serve <model>` | Start a persistent OpenAI-compatible endpoint |
45
65
  | `badgr run <command>` | Run a one-off GPU job (any container command) |
66
+ | `badgr serve <model>` | Start a persistent OpenAI-compatible endpoint |
46
67
  | `badgr status` | Show what's running and what's billing |
47
- | `badgr down <id>` | Terminate a deployment — stops billing immediately |
48
68
  | `badgr logs <id>` | Fetch log output from a deployment |
69
+ | `badgr down <id>` | Terminate a deployment — stops billing immediately |
49
70
  | `badgr receipts [n]` | Cost, route, and retry receipts (default 10) |
50
- | `badgr capacity` | Check available GPU capacity right now |
51
- | `badgr billing` | Show balance and add funds |
52
71
  | `badgr test` | Run an end-to-end test (provision → run → teardown) |
53
- | `badgr workload list` | List saved workloads with run stats |
54
- | `badgr workload run <name>` | Rerun a saved workload by name or ID |
55
- | `badgr workload info <name>` | Show stats, route history, and recent jobs for a workload |
56
- | `badgr workload delete <name>` | Delete a saved workload |
57
- | `badgr workspace list` | List workspace trackers (job history + cost per context) |
58
- | `badgr workspace create <name>` | Create a workspace tracker, optionally linked to a storage path |
59
- | `badgr workspace info <name>` | Show jobs, cost, and files for a workspace |
60
- | `badgr workspace delete <name>` | Archive a workspace tracker |
72
+
73
+ More commands below, under [Advanced](#advanced): `comfyui`, `train`, `transcribe`, `embed`, `workload`, `workspace`, `capacity`, `billing`.
61
74
 
62
75
  `badgr serve` — for anything that needs a persistent endpoint: LLM serving, embeddings, image generation APIs, transcription APIs.
63
76
 
64
77
  `badgr run` — for anything that starts, runs, and exits: batch inference, fine-tuning, evals, image/video batch jobs, audio processing.
65
78
 
66
- **Shortcuts** — wrappers around `run` / `serve` for common workloads:
67
-
68
- | `badgr comfyui run <workflow.json>` | Launch ComfyUI, queue workflow, return endpoint URL |
69
- | `badgr comfyui batch --workflow ...` | Productized batch image generation — no ComfyUI setup, blessed workflow only |
70
- | `badgr train <config.yaml>` | LoRA / fine-tuning job, stream logs |
71
- | `badgr train lora --base-model ...` | Productized LoRA training — preset + dataset, no config file needed |
72
- | `badgr transcribe <audio>` | Whisper transcription, print transcript |
73
- | `badgr embed <model> <input>` | Text embeddings, output JSONL |
74
-
75
- `badgr serve --list-aliases` lists the tested vLLM model routes (`qwen-7b`, `llama-8b`, `qwen-coder-7b`) that can be used in place of a full model ID.
79
+ ---
76
80
 
77
- ### Model support levels
81
+ ## Common flags
78
82
 
79
- `badgr serve qwen-7b` is the happy path a tested route with no extra setup. `badgr serve` also accepts any other model ID or a custom container, with the CLI honest (but brief) about what that means:
83
+ These appear on most commands (`run`, `serve`, `comfyui`, `train`, `transcribe`, `embed`) documented once here instead of repeated in every table below.
80
84
 
81
- | Level | What it means |
82
- |-------|---------------|
83
- | **Tested route** (`badgr serve qwen-7b`) | One of the aliases above tested and officially supported. No extra caveats printed. |
84
- | **Best-effort Hugging Face model** (`badgr serve <org>/<model>`) | Any other Hugging Face model ID. Badgr will try a compatible route — not a guarantee every model works. |
85
- | **Custom container** (`badgr serve --image ...`) | You own the server behavior; Badgr manages runtime, logs, spend caps, teardown, and the receipt. |
85
+ | Flag | Default | Description |
86
+ |------|---------|-------------|
87
+ | `--gpu <type>` | auto | GPU type overridesee [GPU options](#gpu-options) |
88
+ | `--tier 1\|2` | 1 | `1` = reliable managed routing (default); `2` = lower-cost marketplace routing |
89
+ | `--region US\|EU\|AU` | | Region preference. If omitted, Badgr chooses best available capacity |
90
+ | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
91
+ | `--count <n>` | 1 | Number of GPUs |
92
+ | `--env KEY=VALUE` | — | Environment variable (repeatable) |
93
+ | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount — **required** for `run`, `comfyui run`, `comfyui batch`, `train lora` |
94
+ | `--detach` | off | Launch and return immediately, don't stream logs (`serve` uses `--no-wait` instead — see below) |
86
95
 
87
- Gated Hugging Face models (e.g. Llama, Gemma) may need `--env HF_TOKEN=$HF_TOKEN`. Badgr doesn't warn about this up front — it only prints the hint if the deployment actually fails to start, so tested and working launches stay short.
96
+ Each command section below lists only its own extra flags.
88
97
 
89
98
  ---
90
99
 
@@ -96,21 +105,26 @@ badgr serve meta-llama/Llama-3.1-8B-Instruct --gpu L40S --region EU
96
105
 
97
106
  | Flag | Default | Description |
98
107
  |------|---------|-------------|
99
- | `--gpu <type>` | auto | GPU type override — Badgr Auto selects based on model size if omitted |
100
108
  | `--image <img>` | — | Serve a custom container instead of a HuggingFace model |
101
109
  | `--task <task>` | — | vLLM task override, e.g. `embed` for embedding models |
102
- | `--env KEY=VALUE` | — | Environment variable (repeatable) |
103
- | `--tier 1\|2` | 1 | `1` = reliable execution (default); `2` = lower-cost burst capacity |
104
- | `--count <n>` | 1 | Number of GPUs (1–8) |
105
- | `--region US\|EU\|AU` | — | Optional region preference. If omitted, Badgr chooses best available capacity. |
106
- | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
107
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount |
108
110
  | `--health-path <path>` | auto | Readiness path to poll (auto-detected for ComfyUI → `/system_stats`) |
109
- | `--no-wait` | | Skip endpoint health check and return immediately |
111
+ | `--no-wait` | off | Skip endpoint health check and return immediately |
110
112
  | `--list-aliases` | — | List blessed vLLM model aliases (`qwen-7b`, `llama-8b`, `qwen-coder-7b`) and exit — no provisioning, no API key required |
111
113
 
112
114
  Blessed aliases expand to a full model ID + preset GPU, e.g. `badgr serve qwen-7b` → `Qwen/Qwen2.5-7B-Instruct` on an RTX 4090. Run `badgr serve --list-aliases` to see the current list.
113
115
 
116
+ ### Model support levels
117
+
118
+ `badgr serve qwen-7b` is the happy path — a tested route with no extra setup. `badgr serve` also accepts any other model ID or a custom container:
119
+
120
+ | Level | What it means |
121
+ |-------|---------------|
122
+ | **Tested route** (`badgr serve qwen-7b`) | One of the aliases above — tested and officially supported. |
123
+ | **Best-effort Hugging Face model** (`badgr serve <org>/<model>`) | Any other Hugging Face model ID. Badgr will try a compatible route — not a guarantee every model works. |
124
+ | **Custom container** (`badgr serve --image ...`) | You own the server behavior; Badgr manages runtime, logs, spend caps, teardown, and the receipt. |
125
+
126
+ Gated Hugging Face models (e.g. Llama, Gemma) may need `--env HF_TOKEN=$HF_TOKEN`. Badgr only prints that hint if the deployment actually fails to start.
127
+
114
128
  ---
115
129
 
116
130
  ## `badgr run` options
@@ -133,18 +147,26 @@ Badgr zips and uploads the folder (Flow 1) or clones the repo (Flow 2), picks a
133
147
  | Flag | Default | Description |
134
148
  |------|---------|-------------|
135
149
  | `--cmd <command>` | — | Command to run inside the uploaded project or cloned repo (required for folder/GitHub flows) |
136
- | `--gpu <type>` | auto | GPU type override — Badgr Auto selects if omitted |
137
150
  | `--min-vram <GB>` | — | Minimum VRAM in GB — optional constraint for Auto routing |
138
- | `--image <img>` | — | Custom Docker image — bypasses the runner. Mutually exclusive with workspace auto-detection. |
139
- | `--env KEY=VALUE` | — | Environment variable (repeatable) |
140
- | `--tier 1\|2` | 1 | `1` = reliable execution (default); `2` = lower-cost burst capacity |
141
- | `--count <n>` | 1 | Number of GPUs |
142
- | `--region US\|EU\|AU` | — | Optional region preference. If omitted, Badgr chooses best available capacity. |
143
- | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
151
+ | `--image <img>` | — | Custom Docker image — bypasses the runner |
144
152
  | `--max-runtime <min>` | — | Auto-stop after N minutes |
145
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount (required) |
146
- | `--detach` | — | Launch and return immediately, don't stream logs |
147
153
  | `--save <name>` | — | Save this job as a named workload after it completes |
154
+ | `--workspace <name-or-id>` | — | Link this run to a workspace (name or `ws_` ID) |
155
+ | `--output <path>` | — | See "Crash recovery" below |
156
+ | `--checkpoint <path>` | — | See "Crash recovery" below |
157
+ | `--retry-safe` | off | See "Crash recovery" below |
158
+ | `--resume-cmd "<cmd>"` | — | See "Crash recovery" below |
159
+
160
+ **Crash recovery is a convention, not a feature Badgr runs for you.** Badgr just passes these through into the container as environment variables — *your* script has to read them and actually write the files:
161
+
162
+ | Flag | Container sees | Your script needs to |
163
+ |------|-----------------|-----------------------|
164
+ | `--output <path>` | `BADGR_OUTPUT_DIR=<path>` | Write outputs it wants preserved to that path |
165
+ | `--checkpoint <path>` | `BADGR_CHECKPOINT_DIR=<path>` | Write/read resumable checkpoints at that path |
166
+ | `--retry-safe` | `BADGR_RETRY_SAFE=1` | Confirm it's safe to re-run from scratch (e.g. it checkpoints/dedupes internally) |
167
+ | `--resume-cmd "<cmd>"` | *(not passed to the container)* | Nothing — Badgr just prints this command back to you on failure, so you have it without digging through shell history |
168
+
169
+ On failure, `badgr run` / `badgr serve` / `badgr comfyui run` all print a `Class:`/`Next:` pair identifying what went wrong (e.g. `out_of_memory`, `image_pull_failed`, `cuda_unavailable`) and a suggested next step.
148
170
 
149
171
  ---
150
172
 
@@ -159,16 +181,10 @@ Requires either `--max-cost` or `--persistent` to prevent runaway billing.
159
181
 
160
182
  | Flag | Default | Description |
161
183
  |------|---------|-------------|
162
- | `--gpu <type>` | auto (16+ GB VRAM) | GPU type override |
163
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount |
164
- | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
165
- | `--tier 1\|2` | 1 | Provider tier |
166
- | `--region US\|EU\|AU` | — | Region preference |
167
184
  | `--check-nodes <n1,n2>` | — | Verify custom nodes are installed after startup |
168
- | `--no-wait` | | Skip health check, return immediately |
169
- | `--persistent` | | Run until manually stopped (no spending cap) |
170
- | `--env KEY=VALUE` | | Environment variable (repeatable) |
171
- | `--yes` / `-y` | — | Skip duplicate-deployment warning |
185
+ | `--no-wait` | off | Skip health check, return immediately |
186
+ | `--persistent` | off | Run until manually stopped (no spending cap) |
187
+ | `--yes` / `-y` | off | Skip duplicate-deployment warning |
172
188
 
173
189
  ---
174
190
 
@@ -188,253 +204,175 @@ Blessed workflows: `sdxl-basic` (SDXL text-to-image, default sampler settings).
188
204
  | `--workflow <name>` | — | Blessed workflow ID (required) — currently `sdxl-basic` |
189
205
  | `--prompts <file>` | — | Text file, one prompt per line |
190
206
  | `--prompt <text>` | — | Inline prompt (repeatable) — combine with `--prompts` if needed |
191
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount (required unless `--dry-run`) |
192
207
  | `--max-runtime <min>` | 60 | Auto-stop after N minutes |
193
208
  | `--gpu-type <type>` | workflow default | GPU type override |
194
- | `--tier 1\|2` | 1 | Provider tier |
195
209
  | `--dry-run` | — | Preview the batch (workflow, GPU, prompt count, cost) without provisioning |
196
210
 
197
211
  Polls until complete and prints image URLs, or detaches with `badgr status` guidance if it outlives `--max-runtime`.
198
212
 
199
213
  ---
200
214
 
201
- ## `badgr train` options
202
-
203
- ```bash
204
- badgr train config.yaml --gpu A100 --max-runtime 240 --env HF_TOKEN=$HF_TOKEN
205
- ```
206
-
207
- Detects framework (axolotl, unsloth, trl) from config content, but **only Axolotl configs run today** — the container command for `unsloth`/`trl`/unrecognized configs isn't wired up yet, so `badgr train` blocks before provisioning rather than billing a GPU that's guaranteed to fail. Use `--framework axolotl` to force it, or use `badgr train lora` for a config-free productized path. Default max-runtime is 120 min.
208
-
209
- | Flag | Default | Description |
210
- |------|---------|-------------|
211
- | `--gpu <type>` | auto (40+ GB VRAM preferred) | GPU type override |
212
- | `--max-runtime <min>` | 120 | Auto-stop after N minutes |
213
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount |
214
- | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
215
- | `--tier 1\|2` | 1 | Provider tier |
216
- | `--region US\|EU\|AU` | — | Region preference |
217
- | `--framework <name>` | auto-detect | Force framework: `axolotl`, `unsloth`, `trl` (only `axolotl` currently runs) |
218
- | `--env KEY=VALUE` | — | Environment variable (repeatable) |
219
- | `--detach` | — | Launch and return immediately, don't stream logs |
220
-
221
- ---
222
-
223
- ## `badgr train lora` options
215
+ ## Receipts
224
216
 
225
- Productized LoRA training — pass a base model and dataset, no Axolotl config file needed. Badgr generates the config from a preset and returns a downloadable adapter.
217
+ Every `badgr serve` and `badgr run` action generates a receipt:
226
218
 
227
219
  ```bash
228
- badgr train lora --base-model mistralai/Mistral-7B-v0.1 --dataset ./train.jsonl --preset small --max-cost 20
229
- badgr train lora --base-model meta-llama/Llama-3.1-8B-Instruct --dataset https://example.com/data.jsonl --preset medium --max-cost 40
220
+ badgr receipts # last 10
221
+ badgr receipts 50 # last 50
230
222
  ```
231
223
 
232
- Dataset sources: local file (uploaded first), direct URL (`https://`, `s3://`), or `--file-id` from a prior `badgr` upload.
233
-
234
- | Flag | Default | Description |
235
- |------|---------|-------------|
236
- | `--base-model <id>` | — | HuggingFace model ID (required) — validated to exist before provisioning |
237
- | `--dataset <path\|url>` | — | Local file, direct URL, or `s3://` URI |
238
- | `--file-id <id>` | — | Badgr upload ID instead of `--dataset` |
239
- | `--preset small\|medium` | `small` | Training profile — see below |
240
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount (required unless `--dry-run`) |
241
- | `--max-runtime <min>` | 240 | Auto-stop after N minutes |
242
- | `--gpu-type <type>` | preset default | GPU type override |
243
- | `--tier 1\|2` | 1 | Provider tier |
244
- | `--dry-run` | — | Preview the job (preset, GPU, rank, epochs, cost) without provisioning |
245
-
246
- **Presets:**
224
+ Each receipt includes runtime, estimated/settled cost, status, retries, teardown/billing result, and job/deployment ID.
247
225
 
248
- | Preset | GPU | LoRA rank | Epochs | Best for |
249
- |--------|-----|-----------|--------|----------|
250
- | `small` (default) | RTX 4090 | 16 | 3 | Fast, low-cost — good default for most datasets |
251
- | `medium` | A100 | 32 | 5 | Larger rank/more epochs — bigger datasets or higher quality |
226
+ ---
252
227
 
253
- On completion, prints an `adapter_url` — download with `GET /v1/jobs/{job_id}/adapter`, or via `badgr workload info` if saved.
228
+ ## OpenAI compatibility
254
229
 
255
- ---
230
+ `badgr serve` provisions a vLLM endpoint that is fully OpenAI-compatible:
256
231
 
257
- ## `badgr transcribe` options
232
+ ```python
233
+ import os
234
+ from openai import OpenAI
258
235
 
259
- ```bash
260
- badgr transcribe recording.mp3 --max-cost 2
261
- badgr transcribe s3://bucket/meeting.mp3 --model large-v3 --language en
236
+ # Export BADGR_ENDPOINT from the URL printed by `badgr serve`
237
+ client = OpenAI(
238
+ api_key=os.environ["BADGR_API_KEY"],
239
+ base_url=os.environ["BADGR_ENDPOINT"],
240
+ )
241
+ resp = client.chat.completions.create(
242
+ model="meta-llama/Llama-3.1-8B-Instruct",
243
+ messages=[{"role": "user", "content": "Hello"}],
244
+ )
262
245
  ```
263
246
 
264
- Accepts a public URL, S3/GCS URI, or a local file under 50 MB. Default max-runtime is 30 min.
265
-
266
- | Flag | Default | Description |
267
- |------|---------|-------------|
268
- | `--model <name>` | `large-v3` | Whisper model |
269
- | `--gpu <type>` | auto (8+ GB VRAM) | GPU type override |
270
- | `--language <code>` | — | Language hint (e.g. `en`, `fr`) |
271
- | `--output <format>` | — | Output format: `txt`, `srt`, `vtt` |
272
- | `--max-runtime <min>` | 30 | Auto-stop after N minutes |
273
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount |
274
- | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
275
- | `--tier 1\|2` | 1 | Provider tier |
276
- | `--region US\|EU\|AU` | — | Region preference |
277
- | `--env KEY=VALUE` | — | Environment variable (repeatable) |
278
- | `--detach` | — | Launch and return immediately, don't stream logs |
247
+ ```js
248
+ import OpenAI from "openai";
249
+ const client = new OpenAI({
250
+ apiKey: process.env.BADGR_API_KEY,
251
+ baseURL: process.env.BADGR_ENDPOINT, // URL printed by `badgr serve`
252
+ });
253
+ ```
279
254
 
280
255
  ---
281
256
 
282
- ## `badgr embed` options
257
+ ## GPU options
283
258
 
284
- ```bash
285
- badgr embed BAAI/bge-large-en-v1.5 documents.txt --max-cost 2
286
- badgr embed BAAI/bge-large-en-v1.5 s3://bucket/corpus.jsonl
287
- badgr embed documents.txt # uses default model
288
- ```
259
+ Badgr Auto selects the best eligible GPU for your workload. Add `--gpu <type>` or `--min-vram <GB>` only when you need more control.
289
260
 
290
- Accepts a public URL, S3/GCS URI, or a local text file under 10 MB. Outputs JSONL (`{"text": ..., "embedding": [...]}`). Default max-runtime is 30 min.
261
+ | Flag value | GPU | VRAM | Best for |
262
+ |-----------|-----|------|---------|
263
+ | RTX_3090 | NVIDIA RTX 3090 | 24 GB | Dev, inference |
264
+ | RTX_4090 | NVIDIA RTX 4090 | 24 GB | Inference, training, dev |
265
+ | L40S | NVIDIA L40S | 48 GB | Inference, vLLM, embeddings |
266
+ | A100 | NVIDIA A100 | 40–80 GB | Training, inference |
267
+ | H100 | NVIDIA H100 | 80 GB | Large model training |
291
268
 
292
- | Flag | Default | Description |
293
- |------|---------|-------------|
294
- | `--gpu <type>` | auto (8+ GB VRAM) | GPU type override |
295
- | `--batch-size <n>` | — | Embedding batch size |
296
- | `--max-runtime <min>` | 30 | Auto-stop after N minutes |
297
- | `--max-cost <$>` | — | Auto-stop when total spend reaches this amount |
298
- | `--max-price <$/hr>` | — | Hard spend cap per GPU-hour |
299
- | `--tier 1\|2` | 1 | Provider tier |
300
- | `--region US\|EU\|AU` | — | Region preference |
301
- | `--env KEY=VALUE` | — | Environment variable (repeatable) |
302
- | `--detach` | — | Launch and return immediately, don't stream logs |
269
+ Additional GPU types may be routable depending on current capacity — check with `badgr capacity`. Pricing is confirmed before provisioning; use `--dry-run` to see it first. Full GPU support details: see [NOTES.md](../../NOTES.md#gpu-support) in the repo root.
303
270
 
304
271
  ---
305
272
 
306
- ## Workloads
273
+ ## Routing
307
274
 
308
- A workload is a saved job configuration. Once saved, you can rerun it by name instead of retyping all the flags. Badgr tracks success rate, average cost, average runtime, and the last known-good route so reruns are faster and cheaper over time.
275
+ `--tier 1` (default) uses managed provider routing reliable, consistent performance. `--tier 2` uses marketplace routing for lower-cost options. Most users should stick with the default.
309
276
 
310
- **Save a workload** by adding `--save <name>` to any `badgr run` call:
277
+ Preview any command before provisioning with `--dry-run`, e.g.:
311
278
 
312
279
  ```bash
313
- badgr run . --cmd "python train.py" --gpu A100 --env HF_TOKEN=$HF_TOKEN --max-cost 10 --save my-training-job
280
+ badgr serve meta-llama/Llama-3.1-8B-Instruct --dry-run
314
281
  ```
315
282
 
316
- **Rerun a saved workload:**
283
+ ---
317
284
 
318
- ```bash
319
- badgr workload run my-training-job
320
- badgr workload run my-training-job --max-cost 5 # override spend cap
321
- badgr workload run my-training-job --set HF_TOKEN=newval # override an env var
322
- ```
285
+ ## Advanced
286
+
287
+ Less common commands — training, transcription, embeddings, and the workload/workspace trackers. Same flags as `run`/`serve` unless noted (see [Common flags](#common-flags)).
323
288
 
324
- **Inspect and manage workloads:**
289
+ ### `badgr train` / `badgr train lora`
325
290
 
326
291
  ```bash
327
- badgr workload list # list all saved workloads with stats
328
- badgr workload info my-training-job # stats, route history, recent jobs
329
- badgr workload delete my-training-job
292
+ badgr train config.yaml --gpu A100 --max-runtime 240 --env HF_TOKEN=$HF_TOKEN
330
293
  ```
331
294
 
332
- | `badgr workload run` flag | Description |
333
- |---|---|
334
- | `--max-cost <$>` | Override the saved spend cap for this run |
335
- | `--max-runtime <min>` | Override the saved runtime limit for this run |
336
- | `--set KEY=VALUE` | Override a saved config value for this run (repeatable) |
337
-
338
- ---
339
-
340
- ## Workspaces
341
-
342
- Workspaces are an advanced infrastructure concept — most users never need to manage them directly. When you run `badgr run .`, Badgr handles code upload, dependency caching, and artifact storage automatically. Workspaces are only needed when you want to group jobs under a named context for cost tracking, or link jobs to persistent S3/GCS storage.
295
+ Detects framework (axolotl, unsloth, trl) from the config file, but **only Axolotl configs run today** — `unsloth`/`trl`/unrecognized configs are blocked before provisioning rather than billing a GPU that's guaranteed to fail. Default max-runtime is 120 min.
343
296
 
344
297
  ```bash
345
- badgr workspace create my-project --storage s3://my-bucket/runs --desc "nightly evals"
346
- badgr run . --cmd "python eval.py" --workspace my-project --max-cost 5
347
- badgr workspace info my-project # jobs, total cost, files
348
- badgr workspace list
349
- badgr workspace delete my-project
298
+ badgr train lora --base-model mistralai/Mistral-7B-v0.1 --dataset ./train.jsonl --preset small --max-cost 20
350
299
  ```
351
300
 
352
- | `badgr workspace create` flag | Description |
353
- |---|---|
354
- | `--storage <path>` | S3/GCS path to associate with this workspace |
355
- | `--desc <text>` | Optional description |
356
-
357
- ---
358
-
359
- ## Routing
360
-
361
- Badgr Auto selects the best eligible route based on GPU type, VRAM, availability, region, workload requirements, and reliability. Advanced users can optionally choose an execution tier or hardware constraint.
362
-
363
- Most users should use the default Badgr Auto route. Tiers are an optional advanced control.
301
+ Productized LoRA training pass a base model and dataset, no Axolotl config file needed. Badgr generates the config from a preset and returns a downloadable adapter.
364
302
 
365
- **Tier 1** (default) Reliable execution. Best for production workloads, model serving, and jobs where startup reliability matters most. Uses managed routing, readiness checks, fallback, and teardown controls.
303
+ | Flag | Default | Description |
304
+ |------|---------|-------------|
305
+ | `--framework <name>` | auto-detect | Force framework: `axolotl`, `unsloth`, `trl` (only `axolotl` currently runs) |
306
+ | `--base-model <id>` | — | HuggingFace model ID (required for `train lora`) — validated to exist before provisioning |
307
+ | `--dataset <path\|url>` | — | Local file, direct URL, or `s3://` URI |
308
+ | `--file-id <id>` | — | Badgr upload ID instead of `--dataset` |
309
+ | `--preset small\|medium` | `small` | `small` = RTX 4090, rank 16, 3 epochs. `medium` = A100, rank 32, 5 epochs |
310
+ | `--gpu-type <type>` | preset default | GPU type override for `train lora` |
311
+ | `--dry-run` | — | Preview the job without provisioning |
366
312
 
367
- **Tier 2** Lower-cost burst execution. An optional advanced control for cost-sensitive workloads. Availability may vary.
313
+ On completion, `train lora` prints an `adapter_url` download with `GET /v1/jobs/{job_id}/adapter`, or via `badgr workload info` if saved.
368
314
 
369
- Preview before provisioning:
315
+ ### `badgr transcribe`
370
316
 
371
317
  ```bash
372
- badgr serve meta-llama/Llama-3.1-8B-Instruct --dry-run
318
+ badgr transcribe recording.mp3 --max-cost 2
373
319
  ```
374
320
 
375
- ---
321
+ Whisper transcription. Accepts a public URL, S3/GCS URI, or a local file under 50 MB. Default max-runtime is 30 min.
376
322
 
377
- ## Receipts
323
+ | Flag | Default | Description |
324
+ |------|---------|-------------|
325
+ | `--model <name>` | `large-v3` | Whisper model |
326
+ | `--language <code>` | — | Language hint (e.g. `en`, `fr`) |
327
+ | `--output <format>` | — | Output format: `txt`, `srt`, `vtt` |
378
328
 
379
- Every `badgr serve` and `badgr run` action generates a receipt:
329
+ ### `badgr embed`
380
330
 
381
331
  ```bash
382
- badgr receipts # last 10
383
- badgr receipts 50 # last 50
332
+ badgr embed BAAI/bge-large-en-v1.5 documents.txt --max-cost 2
384
333
  ```
385
334
 
386
- Each receipt includes: receipt ID, GPU type, provisioning latency, price/hr, retry count, and status.
387
-
388
- ---
335
+ Text embeddings via vLLM. Accepts a public URL, S3/GCS URI, or a local text file under 10 MB. Outputs JSONL (`{"text": ..., "embedding": [...]}`). Default max-runtime is 30 min.
389
336
 
390
- ## OpenAI compatibility
337
+ | Flag | Default | Description |
338
+ |------|---------|-------------|
339
+ | `--batch-size <n>` | — | Embedding batch size |
391
340
 
392
- `badgr serve` provisions a vLLM endpoint that is fully OpenAI-compatible:
341
+ ### Workloads
393
342
 
394
- ```python
395
- import os
396
- from openai import OpenAI
397
-
398
- # Export BADGR_ENDPOINT from the URL printed by `badgr serve`
399
- client = OpenAI(
400
- api_key=os.environ["BADGR_API_KEY"],
401
- base_url=os.environ["BADGR_ENDPOINT"],
402
- )
403
- resp = client.chat.completions.create(
404
- model="meta-llama/Llama-3.1-8B-Instruct",
405
- messages=[{"role": "user", "content": "Hello"}],
406
- )
407
- ```
343
+ A workload is a saved job configuration, created with `--save <name>` on `badgr run`. Rerun by name instead of retyping all the flags; Badgr tracks success rate, average cost, and the last known-good route.
408
344
 
409
- ```js
410
- import OpenAI from "openai";
411
- const client = new OpenAI({
412
- apiKey: process.env.BADGR_API_KEY,
413
- baseURL: process.env.BADGR_ENDPOINT, // URL printed by `badgr serve`
414
- });
345
+ ```bash
346
+ badgr run . --cmd "python train.py" --max-cost 10 --save my-training-job
347
+ badgr workload run my-training-job
348
+ badgr workload list
349
+ badgr workload info my-training-job
350
+ badgr workload delete my-training-job
415
351
  ```
416
352
 
417
- ---
353
+ | Subcommand | Description |
354
+ |------------|-------------|
355
+ | `list [n]` | List saved workloads |
356
+ | `info <name>` | Stats, route history, recent jobs |
357
+ | `run <name>` | Submit a new job using the workload's saved config (`--max-cost`, `--max-runtime`, `--set KEY=VALUE` to override) |
358
+ | `delete <name>` | Delete the workload record |
418
359
 
419
- ## GPU options
360
+ ### Workspaces
420
361
 
421
- Badgr Auto selects the best eligible GPU for your workload. Add `--gpu <type>` or `--min-vram <GB>` only when you need more control.
422
-
423
- Available GPU types may vary by region and current capacity. Run `badgr capacity` or use `--dry-run` to confirm availability before provisioning.
362
+ Most users never need this `badgr run .` handles upload, caching, and artifact storage automatically. Workspaces are for grouping jobs under a named cost/context bucket, optionally linked to S3/GCS storage.
424
363
 
425
- | Flag value | GPU | VRAM | Best for |
426
- |-----------|-----|------|---------|
427
- | RTX_3090 | NVIDIA RTX 3090 | 24 GB | Dev, inference |
428
- | RTX_4090 | NVIDIA RTX 4090 | 24 GB | Inference, training, dev |
429
- | L40S | NVIDIA L40S | 48 GB | Inference, vLLM, embeddings |
430
- | A100 | NVIDIA A100 | 40–80 GB | Training, inference |
431
- | H100 | NVIDIA H100 | 80 GB | Large model training |
432
-
433
- Additional GPU types may be routable depending on current capacity — check with `badgr capacity`.
364
+ ```bash
365
+ badgr workspace create my-project --storage s3://my-bucket/runs --desc "nightly evals"
366
+ badgr run . --cmd "python eval.py" --workspace my-project --max-cost 5
367
+ badgr workspace info my-project
368
+ badgr workspace list
369
+ badgr workspace delete my-project
370
+ ```
434
371
 
435
- Pricing is confirmed before provisioning. Use `--dry-run` to see pricing before committing.
372
+ ### Other commands
436
373
 
437
- Full GPU support details: see [NOTES.md](../../NOTES.md#gpu-support) in the repo root.
374
+ - `badgr capacity [--gpu <type>]` check available GPU capacity right now
375
+ - `badgr billing status` / `badgr billing add <amount>` — check balance / add funds
438
376
 
439
377
  ---
440
378
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badgr-cli",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "Badgr — run or serve GPU workloads from one command",
5
5
  "type": "module",
6
6
  "bin": {
package/src/api.js CHANGED
@@ -168,6 +168,24 @@ export async function terminateDeployment(config, deploymentId) {
168
168
  throw lastErr;
169
169
  }
170
170
 
171
+ export function restartDeployment(config, deploymentId) {
172
+ return callApi(`/deployments/${deploymentId}/restart`, {
173
+ method: 'POST',
174
+ apiKey: config.apiKey,
175
+ baseUrl: config.baseUrl,
176
+ timeoutMs: 30_000,
177
+ });
178
+ }
179
+
180
+ export function heartbeatDeployment(config, deploymentId) {
181
+ return callApi(`/deployments/${deploymentId}/heartbeat`, {
182
+ method: 'POST',
183
+ apiKey: config.apiKey,
184
+ baseUrl: config.baseUrl,
185
+ timeoutMs: 10_000,
186
+ });
187
+ }
188
+
171
189
  export function getDeploymentLogs(config, deploymentId) {
172
190
  return callApi(`/deployments/${deploymentId}/logs`, {
173
191
  apiKey: config.apiKey,