Skip to main content

createTrainer

createTrainer returns a Trainer object with start / wait / cancel methods (see Trainer control). The function does not run client-side validation on TrainerInput: TypeScript checks the typed fields at compile time, and the rest is forwarded to the cloud-api when start() runs. Bad values surface as backend errors during the run, not as client-side throws at construction.

Signature

The full TrainerInput shape is described under Parameters below; the returned Trainer is documented on the Trainer control page. The second context argument is annotated @internal and is reserved for tests and advanced overrides. TrainerInternalContext is not exported from arkor because the shape is unstable; its known fields (reconnectDelayMs, maxReconnectDelayMs, maxReconnectAttempts) are documented under Trainer control > Reconnects.

Required fields

Typed optional fields

These have first-class TypeScript types and are safe to use:

LoraConfig

Omit lora entirely to take the backend defaults. r: 16, alpha: 16 is the starting point the bundled templates use.

dryRun

dryRun: true tells the backend to truncate the dataset and cap the number of steps so the run finishes in a couple of minutes while still exercising every stage of the pipeline (data load, chat-template render, training loop, checkpoint upload, event stream). It still uses GPU time, just much less of it. Useful in CI or when wiring up callbacks for the first time, not as a way to avoid spend entirely.

Advanced: forwarded fields

These are typed as unknown and forwarded to the cloud API verbatim (packages/arkor/src/core/trainer.ts:100-108). They are reserved on the input shape so the SDK can support fields the backend exposes before the SDK has caught up with first-class typing. These fields are explicitly not stable: the backend contract for them can change between releases, and there is no compile-time check on the value you pass. Prefer the typed fields above; reach for these only when nothing else covers what you need.

Roadmap

  • Multi-trainer projects. createArkor accepts a single trainer; there is no array form. To register a second trainer, you would either swap the export at runtime or wait for the API to gain that shape.

See also