Repository navigation
Add a tiny Inkling model - #8512
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c7f9c93. Configure here.
| # The reference tokenizer has no pad token, which smoke_test needs to batch its two conversations: set one on a copy, so | ||
| # the pushed tokenizer stays as the reference's. The test runs before the cast to bfloat16 because the vision tower does | ||
| # not cast the float32 `pixel_values` to the model dtype. | ||
| smoke_processor = copy.deepcopy(processor) |
There was a problem hiding this comment.
does this need to change, if we support a custom template for the model?
There was a problem hiding this comment.
No: the tiny model keeps the reference tokenizer and chat template as they are, because TRL replaces the template with its training version only when it matches the Hub one exactly (#8513), so the tiny model must ship the original. The copy only adds a pad token for the smoke test's batching; the pushed tokenizer is unchanged.
|
Thanks, @AmineDiro! These are two different models, so I don't think they conflict:
They have different configs, weights and chat templates, and each tiny model goes to its own repo. The PRs also share no files: this one only adds |
|
Oh my bad ! sorry |
|
The model has been generated with this PR's script: https://huggingface.co/trl-internal-testing/tiny-InklingForConditionalGeneration #8513 runs the Inkling training template tests on it. |
ed5e065 to
74b435b
Compare
74b435b to
4ce7c3d
Compare

This PR adds a generation script for
trl-internal-testing/tiny-InklingForConditionalGeneration, based onthinkingmachines/Inkling.Part of #7962.
Motivation
The stacked PR above it adds Inkling chat template support and tests it on this tiny model. Inkling's markers (
<|message_model|>,<|content_model_end_sampling|>, ...) are single special tokens of its own tokenizer, so the tests need it: with another tiny tokenizer they are split into plain text and the mask boundaries move.Changes
inkling_for_conditional_generation.py, which generatestiny-InklingForConditionalGenerationat transformers 5.14.0 (where Inkling was introduced), with the reference processor and tokenizer.Alignment with the reference
Dry run at transformers 5.14.0, with the real save and only the Hub calls stubbed. Of the 59 keys of the reference config, 40 are the same, 5 are stored under their transformers name (
model_max_length,sconv_kernel_size,dense_mlp_idx,dense_intermediate_size,torch_dtype, converted the same way when the reference loads), and the rest are size reductions and the fields derived from them:hidden_size6144 → 16,num_hidden_layers66 → 4,local_layer_ids→[0, 1, 2]num_attention_heads64 → 4,num_key_value_heads8 → 2,head_dim128 → 8swa_num_attention_heads64 → 4,swa_num_key_value_heads16 → 2,swa_head_dim128 → 8n_routed_experts256 → 4,num_experts_per_tok6 → 2, expert and dense MLP sizes → 32decoder_dmodel6144 → 16 (the text width)All tensors have the reference dtype. The reloaded saved files run a forward pass at transformers 5.14.0 and 5.22.0.
Notes
patch_size40, which the image processor's 40x40 size shares, so both stay as in the reference.pixel_valuesto the model dtype.scipy.The model does not exist on the Hub yet: it will be generated with this script once the script is approved.
Note
Low Risk
Only adds a Hub generation script and a test fixture revision pin; no changes to training, auth, or core library runtime paths.
Overview
Adds a tiny-model generation script for
InklingForConditionalGenerationthat buildstrl-internal-testing/tiny-InklingForConditionalGenerationfromthinkingmachines/Inkling, reusing the reference processor/tokenizer while shrinking text, audio, vision, and MoE settings so reference layer patterns (sliding-window vs global, dense vs sparse MLP) still appear in four layers.The script follows the usual tiny-model flow: init weights, smoke test (with a copied processor that adds a pad token only for batching), cast to bfloat16, keep MoE router bias/global scale in float32, then validate dtypes, print config diff, and push to the Hub.
Tests pin the new Hub artifact in
MODEL_REVISIONSso CI loads a fixed commit for Inkling chat-template and related coverage.Reviewed by Cursor Bugbot for commit 4ce7c3d. Bugbot is set up for automated code reviews on this repo. Configure here.