Guide for checkpointing — saving, loading, and resuming training with CheckpointRecord. Use when the user asks about saving weights, resuming training, checkpoint management, or the checkpoint lifecycle.
日本語の概要は準備中です。原文の説明を表示しています。
Guide for using completers — TokenCompleter and MessageCompleter for text generation during RL rollouts and evaluation. Use when the user asks about generating text, completing messages, or using completers in RL environments.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Completers wrap SamplingClient for convenient text generation. Two levels of abstraction:
Read these for details:
tinker_cookbook/completers.py — Implementationdocs/completers.mdx — Usage guideGenerates tokens from a ModelInput prompt. Used internally by RL rollouts.
from tinker_cookbook.completers import TinkerTokenCompleter, TokensWithLogprobs
completer = TinkerTokenCompleter(
sampling_client=sc,
max_tokens=256,
temperature=1.0,
)
result: TokensWithLogprobs = await completer(
model_input=prompt,
stop=stop_sequences, # list[str] or list[int]
)
# result.tokens: list[int]
# result.maybe_logprobs: list[float] | None
Higher-level: takes a conversation (list of Messages), returns a Message. Handles rendering and parsing internally.
from tinker_cookbook.completers import TinkerMessageCompleter
completer = TinkerMessageCompleter(
sampling_client=sc,
renderer=renderer,
max_tokens=256,
temperature=1.0,
stop_condition=None, # Override stop sequences
)
response_message: Message = await completer(messages=[
{"role": "user", "content": "What is 2+2?"},
])
# response_message = {"role": "assistant", "content": "4"}
Both are abstract base classes you can subclass for non-Tinker backends:
from tinker_cookbook.completers import TokenCompleter, MessageCompleter
class MyTokenCompleter(TokenCompleter):
async def __call__(self, model_input, stop) -> TokensWithLogprobs:
...
class MyMessageCompleter(MessageCompleter):
async def __call__(self, messages) -> Message:
...
TokensWithLogprobs.maybe_logprobs can be None if logprobs weren't requestedまだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Guide for checkpointing — saving, loading, and resuming training with CheckpointRecord. Use when the user asks about saving weights, resuming training, checkpoint management, or the checkpoint lifecycle.
日本語の概要は準備中です。原文の説明を表示しています。
Guide for testing conventions and CI pipelines — unit tests, integration smoke tests, pytest markers, and GitHub Actions workflows. Use when the user asks about testing, CI, running tests, or adding tests for a recipe.
日本語の概要は準備中です。原文の説明を表示しています。
Guide for contributing to the tinker-cookbook repo — development setup, code style, type checking, PR process, and design conventions. Use when the user asks about how to contribute, set up the dev environment, code style, or project conventions.
日本語の概要は準備中です。原文の説明を表示しています。
Guide for dataset construction — SupervisedDatasetBuilder, RLDatasetBuilder, ChatDatasetBuilder, and custom dataset creation from JSONL, HuggingFace, or conversation data. Use when the user asks about datasets, data loading, data preparation, or custom data formats.
日本語の概要は準備中です。原文の説明を表示しています。
Set up and run knowledge distillation (on-policy, off-policy, or multi-teacher) from a teacher model to a student model using the Tinker API. Use when the user wants to distill knowledge, compress models, or train a student from a teacher.
日本語の概要は準備中です。原文の説明を表示しています。
Set up and run Direct Preference Optimization (DPO) training on preference datasets using the Tinker API. Use when the user wants to train with preference data, chosen/rejected pairs, or DPO.
日本語の概要は準備中です。原文の説明を表示しています。