Skip to content

tinker_cookbook.renderers.get_renderer

tinker_cookbook.renderers.get_renderer(name, tokenizer, image_processor, model_name)

Factory function to create renderers by name.

Parameters:

  • name (str) – Renderer name. Supported values: - "role_colon": Simple role:content format - "llama3": Llama 3 chat format - "qwen3": Qwen3 with thinking enabled - "qwen3_vl": Qwen3 vision-language with thinking - "qwen3_vl_instruct": Qwen3 vision-language instruct (no thinking) - "qwen3_disable_thinking": Qwen3 with thinking disabled - "qwen3_instruct": Qwen3 instruct 2507 (no thinking) - "qwen3_5": Qwen3.5 VL with thinking - "qwen3_5_disable_thinking": Qwen3.5 VL with thinking disabled - "deepseekv3": DeepSeek V3 (defaults to non-thinking mode) - "deepseekv3_disable_thinking": DeepSeek V3 non-thinking (alias) - "deepseekv3_thinking": DeepSeek V3 thinking mode - "kimi_k2": Kimi K2 Thinking format - "kimi_k25": Kimi K2.5 with thinking enabled - "kimi_k25_disable_thinking": Kimi K2.5 with thinking disabled - "nemotron3": Nemotron-3 with thinking enabled - "nemotron3_disable_thinking": Nemotron-3 with thinking disabled - "gpt_oss_no_sysprompt": GPT-OSS without system prompt - "gpt_oss_low_reasoning": GPT-OSS with low reasoning - "gpt_oss_medium_reasoning": GPT-OSS with medium reasoning - "gpt_oss_high_reasoning": GPT-OSS with high reasoning - Custom renderers registered via register_renderer()
  • tokenizer (Tokenizer) – The tokenizer to use.
  • image_processor (ImageProcessor | None) – Required for VL renderers.
  • model_name (str | None) – Model name for pickle metadata. If None, falls back to tokenizer.name_or_path. Provide this explicitly when the tokenizer was loaded with a remapped name (e.g., Llama 3 models).

Returns: Renderer: A Renderer instance configured for the specified format.

Raises:

  • RendererError: If the renderer name is unknown or if a VL renderer
  • is requested without an image_processor.