メインコンテンツへスキップ
学習ガイドの章 すべてのドキュメント

TrainingProject:設定、学習、受け入れ評価

SDK 0.2.0 のプロジェクト設定、実際の学習、評価、復旧、エクスポートを説明します。

どの言語版でもコマンドとコードは英語のままです。大文字のプレースホルダーは、ご自身のアカウントと有料ジョブの値に置き換えてください。共有ノートブックやログに実際のキーを貼り付けないでください。

TrainingProject のワークフロー

1つのプロジェクト設定を計画、学習、評価、エクスポートで共有します。
  1. プロジェクト モデル、目標、データポリシー
  2. 計画 互換性、カリキュラム、予算
  3. 実行 データ、学習、チェックポイント
  4. 改善 制限付きのトピック評価とリグレッション評価
  5. エクスポート 検証済みの成果物と再現可能なレポート

プロジェクト: モデル、目標、データポリシー. 計画: 互換性、カリキュラム、予算. 実行: データ、学習、チェックポイント. 改善: 制限付きのトピック評価とリグレッション評価. エクスポート: 検証済みの成果物と再現可能なレポート

1つのプロジェクト、1つの再現可能な設定

プロジェクト設定では、ローカルの生徒モデル、有料の教師モデル参照、目標、データポリシー、実行環境、カリキュラム、評価基準をまとめて指定します。Automatic モードは互換性のある既定値を解決し、Advanced モードでは対応する項目を明示的に設定できます。dry-run 計画には、学習開始前にモデルの互換性、トピック、データの流れ、予算、フィンガープリント、想定成果物が示されます。

  • Python のプロジェクト API と fpai-training CLI は同じエンジンを使用します。
  • モデル、データセット、評価器、設定のパスはすべてプロジェクトルート内で検証されます。
  • カスタム評価器のバージョンを固定し、run のマニフェストを保管します。
例 · json
{
  "schema_version": "1.0",
  "mode": "automatic",
  "objective": "Classify support messages as billing, account_access or technical_issue.",
  "model": {"path": "./models/student", "adapter": "transformers-causal-lm", "revision": null},
  "teacher": {"provider": "openai", "reference_model_id": 123},
  "data": {
    "sources": ["./data/train.jsonl"], "teacher_sharing": "none",
    "validation_path": "./data/validation.jsonl", "test_path": "./data/test.jsonl",
    "deduplicate": true, "seed": 42
  },
  "runtime": {"target": "customer_datacenter", "devices": "auto"},
  "training": {"method": "auto"},
  "curriculum": {"topics": ["intent", "ambiguous_requests", "class_balance"], "max_improvement_cycles": 3, "stop_on_regression": true},
  "budgets": {"max_training_minutes": 120, "max_teacher_requests": 1000, "max_storage_gib": 20},
  "checkpoints": {"keep_last": 3},
  "evaluation": {"rubric": "./rubric.json", "baseline_required": true},
  "output": {"directory": "./runs/german-001", "format": "safetensors"}
}
例 · json
{
  "schema_version": "1.0",
  "mode": "advanced",
  "model": {"path": "./models/student", "adapter": "transformers-causal-lm", "revision": null},
  "teacher": {"provider": "openai", "reference_model_id": 123},
  "objective": "Classify support messages as billing, account_access or technical_issue.",
  "data": {"sources": ["./data/train.jsonl"], "teacher_sharing": "none", "validation_path": "./data/validation.jsonl", "test_path": "./data/test.jsonl"},
  "runtime": {"target": "customer_datacenter", "devices": [0, 1], "distributed": {"backend": "ddp", "nodes": 1}},
  "training": {
    "method": "LoRA",
    "epochs": 3,
    "learning_rate": 0.0002,
    "batch_size": 1,
    "gradient_accumulation_steps": 16,
    "max_sequence_length": 2048,
    "precision": "bf16",
    "lora": {"rank": 16, "alpha": 32, "dropout": 0.05}
  },
  "curriculum": {
    "topics": ["intent", "ambiguous_requests", "class_balance"],
    "max_improvement_cycles": 3,
    "stop_on_regression": true
  },
  "checkpoints": {"every_steps": 100, "keep_last": 3, "resume_validation": "strict"},
  "budgets": {"max_training_minutes": 120, "max_teacher_requests": 1000, "max_storage_gib": 20},
  "evaluation": {"rubric": "./rubric.json", "baseline_required": true},
  "output": {"directory": "./runs/german-advanced-001", "format": "safetensors"}
}
例 · bash
fpai-training init --directory ./german-project
fpai-training doctor --config ./german-project/training.json
fpai-training plan --config ./german-project/training.json --dry-run
fpai-training run --config ./german-project/training.json
fpai-training status --run ./german-project/runs/german-001
fpai-training pause --run ./german-project/runs/german-001
fpai-training resume --run ./german-project/runs/german-001
fpai-training cancel --run ./german-project/runs/german-001
fpai-training evaluate --run ./german-project/runs/german-001 --split test
fpai-training export --run ./german-project/runs/german-001 --format safetensors
# init creates a project; doctor checks local compatibility; plan makes no teacher call.
# run requires current paid reference access, enforces budgets and trains locally.
# pause saves a checkpoint; resume verifies project fingerprints; cancel is terminal.
# evaluate reads local held-out rows; export validates the accepted local artifact.
例 · python
import os
from fusionpointai_training import TrainingProject

