Skip to content

Allow explicit compatibility tensor dtype casts#167

Open
lesj0610 wants to merge 1 commit intoturboderp-org:devfrom
lesj0610:fix/checkpoint-required-dtype-casts
Open

Allow explicit compatibility tensor dtype casts#167
lesj0610 wants to merge 1 commit intoturboderp-org:devfrom
lesj0610:fix/checkpoint-required-dtype-casts

Conversation

@lesj0610
Copy link
Copy Markdown
Contributor

@lesj0610 lesj0610 commented Mar 7, 2026

This is a small compatibility improvement for architecture-preserving checkpoint format variation. The goal is not to support arbitrary model-specific rewrites, but to make required state tensor loading more robust when modified checkpoints keep the same module graph while changing storage dtype.

Some modified checkpoints resave required state tensors at a lower precision than the receiving op expects. This can happen after resaves, merges, abliterations, repacks, or other tooling that keeps the architecture but rewrites tensor storage or dtype.

This adds an opt-in cast_dtype argument to SafetensorsCollection.get_tensor() and uses it for GatedDeltaNet A_log, which the fused path expects in float.

The cast is explicit, happens after materialization, and leaves unrelated tensors such as dt_bias on their current path.

Adds focused tests for cast and no-cast behavior.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant