本文へ移動
cccskills
無料GitHub で公開

tinker-training-inference

Train and run models on Tinker (Thinking Machines) — LoRA and full fine-tuning, SFT with correct loss masking, RL/RFT with group-relative advantages and importance sampling, agentic RL over multi-turn tool-using agents, inference via the SamplingClient or the OpenAI-compatible endpoint, checkpoint management and export, every hyperparameter, and cost estimation from the live price table. Use this skill whenever the user mentions Tinker, tinker://, TINKER_API_KEY, console.tinker.ai, or the tinker CLI; wants to fine-tune, SFT, RFT, or RL a model on Tinker; asks about Tinker models, context windows, LoRA rank, sampling params, loss functions (cross_entropy, importance_sampling, ppo, cispo, dro), Datum construction, forward_backward or optim_step; wants to sample from, download, resume, merge, or export a Tinker checkpoint; or asks what a Tinker run will cost. Whenever Tinker work is initialized in a project, this skill also creates a TINKER_PRICING.md there so prices sit next to the training code. Reach for it even on vague asks like "train a model on this data" or "get inference working" when Tinker is the platform in play.

インストール方法を見る

含まれるファイル(17)

  • SKILL.md8.4 KB
  • assets/TINKER_PRICING.md5.3 KB
  • references/agentic-rl.md6.6 KB
  • references/chat-templates.md5.6 KB
  • references/checkpoints.md5.1 KB
  • references/hyperparameters.md6.8 KB
  • references/inference.md5.5 KB
  • references/pricing.md6.1 KB
  • references/reference-implementation.md4.5 KB
  • references/setup.md5.3 KB
  • references/training-rl.md6.7 KB
  • references/training-sft.md6.2 KB
  • references/troubleshooting.md6.3 KB
  • scripts/tinker_infer.py5.3 KB
  • scripts/tinker_pricing.py16.0 KB
  • scripts/tinker_rl.py9.9 KB
  • scripts/tinker_sft.py9.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Tinker: training and inference

Tinker gives you token-level control of hosted fine-tuning: you build the Datums, you own the chat template, you hold the exact prompt and completion token ids on both sides. That is the reason to use it — a training run stays auditable, because the tokens the policy was updated on are tokens you can point at — and it is also why there is more to get right than with a hosted fine-tuning button. This skill is the map.

Do this first, in any new Tinker project

Create the pricing file. Prices next to the training script get read before a 550B RL run is launched; prices in a browser tab do not.

python <skill>/scripts/tinker_pricing.py init --out <project dir>

That writes TINKER_PRICING.md — the full catalogue, what each operation meters, and the pre-launch checklist. It is a snapshot: verify against the live catalogue at https://tinker-docs.thinkingmachines.ai/tinker/models/, and regenerate with --force when it moves. Then:

export TINKER_API_KEY="..."          # console.tinker.ai
uv pip install tinker

Where to go

you want toread
get set up, pick a model, avoid the context-window trapreferences/setup.md
supervised fine-tuningreferences/training-sft.md
RL / RFT on single-turn tasksreferences/training-rl.md
RL over a multi-turn tool-using agentreferences/agentic-rl.md
sample from a checkpoint (SDK or OpenAI-compatible HTTP)references/inference.md
save, resume, download, merge, export checkpointsreferences/checkpoints.md
every knob and what it costs to get wrongreferences/hyperparameters.md
render prompts, tool schemas, parse completionsreferences/chat-templates.md
the price table and run-cost estimationreferences/pricing.md
an error, or a run that is silently wrongreferences/troubleshooting.md
working code at full scalereferences/reference-implementation.md

Runnable templates

Copy into the project and replace the marked function:

scriptreplace
scripts/tinker_sft.pyload_dataset() — everything else (Datum construction, loss masking, before/after eval, checkpointing) is the part that is easy to get subtly wrong
scripts/tinker_rl.pyTASKS, render_prompt(), reward()
scripts/tinker_infer.pynothing — CLI, both the SDK and HTTP routes
scripts/tinker_pricing.pynothing — catalogue, init, and the cost estimator

The API in one screen

import tinker
from tinker import types

service_client  = tinker.ServiceClient()                      # reads TINKER_API_KEY
training_client = service_client.create_lora_training_client(
    base_model="Qwen/Qwen3-8B", rank=32)
tokenizer = training_client.get_tokenizer()

