You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ltx): load the LTX-2.5 keyframe embedding as F32 - #2432
keyframes_abs_pos_embedding takes its type from the weights file, and ComfyUI's LTX-2.5 transformers store it as BF16. It is added to the f32 activations right after patchify_proj. Vulkan's ADD has no BF16 source, so ggml schedules the add on the CPU backend, which has no f32 + bf16 kernel either.
This change creates the tensor as F32, as Linear and Conv2d already do for biases, so the loader widens it at load time. It is a single [4096, 1] tensor, so the cost is 8 KB. Widening BF16 to F32 is exact, so backends that could already run the BF16 add get the same values.
--tensor-type-rules can't work around it, because tensor_should_be_converted skips names containing pos_embed and embedding.
Related Issue / Discussion
None found. Found while integrating stable-diffusion.cpp into kiln4j (liberation-data/kiln#1).
Additional Information
Tested on an AMD Radeon 8060S (Strix Halo), Fedora, Mesa RADV, Vulkan backend:
Weights: ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors, gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors and ltx-2.5-video-vae-conv-bf16.safetensors.
./bin/sd-cli -M vid_gen \
--diffusion-model ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors \
--vae ltx-2.5-video-vae-conv-bf16.safetensors \
--llm gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors \
-p "a red fox walking through a forest" \
--cfg-scale 1 --sampling-method euler --scheduler ltx2 --steps 2 \
-W 336 -H 224 --video-frames 9 --fps 24 --seed 7 -o out.webm
Build
Result
master (52491bd)
Aborts at the first sampling step with the error above (exit 134).
If this PR adds or changes model support, I have added or updated its usage guide and relevant model index/README entries following the model documentation requirements.
Improved consistency for models that use keyframe position embeddings. These embeddings are now handled with a consistent numeric format, which may help avoid differences in model behavior across checkpoints.
This change loads the keyframe positional embedding as F32 so LTX-2.5 no longer aborts on Vulkan devices without BF16 support. The extra memory cost is 8 KB, and no actionable merge risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(ltx): load the LTX-2.5 keyframe embedding as F32" names the actual change: the keyframes_abs_pos_embedding tensor is now created as F32 in the LTX model block. It is concise, specific, …
Description check
The description follows the template's required sections: Summary, Related Issue / Discussion, Additional Information, and Checklist. The Summary explains the BF16 abort, the cause (the embedding take…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(ltx): load the LTX-2.5 keyframe embedding as F32" names the actual change: the keyframes_abs_pos_embedding tensor is now created as F32 in the LTX model block. It is concise, specific, and matches the single-file change in the raw summary and the stated objective of addressing LTX-2.5 aborts on Vulkan devices without BF16 support.
Full details: Description check
Explanation
The description follows the template's required sections: Summary, Related Issue / Discussion, Additional Information, and Checklist. The Summary explains the BF16 abort, the cause (the embedding takes its type from the weights file and is added to F32 activations), and the fix (create the tensor as F32). The Related Issue section states that no related issue was found and gives the context of the kiln4j integration. Additional Information gives hardware, backend, weights, a reproduction command, and a results table. The contribution-guidelines box is checked. The model-documentation box is unchecked; the template makes this conditional on whether the PR adds or changes model support. The description does not say whether the change touches model support, so this item remains open for the author to confirm.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 71884aed-393d-4573-944b-bc3ec4d989d0
Commits
Reviewing files that changed from the base of the PR and between 52491bd and 867ddd1.
Files selected for processing: 1
src/model/diffusion/ltxv.hpp
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
Summary
LTX-2.5 aborts on Vulkan devices without BF16 support:
keyframes_abs_pos_embeddingtakes its type from the weights file, and ComfyUI's LTX-2.5 transformers store it as BF16. It is added to the f32 activations right afterpatchify_proj. Vulkan'sADDhas no BF16 source, so ggml schedules the add on the CPU backend, which has no f32 + bf16 kernel either.This change creates the tensor as F32, as
LinearandConv2dalready do for biases, so the loader widens it at load time. It is a single[4096, 1]tensor, so the cost is 8 KB. Widening BF16 to F32 is exact, so backends that could already run the BF16 add get the same values.--tensor-type-rulescan't work around it, becausetensor_should_be_convertedskips names containingpos_embedandembedding.Related Issue / Discussion
None found. Found while integrating stable-diffusion.cpp into kiln4j (liberation-data/kiln#1).
Additional Information
Tested on an AMD Radeon 8060S (Strix Halo), Fedora, Mesa RADV, Vulkan backend:
Weights:
ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors,gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensorsandltx-2.5-video-vae-conv-bf16.safetensors../bin/sd-cli -M vid_gen \ --diffusion-model ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors \ --vae ltx-2.5-video-vae-conv-bf16.safetensors \ --llm gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors \ -p "a red fox walking through a forest" \ --cfg-scale 1 --sampling-method euler --scheduler ltx2 --steps 2 \ -W 336 -H 224 --video-frames 9 --fps 24 --seed 7 -o out.webm52491bd)--tensor-type-rules '^model\.diffusion_model\.=f32'--audio-vae ltx-2.5-audio-vae-bf16.safetensorsNot tested on CUDA or Metal.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01F8aCDWCF2feBKiGjsJEsVk
Summary by CodeRabbit