Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements local training and inference for ENG-1065:
arkor start --localandarkor dev --localrun the whole loop on an Apple Silicon Mac via MLX, with no cloud account and nothing leaving the machine except model/dataset downloads.Architecture
@arkor/local(lockstep-versioned, ~60 KB tarball). Users opt in withpnpm add -D @arkor/local; thearkorpackage gains zero runtime dependencies and stays cloud-lean. The CLI resolves the runtime from the user's project (same resolution model as the build artifact resolvingarkor) with a protocol-version handshake that turns incompatible pairings into actionable upgrade errors.POST/GET /v1/jobs, cancel, the SSE event stream, andPOST /v1/inference/chat. Because the contract matches,trainer.wait(), the Studio jobs list, the live loss chart, and the Playground work unchanged..arkor/local/jobs/<id>/: append-onlyevents.jsonlwith per-job monotonic sequence ids (trueLast-Event-IDreplay across restarts), atomicjob.jsonwrites, size-capped console capture, and pid-guarded orphan reconciliation on boot.LocalTrainingBackendinterface (preflight, config validation, run/inference spec building) behind a registry. All platform knowledge lives in each backend'spreflight; a future CUDA or ROCm backend is onebackends/<id>.ts, one Python shim speaking the same JSON-line protocol, and one registry entry.uv run --with "mlx-lm[train]==0.31.3"): prepares datasets (HuggingFace or blob URL; chatml/sharegpt/alpaca/text/prompt_completion with columnMapping; automatic validation holdout), drives mlx-lm LoRA fine-tuning through itsTrainingCallback, normalises checkpoints intoadapters/step-<N>/andadapters/final/, and reports structured progress as@arkor-marked JSON lines (non-finite floats sanitised).mlx_lm serverchild keyed by (model, adapter), with readiness polling, in-flight refcounting (idle shutdown never kills a mid-download or mid-generation child), crash respawn, and streaming passthrough.onCheckpoint.infer()and the Playground work against trained adapters.~/.arkor/credentials.json, never bootstraps projects, and ignores.arkor/state.json, so a local run can never poison later cloud use.CI
local-training-smoke.yaml: runs on every push and pull request (plus nightly and manual dispatch) onmacos-15(Apple Silicon), training SmolLM2-135M-Instruct for 4 real steps through the full stack and asserting on events, adapter artifacts, and checkpoint inference.arkor-localcoverage and test results under their own flags.Testing
@arkor/local(fake Node children for every process seam), plus local-mode suites inarkor(trainer bypass with fs spies proving zero~/.arkoraccess, Studio proxy repointing, loader handshake).arkor start --localend-to-end through the real bin with a fakeuv(Apple Silicon CI leg; the not-installed error path runs on every OS), and a Playwright spec drivingarkor dev --localin Chromium against an unroutable cloud URL.format:check.Docs
local-training.mdxadded on both axes and both languages with nav registration;dev/build-and-start/ overview / models / roadmap / quickstart updated (EN + JA in this PR).Deliberately not implemented (documented)
Deployments/endpoints locally,
tools/responseFormat/structuredOutputs/embeddings in local inference,pretokenizeddatasets, Playground free-text base-model UI, and the CUDA/ROCm backend bodies (seams only).Summary by cubic
Implements ENG-1065 by adding opt-in local MLX training and inference through
@arkor/local. Training was previously cloud-only;arkor start --localandarkor dev --localnow run the full loop on Apple Silicon while cloud behavior remains unchanged.New Features
@arkor/localfrom the project with protocol checks and actionable install or upgrade errors..arkor/local/; startup reconciliation skips unreadable job dirs instead of aborting the launch.mlx-lmLoRA training throughuv(--no-config --no-projectso user config can't break it), including dataset preparation, progress events, checkpoints, and arbitrary Hugging Face model IDs.--localand--backend <id>through the CLI and Studio; local mode skips cloud credentials and supports job cancellation.@arkor/localin lockstep and adds Apple Silicon CI and real MLX smoke coverage.Migration
uvonPATH, and@arkor/localinstalled withpnpm add -D @arkor/local@alpha.http://127.0.0.1:<port>and stores models, datasets, logs, and adapters locally; only downloads leave the machine.Written for commit 344c511. Summary will update on new commits.
Summary by CodeRabbit
New Features
@arkor/local.arkor start --localandarkor dev --local, with backend selection and Studio integration.Bug Fixes
Documentation