# SFT ---------------------------------------------------------------------
result = training_client.forward_backward(batch, loss_fn="cross_entropy").result()
training_client.optim_step(types.AdamParams(learning_rate=1e-4)).result()

# RL ----------------------------------------------------------------------
sampler = training_client.save_weights_and_get_sampling_client(name=f"iter-{it}")
resp = sampler.sample(prompt=types.ModelInput.from_ints(prompt_tokens),
                      num_samples=8,
                      sampling_params=types.SamplingParams(
                          max_tokens=4096, temperature=1.0,
                          stop=STOP_STRINGS, seed=seed)).result()
training_client.forward_backward(rl_data, loss_fn="importance_sampling").result()
training_client.optim_step(types.AdamParams(learning_rate=1e-4)).result()

# checkpoints -------------------------------------------------------------
training_client.save_state(name="iter-40")               # -> weights/…  resumable
training_client.save_weights_for_sampler(name="final")   # -> sampler_weights/…  servable

Every call returns a future; .result() blocks, and an _async variant exists for each. Loss functions: cross_entropy (SFT), importance_sampling (RL default), ppo, cispo, dro, or your own via forward_backward_custom_async.

Things that are true and easy to miss

Two checkpoint types, not interchangeable. save_weights_for_sampler → sampler_weights/… is servable and downloadable. save_state → weights/… carries optimizer state and is for resuming. The download endpoint rejects the latter with a 400. Save both.

The context window is part of the model id. openai/gpt-oss-120b is 32K; openai/gpt-oss-120b:peft:131072 is a different model at 128K and ~2.4× the prefill price. Assert your configured window against get_server_capabilities() at startup — configured above the served limit means episodes die on BadRequestError mid-run, and they die in whichever arm has longer conversations, which silently unbalances an A/B.

Prompt format is a contract that outlives the run. A checkpoint SFT'd on raw text must be prompted as raw text forever after; wrapping it in a chat template it never saw looks exactly like a fine-tune that did nothing. Record the format next to the checkpoint path.

In RL, everything except the policy must be constant inside a group. The advantage is a within-group difference, so a simulated user sampling at temperature injects noise straight into the gradient and attributes it to the policy. Measured in the reference project: at user temperature 0.5, two runs of the same configuration differed by as much as the effect under study.

Evaluate the base model before training it. If it sits at a floor on your task, every rollout in every group ties, every advantage is zero, and no gradient ever flows — and no ablation you run against it can resolve anything.

Reasoning tokens count against max_tokens. A model that spends its budget inside <think> emits neither a reply nor a tool call, which is not a valid message. Budget 4096, not 1024, and add a truncation retry.

Do the multiplication before launching. RL cost is iterations × tasks_per_iter × group_size × turns. Every one of those is a flag someone bumps on its own:

python scripts/tinker_pricing.py estimate-rl --model openai/gpt-oss-120b \
    --iterations 10 --tasks-per-iter 8 --group-size 8 \
    --turns 20 --avg-prompt 8000 --avg-completion 400

Recording the run

Tinker keeps almost nothing locally — a hosted run UUID and that is it. Anything you want to inspect later has to be written by you.

Use the companion research-observability skill. It was built against this stack: run.sample() takes Tinker's prompt and completion token ids directly, so the trace records exactly the tokens the policy was updated on, and its viewers and cost report work on the result unchanged. That skill records the loop; this one runs it.

Links

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Analyze tau2-bench task export files to identify exactly where and why tasks failed. Map failures to specific conversation rounds, show root causes, check whether relevant documentation was available, and cite sources. Use this skill whenever you need to debug a tau2-bench evaluation, understand why an agent made wrong decisions, identify missing knowledge, or review task performance—especially when context length, eligibility criteria, or policy compliance might be at fault.

日本語の概要は準備中です。原文の説明を表示しています。

Leanmcp/gateway-skills2,1122026年10月8日 更新

How to develop, modify, and extend the Claude Code codebase following its established programming style, patterns, and conventions. Use this skill whenever working on the claude-code source — adding tools, commands, utils, components, types, hooks, services, or fixing bugs. Also use when the user asks about claude-code architecture, coding standards, file organization, or wants to understand how the codebase works. This skill ensures all contributions match the existing codebase style exactly.

日本語の概要は準備中です。原文の説明を表示しています。

