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

completers

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.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.5 KB

SKILL.md(原文)

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

Completers

Completers wrap SamplingClient for convenient text generation. Two levels of abstraction:

  • TokenCompleter — low-level, returns tokens + logprobs
  • MessageCompleter — high-level, returns parsed Message objects

Reference

Read these for details:

  • tinker_cookbook/completers.py — Implementation
  • docs/completers.mdx — Usage guide

TokenCompleter

Generates 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

MessageCompleter

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"}

When to use which

  • TokenCompleter: RL rollouts, custom generation loops where you need logprobs and token-level control
  • MessageCompleter: Evaluation, tool-use environments, multi-turn RL where you work with Messages

Custom completers

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:
        ...

Common pitfalls

  • Create a new completer (with a new SamplingClient) after saving weights
  • TokensWithLogprobs.maybe_logprobs can be None if logprobs weren't requested
  • MessageCompleter uses the renderer for both prompt construction and response parsing

レビュー

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

同じリポジトリのスキル

概要と使いどころ

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.

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

uiuc-kang-lab/rlvr_generalization_bounds52026年5月13日 更新

ci

無料

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.

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

uiuc-kang-lab/rlvr_generalization_bounds52026年5月13日 更新

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.

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

uiuc-kang-lab/rlvr_generalization_bounds52026年5月13日 更新

datasets

無料

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.

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

uiuc-kang-lab/rlvr_generalization_bounds52026年5月13日 更新

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.

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

uiuc-kang-lab/rlvr_generalization_bounds52026年5月13日 更新

dpo

無料

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.

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

uiuc-kang-lab/rlvr_generalization_bounds52026年5月13日 更新

uiuc-kang-lab のスキルをすべて見る

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