Skip to content

Fix: Skip weight initialization for quantized int8 models#39491

Open
imjbassi wants to merge 1 commit intohuggingface:mainfrom
imjbassi:skip-quantized-weight-init
Open

Fix: Skip weight initialization for quantized int8 models#39491
imjbassi wants to merge 1 commit intohuggingface:mainfrom
imjbassi:skip-quantized-weight-init

Conversation

@imjbassi
Copy link
Copy Markdown

Fixes #39366 by skipping weight initialization when all model parameters are non-floating-point types (e.g., int8 from W8A8 quantized models). This avoids a RuntimeError from PyTorch's normal_() function, which cannot handle integer dtypes.

Adds a conditional check inside _load_pretrained_model to skip self.initialize_weights() when appropriate.

Tested to ensure model loads without crashing for quantized cases.

@Rocketknight1
Copy link
Copy Markdown
Member

cc @SunMarc @MekkCyber

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.

RuntimeError when loading llmcompressor W8A8 quantized model: int8 dtype in weight initialization

2 participants