[rl] Pin renderers 0.1.11, render with TorchTitan's tokenizer, take the renderer's typed config directly - #43
Open
felipemello1 wants to merge 1 commit into
Open
[rl] Pin renderers 0.1.11, render with TorchTitan's tokenizer, take the renderer's typed config directly#43felipemello1 wants to merge 1 commit into
felipemello1 wants to merge 1 commit into
Conversation
felipemello1
force-pushed
the
80-renderers-typed
branch
9 times, most recently
from
September 3, 2026 15:11
65d12cd to
0d1de2a
Compare
felipemello1
force-pushed
the
80-renderers-typed
branch
from
September 3, 2026 15:56
0d1de2a to
bfdb125
Compare
…he renderer's typed config directly renderers 0.1.11 makes transformers optional and accepts a bring-your-own tokenizer. RL now renders with TorchTitan's HuggingFaceTokenizer (wrapped in RendererTokenizer to satisfy renderers.OffsetTokenizer) instead of loading transformers.AutoTokenizer, and the controller reads pad_id off its own tokenizer instead of renderer._tokenizer. TorchTitan's RendererConfig wrapper is removed. Controller.Config.renderer is the library's own typed pydantic config (Qwen3RendererConfig(enable_thinking=False), GptOssRendererConfig(reasoning_effort="low"), ...), so a wrong option fails when the recipe is constructed instead of being silently dropped (pytorch#4365), and TorchTitan mirrors no renderer fields. build_renderer(tokenizer, config) is the one TorchTitan-side seam. A renderer that ships in TorchTitan (Muse Glimmer) has a TorchTitanRendererConfig that names its renderer class, and build_renderer constructs it directly, so nothing is written into renderers' registry. AutoRendererConfig and DefaultRendererConfig are rejected with the reason: the former depends on an exact model-ID match that local asset paths do not reliably preserve; the latter needs Hugging Face-compatible apply_chat_template semantics, which TorchTitan's template rendering does not provide. Renderer options are set in the recipe (tyro.conf.Suppress, like model_spec); the 8 redundant --renderer.enable-thinking CLI flags in the integration tests are removed. Configurable.to_dict learns pydantic model_dump so the wandb config stays JSON. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
felipemello1
force-pushed
the
80-renderers-typed
branch
2 times, most recently
from
September 3, 2026 18:06
0c92da9 to
390eb7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR:
model_name-> config_typeSummary
TitanRL uses
renderersto turn chat messages into token ids and parse completions back. Until now we wrapped it in our ownRendererConfig:Problems:
build()forwarded knobs by name-matching against the renderer's config and dropped the rest. Whenrenderersreplacedpreserve_all_thinkingwiththinking_retention, the knob went inert with no error; two in-tree recipes were already hitting the same thing (enable_thinkingon gpt-oss and Muse Glimmer, which have no such option).build()loadedtransformers.AutoTokenizereven though TorchTitan already has the tokenizer, and the controller then reached intorenderer._tokenizerforpad_id.Solutions:
renderers==0.1.11accepts a bring-your-own tokenizer and drops the transformers dependency:Recipes hold the library's typed config directly: We don't have a wrapper anymore. We don't try to redirect 'qwen3
to the right config, e.g.renderer=RendererConfig(name="qwen3", enable_thinking=False)`. Instead, we do:We load our own tokenizer:
build_rendererpairs that config with TorchTitan's tokenizer, through a small adapter (RendererTokenizer) that exposes the interfacerenderersexpects.We skip registration of new renderers*: Muse Glimmer's renderer lives in TorchTitan, so the renderer's registry cannot find it. We skip the need for the renderers registry that maps config -> renderer class. Check
TorchTitanRendererConfig.Validation