Leanmcp/gateway-skills2,1122026年10月8日 更新

Generate a complete, beginner-friendly explanation of an entire code repository as a set of markdown files. Maps the repo structure with `treecap` (installing it if missing), studies the actual source, then writes a `CODE_EXPLANATION/` folder containing an `OVERVIEW.md` plus numbered deep-dive files (01_architecture.md, 02_models.md, ...) that explain how the code is built, what it does, and how the pieces fit together — illustrated with real code excerpts. Use this skill whenever the user wants to understand, document, onboard onto, or get a walkthrough of a codebase: phrases like "explain this repo", "explain the code", "code explanation", "walk me through this codebase", "help me understand how this is built", "document the architecture", or "what does this project do" — even if they don't say the word "skill". Prefer this over ad-hoc summaries whenever the goal is a durable, written explanation of a whole repo.

日本語の概要は準備中です。原文の説明を表示しています。

Leanmcp/gateway-skills2,1122026年10月8日 更新

Run inference on Fireworks AI — direct, through the Leanmcp AI Gateway proxy (aigateway.leanmcp.com) for observability, or via LiteLLM / the OpenAI SDK / raw HTTP. Covers the endpoint-and-key matrix for each route, serverless vs dedicated deployments and their cold starts, browsing and filtering the model catalogue, reasoning models that return content:null with the answer in reasoning_content, function calling, concurrency and load testing, and runner scripts where many models share one protocol with a --use-proxy toggle. Use this skill whenever the user mentions Fireworks, FIREWORKS_API_KEY, api.fireworks.ai, fireworks_ai/ model ids, accounts/fireworks/models/..., a Fireworks deployment id, the Leanmcp gateway or LEANMCP_API_KEY, app.leanmcp.com observability, or gpt-oss / kimi / glm / qwen / deepseek served on Fireworks; wants to route LLM calls through a proxy for logging or cost tracking; is debugging empty responses, 404s, scope errors, cold starts, or "the gateway isn't working"; wants to pick a Fireworks model with tool calling; or wants to sweep several models over one benchmark. Reach for it even on vague asks like "why is this model returning nothing" or "set up inference for these models" when Fireworks is in play.

日本語の概要は準備中です。原文の説明を表示しています。

Leanmcp/gateway-skills2,1122026年10月8日 更新

Build, run, debug and ship 3D city games in Godot 4 — procedurally generated cities (block grids, districts, weighted building typologies, MultiMesh batching, facade shaders, terrain, day/night, landmarks), first-person controllers, headless verification, Blender-generated .glb assets, rigged character and animation packs, real OpenStreetMap-derived cities, WebAssembly export, and cloud GPU streaming on GCP. Use this skill whenever the work involves Godot or a .gd/.tscn/.gdshader/project.godot file; whenever someone wants to start, set up, clone onto a new machine, or stand up a 3D game or city generator; whenever they mention procedural city, city generator, block grid, building typology, MultiMesh, facade shader, terrain heightmap, navmesh, Godot export templates, export presets, headless Godot, .glb pipeline, Blender asset generation, character rigs or borrowed animations; and whenever they want to deploy or share a game — web export, SharedArrayBuffer/COOP/COEP, Selkies, pixel streaming, GPU VM, or "let people play this without installing anything." Reach for it even on vague asks like "get this running", "why is my city slow", "my model faces backwards", "make it work on a cloud machine", or "set this up somewhere else too" when a Godot 3D project is in play.

日本語の概要は準備中です。原文の説明を表示しています。

Leanmcp/gateway-skills2,1122026年10月8日 更新

Scaffold a native iOS app (SwiftUI, no dependencies) from nothing, run it in the Simulator, and archive + upload it to TestFlight entirely from the command line. Bundles working scripts for icon generation, simulator run, and signed upload via the App Store Connect API. Use this whenever the user wants to build, run, ship, or debug an iOS/iPhone/iPad app, mentions Xcode, SwiftUI, .xcodeproj, xcodebuild, simctl, provisioning, code signing, App Store Connect, TestFlight, archiving, or "get this on my phone" — and also when an existing iOS build is failing on icons, signing, teams, destinations, or duplicate build numbers.

日本語の概要は準備中です。原文の説明を表示しています。

Leanmcp/gateway-skills2,1122026年10月8日 更新

Leanmcp のスキルをすべて見る

このスキルの問題を報告する