Skip to content

Fix: Linear8bitLt crash with tied weights (skip_modules)#1865

Open
TimDettmers wants to merge 3 commits intomainfrom
fix/issue-1634
Open

Fix: Linear8bitLt crash with tied weights (skip_modules)#1865
TimDettmers wants to merge 3 commits intomainfrom
fix/issue-1634

Conversation

@TimDettmers
Copy link
Collaborator

Summary

  • Fixes AttributeError: 'Parameter' object has no attribute 'SCB' when using llm_int8_skip_modules without lm_head on models with tied weights (e.g. OPT)
  • Adds isinstance(self.weight, Int8Params) guard in Linear8bitLt.forward() to fall back to F.linear when weight is a plain Parameter (e.g. due to weight tying with embedding layer)
  • Makes _save_to_state_dict and _load_from_state_dict robust to non-Int8Params weights via getattr defaults

Test plan

  • New test test_linear8bitlt_tied_weights_no_crash passes on CPU and CUDA
  • Existing test_linear8bitlt.py tests remain unaffected
  • Manual verification with OPT-125m reproduction from issue

Fixes #1634

🤖 Generated with Claude Code

TimDettmers and others added 2 commits February 14, 2026 01:28
Worker agents were running the full test suite (10+ min) which is
wasteful when only a small area of code changed. Updated the completion
workflow to instruct agents to run only relevant test files/functions.
The full suite will be run separately later.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When lm_head is converted to Linear8bitLt but its weight is tied to an
embedding layer, weight tying replaces the Int8Params with a regular
nn.Parameter that lacks SCB/CB attributes, causing AttributeError.

Add an isinstance check in Linear8bitLt.forward() to fall back to
F.linear when the weight is not Int8Params (e.g. due to weight tying).
Also make _save_to_state_dict and _load_from_state_dict robust to
non-Int8Params weights via getattr defaults.

Fixes #1634

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Can't get llm_int8_skip_modules to work: 'Parameter' object has no attribute 'SCB'

1 participant