Skip to content

Add Inkling model#47347

Merged
ArthurZucker merged 143 commits into
mainfrom
skeleton-modular
Jul 15, 2026
Merged

Add Inkling model#47347
ArthurZucker merged 143 commits into
mainfrom
skeleton-modular

Conversation

@molbap

@molbap molbap commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

CI

What does this PR do?

Add new model from Thinking Machines!

@molbap molbap changed the title kwargs typos Inkling Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, bamba, falcon_h1, falcon_mamba, granitemoehybrid, inkling, jamba, lfm2, lfm2_moe, mamba, mamba2, nemotron_h, qwen3_5, qwen3_5_moe, qwen3_next, zamba

@Cyrilvallez Cyrilvallez changed the title Inkling Add Inkling model Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 29440654491:1
Result: failure | Jobs: 2 | Tests: 2 | Failures: 2 | Duration: 8s

Code quality check failed: test jobs were skipped. Fix the code quality issues and push again to run tests.

@ArthurZucker
ArthurZucker merged commit c375c5e into main Jul 15, 2026
25 of 28 checks passed
@ArthurZucker
ArthurZucker deleted the skeleton-modular branch July 15, 2026 18:44
ArthurZucker pushed a commit that referenced this pull request Jul 15, 2026
* processor very rough draft

* whatever claude says for now, clean next

* mm towers

* .

* import base model

* make it init model from scratch

* conversion maybe

* vision loads

* tiny change

* add normalization

* more nits

* more

* oops

* typo

* copy linear stuff from qwen, seems quite similar

* a bit more

* relative position bias draft

* no act

* dtype force fp32 to match as closely as we can

* make it run

* torchaudio dep doesn't work for me, just skip for now

* moe loads kinda

* oke now the keys match

* moe router fix

* .

* hmm, I think mlp has to be deinterlaved not chunked

* i am defi breaking the model again XD

* same for routed experts mlp

* dont shard shared gammas ig

* well we still need cache for full vs slliding

* this is ugly!

* ig?

* delete

* fix norm

* fix normer

* tied + inits

* sync modular

* Add TML audio support (feature extractor, processor, audio tower wiring)

Ports the dMel audio pipeline onto the synced skeleton-modular base:
- feature extractor returns the log-mel spectrogram + mask
- processor quantizes it into audio_input_ids (dMel tokens) + mask
- TmlAudioModelEmbeddings/TmlAudioModel embed the dMel tokens
- get_audio_features + generalized get_placeholder_mask wire audio into the forward
- conversion_mapping renames audio.encoder -> embed_audio_tokens, final_norm -> norm

* parallelism wars

* fix position_bias -> use cache primitives directly

* do not slice the mask

* position_ids

* re add some inheritance

* init global scales at 1: super important if we want to train correctly

* inherit more

* simplify conv

* no need to pad before update, the update does it

* add accelerate hook decorator

* big cache refactor to have native implem

* small fix

* add static cache support

* make it compileable

* remove cache param completely

* do not transpose every time

* oupsi already had conversions

* remove the very suspicious dtype casting

* support sdpa

* fix bad reshape

* add flex support

* fix

* oupsi, pass layer_idx

* upstream TP fix

* big model fixes + conv1d update diff from qwen

* fix_compile

* TP transpose conversion is free

* Reuse HiggsAudioV2Embeddings for TmlAudioModelEmbeddings

The controlled port had inlined the dMel embeddings because the standalone-era
skeleton-modular had no cross-model inheritance. Now that skeleton-modular uses
inheritance again, restore TmlAudioModelEmbeddings(HiggsAudioV2Embeddings) + the
TmlAudioConfig num_codebooks/codebook_size/hidden_size attribute map. Behavior and
weight names unchanged (verified: logits + load identical).

* add kernels

* log scaling + image processing changes

* Ink it up

* add load_audio_backend

* allow to rollback linear cache layers

* make repo

* record past

* test audio utils

* audio/ image bos

* TmlProcessingIntegrationTest

* add TmlIntegrationTest

* nit

* nit

* add requires_backends

* can rollback prefill as well

* no rescale_image_frac

* avoid downcasting for linear attn

* add kernels + fix env vars for kernel disablement

* format

* fix save pretrained for Interleave

* better mappings

* more automappings

* change name

* implement mtp cache rollback and correction

* attempts at fixing MTP (noisy outputs)

* solve all indexing issues between main_model index and ntp layers

* small fix

* oupsi forgot to apply modular

* replace sliding layers for now

* allow sliding in mtp layers

* fix the masking for mtp layers

* fix cropping and a lot of issues by replacing get_seq_length to get offsets

* oupsi

* replace layers

* bucket to hf-internal-testing

* add test_apply_chat_template_audio_without_attention_mask

* fix mtp

* update test path

* improve cache invalidation a lot

* fix tests 1 / N

* update integration test

* update bucket path

* fix tests 2/N

* fix tests 3 / N

* fix tests 4/ N: Chunk dim 1

* fix fe edge case

* fix tests 5 / N

* update all mamba models

* upddate token ids

* slice them

* few missing

* [core] force contiguity on chunking

* fix tests 6 / N

* chat template testing 7 / N

* format + processor test fix 8 / N

* small fix

* skip tiny model offload fix 9 / N

* small fix

* conflict dropped the crochet

* style

---------

Co-authored-by: raushan <[email protected]>
Co-authored-by: Eustache Le Bihan <[email protected]>
Co-authored-by: Cyril Vallez <[email protected]>
Co-authored-by: eustlb <[email protected]>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

hidden_states = hidden_states[:, :, -seq_len:]

hidden_states = hidden_states.transpose(1, 2)
hidden_states = (hidden_states + residual).to(dtype=input_dtype)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? It seems that we add residual once here but another time in InklingDecoderLayer's forward().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@molbap @ArthurZucker could you help us to check if this is intended? Are there really two residual adds per attn-block and per-mlp/moe-block?

relative_states = relative_states.view(*input_shape, self.num_heads, -1)
position_bias = self.rel_logits_proj(relative_states, q_positions, kv_positions)

# original impl applies log scalnig in f32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spelling error: scalnig -> scaling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants