Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TorchAo autoquant + hugging face breaks on Load #1819

Open
drisspg opened this issue Mar 3, 2025 · 0 comments
Open

TorchAo autoquant + hugging face breaks on Load #1819

drisspg opened this issue Mar 3, 2025 · 0 comments

Comments

@drisspg
Copy link
Contributor

drisspg commented Mar 3, 2025

Summary

Repro:

import torch
from transformers import TorchAoConfig, AutoModelForCausalLM, AutoTokenizer

model_name = "meta-llama/Meta-Llama-3-8B"
quantization_config = TorchAoConfig("autoquant", min_sqnr=None)
quantized_model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto", quantization_config=quantization_config)

output_dir = "llama3-8b-int4wo-128"
quantized_model.save_pretrained(output_dir, safe_serialization=False)

ckpt_id = "llama3-8b-int4wo-128"  # or huggingface hub model id
loaded_quantized_model = AutoModelForCausalLM.from_pretrained(ckpt_id, device_map="auto", torch_dtype="auto")

First errror:
is that we dont add AutoQuantizableLinearWeight to safe globals

Second is that HF on main will try and slice our param: https://github.com/huggingface/transformers/blob/0463901c92e08cefbccf19f409b6cc43c153352d/src/transformers/modeling_utils.py#L907

And we dont implement -> we also just print an error which is werid to me..

print(f"ERR: subclass doesn't implement {func}")

is this because of how we do quantization? IF so we def SHOULD NOT have this a catch all error and narrow down the exception type

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

No branches or pull requests

1 participant