Fix Windows safetensors load order to prevent crash#61
Open
CharlesCNorton wants to merge 1 commit intoLightricks:mainfrom
Open
Fix Windows safetensors load order to prevent crash#61CharlesCNorton wants to merge 1 commit intoLightricks:mainfrom
CharlesCNorton wants to merge 1 commit intoLightricks:mainfrom
Conversation
On Windows, loading large safetensors files (41GB BF16 model) crashes with a segmentation fault when Gemma is already loaded in memory due to a safetensors memory mapping issue. Changes: - Reorder SingleGPUModelBuilder.build() to load state dict BEFORE applying module_ops (which load Gemma) - Make triton import conditional since it's Linux-only, with fallback for FP8 weight fusion on non-Linux systems
Qi Li (liqi-casia)
approved these changes
Jan 19, 2026
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.
Summary
SingleGPUModelBuilder.build()to prevent segfault on WindowsProblem
On Windows, loading a large safetensors file (41GB BF16 model) crashes with segfault when Gemma is already loaded in memory. This appears to be a safetensors memory mapping issue specific to Windows.
Solution
Load the state dict before applying module_ops (which load Gemma). This ensures the safetensors file is opened before Gemma occupies memory, avoiding the crash.
Test plan
ltx-2-19b-dev.safetensors) now loads and runs successfully🤖 Generated with Claude Code