project = TrainingProject.from_file(
    "./german-project/training.json",
    api_key=os.environ["FUSIONPOINTAI_API_KEY"],
)
plan = project.plan(dry_run=True)
result = project.run()
evaluation = project.evaluate(split="test")
artifact = project.export(format="safetensors")
# Related controls: project.status(), project.pause(), project.resume(), project.cancel().

学習と評価の動作

Transformers 因果言語モデルアダプターは、互換性のあるモデルと実行環境で実際に SFT、LoRA、QLoRA の最適化を行います。プロジェクトは有料の教師モデル利用、ローカルデータセット、トピックごとの評価、回帰チェック、上限付きの改善処理をまとめて管理します。対応していないアーキテクチャ、ハードウェア、エクスポート形式の組み合わせは、互換性チェックでエラーになります。

  • 停止理由には accepted、budget_exhausted、no_progress、regression、cancelled、failed があります。
  • ネイティブのチェックポイントと run の状態は、run が所有する非公開ストレージに保持されます。
  • 教師モデルとの共有はプロジェクトのポリシーに従い、検証用と最終テスト用のデータはローカルに保管します。
例 · json
{
  "schema_version": "1.0",
  "name": "support-category-evaluation",
  "scale": {"minimum": 0.0, "maximum": 1.0},
  "criteria": [
    {"id": "support_category", "description": "Match the expected support category.", "metric": "macro_f1", "minimum_score": 0.85}
  ],
  "regression": {"maximum_score_drop": 0.02},
  "final_test": {"path": "./data/test.jsonl", "allow_training_use": false}
}
例 · text
SDK 0.2.0 CLI AND PROJECT CONTRACT
Configuration/rubric values above are examples, not achieved scores or guarantees.
doctor must reject incompatible architecture, precision, hardware and export settings.
plan --dry-run validates and estimates; it must not update weights or start paid work.
run uses the declared data-sharing policy and enforces all configured budgets.
pause saves a valid atomic checkpoint before stopping owned training workers.
resume validates the checkpoint's model/config/data/evaluator fingerprints.
cancel requests termination of this run's workers; preserve useful logs and artifacts.
evaluate --split test must never feed test examples into training.
export validates files and manifests; never include credentials or unrelated cache files.

Project API:
TrainingProject.from_file(path, *, api_key) -> TrainingProject
plan(*, dry_run=True) -> dict
run() -> dict
status() -> dict
pause() -> dict
resume() -> dict
cancel() -> dict
evaluate(*, split="test") -> dict
export(*, format="safetensors") -> dict

Exit codes:
0 accepted/success; 2 invalid configuration; 3 incompatible runtime/model;
4 authentication/access; 5 budget exhausted; 6 acceptance not met;
7 execution failed; 130 interrupted.
Reports must record stop_reason and unmet criteria, not just an exit code.

レポートと成果物を確認する

プロジェクト run では、未変更のベースライン、実測した評価基準、回帰、予算、未達要件を記録します。エクスポート時にはローカルのモデルまたはアダプターを検証してマニフェストを書き込みます。SDK の動作は対応するソフトウェアとハードウェアに左右されます。この例はハードウェアのベンチマーク結果や推論結果を示すものではありません。

  • 学習しただけで教師モデルと同等だとは言えません。
  • ドキュメントの例が有料リクエストや学習を自動で実行することはありません。
  • 成果物を使う前に、ローカルのレポートとファイルを確認してください。
例 · text
TrainingProject delivery files
model/                   validated model or adapter weights and tokenizer assets
exports/<format>/        accepted delivery files with a SHA-256 manifest
run-manifest.json        pinned model/data/config/runtime versions
baseline-report.json     untouched student model's measured criteria
evaluation-report.json   final criteria, measured scores and regressions
artifact-manifest.json   safe relative paths, bytes and SHA-256 per file
training-report.json     real steps, timings, budgets and stop reason

Never export credentials, environment files or private cache directories.