mcpField
T
tinker-training-cost

tinker-training-cost

github.com/sundial-orgデータ・データベース15361 回インストール15 週間前に更新
リポジトリ

tinker-training-cost について

tinker-training-costは、JSONLデータセットをもとにTinkerのファインチューニング費用を見積もるコマンドライン計算ツールです。選択したモデルのトークナイザーでチャット、テキスト、指示形式を処理し、学習料金とエポック数から費用を算出します。

主な機能

  1. 01JSONLデータセットのトークン化
  2. 02チャット・テキスト・指示形式に対応
  3. 03モデル固有のトークナイザーを使用
  4. 04エポック数と学習料金から費用を推定
  5. 05利用可能なモデルと料金の一覧表示

活用シーン

  1. 01Tinkerのファインチューニング前に費用を見積もる
  2. 02対応モデル間でデータセット費用を比較
  3. 03学習データのトークン数を算出

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/sundial-org/skills --skill tinker-training-cost

インストール後、Claude Code で/tinker-training-costを入力して読み込まれたか確認します。

同梱ファイルscripts/calculate_cost.py

詳細

Tinker トレーニングコスト計算ツール

適切なモデルのトークナイザーでデータセットをトークン化し、現在の料金を適用して、Tinker のファインチューニングジョブのトレーニングコストを計算します。

クイックスタート

同梱のスクリプトを使ってトレーニングコストを計算します。

# List available models and pricing
python scripts/calculate_cost.py --list-models

# Calculate cost for a JSONL dataset (model matches on unambiguous fragment)
python scripts/calculate_cost.py training_data.jsonl --model Qwen3-8B --epochs 3

# Output as JSON
python scripts/calculate_cost.py training_data.jsonl --model Inkling --json

スクリプトの処理内容:

  1. 選択したモデルに適したトークナイザーを読み込みます(tinker-cookbook がインストールされている場合はそれを使用し、そうでない場合は transformers を使用します)
  2. JSONL ファイル内のトークン数を数えます(チャット、テキスト、指示形式に対応)
  3. 推定トレーニングコストを計算します

コストの計算式

Training Cost = (total_tokens × epochs × train_price_per_million) / 1_000_000

Tinker の料金

2026 年 7 月 17 日から適用される料金(同日に Prefill/Sample は約 50%、Train は約 10%値上げ) 参照元:https://tinker-docs.thinkingmachines.ai/tinker/models/

すべての料金は、トークン 100 万個あたりの USD です。Prefill は入力コンテキスト(推論)、Sample は出力トークン(推論)、Train はトレーニングトークンを指します。キャッシュされた Prefill トークンには 80%の割引が適用されます。:peft:<context> は拡張コンテキスト版です。

モデルPrefillSampleTrain
thinkingmachines/Inkling*$1.87$4.68$5.61
thinkingmachines/Inkling:peft:262144*$3.74$9.36$11.23
nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16*$2.49$6.225$5.478
nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16:peft:262144*$3.32$8.30$9.96
nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16*$0.57$1.44$1.276
nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16:peft:262144*$0.76$1.92$2.32
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16*$0.195$0.495$0.44
moonshotai/Kimi-K2.6$2.205$5.49$4.84
moonshotai/Kimi-K2.6:peft:131072$5.15$12.81$15.40
Qwen/Qwen3.6-35B-A3B$0.54$1.335$1.177
Qwen/Qwen3.6-27B$1.86$5.595$4.103
Qwen/Qwen3.5-397B-A17B$3.00$7.50$6.60
Qwen/Qwen3.5-397B-A17B:peft:262144$4.00$10.00$12.00
Qwen/Qwen3.5-35B-A3B-Base$0.54$1.335$1.177
Qwen/Qwen3.5-9B (+ -Base)$0.66$1.995$1.463
Qwen/Qwen3.5-4B$0.33$1.005$0.737
Qwen/Qwen3-8B$0.195$0.60$0.44
openai/gpt-oss-120b$0.33$0.84$0.737
openai/gpt-oss-120b:peft:131072$0.78$1.94$2.33
openai/gpt-oss-20b$0.18$0.45$0.396
deepseek-ai/DeepSeek-V3.1$1.695$4.215$3.718

* Inkling と Nemotron の料金には、期間限定の 50%割引が反映されています。

チェックポイントのストレージ料金:1 GB あたり月額 $0.10。


トークン化

すべてのモデルのトークナイザーは、Tinker のモデル ID から解決されます(上記のすべてのモデルで確認済みです)。

from tinker_cookbook.tokenizer_utils import get_tokenizer  # preferred
tokenizer = get_tokenizer("Qwen/Qwen3-8B")

# Or with plain transformers (same IDs, minus any :peft: suffix)
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B", trust_remote_code=True)

token_count = len(tokenizer.encode("Your training text here"))
対応する JSONL 形式

チャット形式(推奨):

{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}

テキスト形式:

{"text": "Your training text here"}

指示形式(Alpaca 形式):

{"instruction": "...", "input": "...", "output": "..."}

コストの簡単な例

例 1:100 万トークン、3 エポックでの Qwen3-8B
Training tokens: 1,000,000 × 3 = 3,000,000
Cost: 3.0M × $0.44/M = $1.32
例 2:500 万トークン、2 エポックでの Qwen3.6-35B-A3B
Training tokens: 5,000,000 × 2 = 10,000,000
Cost: 10.0M × $1.177/M = $11.77
例 3:200 万トークン、4 エポックでの Inkling
Training tokens: 2,000,000 × 4 = 8,000,000
Cost: 8.0M × $5.61/M = $44.88

重要な注意事項

  1. LoRA ファインチューニング:Tinker では、完全なファインチューニングではなく Low-Rank Adaptation(LoRA)を使用します
  2. トークン数のカウント:必ずモデル固有のトークナイザーを使用してください。同じテキストでも、トークナイザーによってカウントが異なります
  3. RL のコストはトレーニング料金だけではありません:ロールアウトには、トレーニングトークンの料金に加えて Sample/Prefill の料金が適用されます
  4. マルチモーダル入力(Inkling の画像/音声)では、テキストのトークン化に加えてトークンが追加されます

コメント