Repository navigation
Add Inkling 2 model - #2061
Draft
jundot wants to merge 6 commits into
Draft
Add Inkling 2 model#2061jundot wants to merge 6 commits into
jundot wants to merge 6 commits into
Conversation
Text and image input, with Metal kernels for the prefill attention and the attention residuals. The published checkpoint loads as is, and tensor and pipeline parallel work.
Split the model file into config, layers, vision, checkpoint and model modules, and move the processor and the two kernels into the package. The processor now returns a dict of inputs, as load_processor expects, and the image rows use the shared splice. The model code is otherwise unchanged.
Contributor
Author
|
Updated this PR for the new models layout in #2082. I moved Inkling 2 into a package with config, layers, vision, checkpoint, model, kernels and processor modules. The processor now returns a dict of inputs, and the image rows use the shared splice. The model code is otherwise unchanged. |
The public checkpoints declare their quantization, so load_model sets up the experts and sanitize only maps the tensors. load_model also reads fp8 with 1x32 ue8m0 blocks as mxfp8, as in Inkling-2-Small-MXFP8.
Contributor
Author
|
The experts now load through load_model, since the public checkpoints declare their quantization. Sanitize only maps the tensors. load_model also reads fp8 with 1x32 ue8m0 blocks as mxfp8, which Inkling-2-Small-MXFP8 uses. |
4 tasks done
This branch has not been deployed
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.
* This is a draft because of the open PR limit. I will mark it ready for review once my other open PRs are merged.
Text and image input. The published NVFP4 checkpoint loads as is, and tensor and pipeline parallel work. DSpark is not included.
Images and kernels follow the same structure as Muse Spark Open. The image processor and the kernels are in the inkling2 package.
Two new kernels. relative_attention is the prefill attention with the relative position bias and the per-token sink, which MLX SDPA does not take. depth_attention mixes the attention residual blocks. Without them the model runs plain MLX ops.
M3 Ultra with 512 GB. Each number is the mean of two runs with 128 generated tokens.
Without the kernels the 16k prefill also takes 24 GB more memory.
Benchmark script
The kernels are off when inkling2.layers._use_kernels returns False. The prompt text is Moby-Dick from Project Gutenberg.
Model information
Supported checkpoints
Verification
mlx_lm.generate --model thinkingmachines/Inkling-2-Small -p "The secret to baking a good cake is" -m 1024