Comments (5)
Hi @benglewis,
The ATEN backend is CUDA. Have you tried the Pytorch backend and using device='mps'
?
from hqq.engine.hf import HQQModelForCausalLM, AutoTokenizer
#Model and setttings
model_id = 'meta-llama/Llama-2-7b-chat-hf'
compute_dtype = torch.float16
device = 'mps'
#Load model on the CPU
######################
model = HQQModelForCausalLM.from_pretrained(model_id, torch_dtype=compute_dtype)
tokenizer = AutoTokenizer.from_pretrained(model_id)
#Quantize the model
######################
from hqq.core.quantize import *
quant_config = BaseQuantizeConfig(nbits=4, group_size=64)
model.quantize_model(quant_config=quant_config, compute_dtype=compute_dtype, device=device)
HQQLinear.set_backend(HQQBackend.PYTORCH)
from hqq.
Yes, it tried to work without the hqq_aten
, but I got an error where some of the code tried to call it. I will try to update when Iām in front of that computer
from hqq.
It shouldn't call hqq_aten at all if you set the backend to PYTORCH
or PYTORCH_COMPILE
.
Unfortunately, I don't have an M1 mac to try it out. Let me know!
from hqq.
So while that worked (in so far as it didn't crash, I didn't wait for it to finish) for quantizing, but I was not able to open an existing already quantized model. Is that known behavior? Here's the error that I got when loading the quantized model:
.../.micromamba/envs/default/lib/python3.10/site-packages/hqq/core/bitpack.py:76: UserWarning: The operator 'aten::__rshift__.Scalar' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSFallback.mm:13.)
from hqq.
Seems like the op is not implemented for the GPU, it's not an error just a warning.
from hqq.
Related Issues (20)
- smaple code doesn't run HOT 6
- Supported Model in README HOT 1
- load the model into GPU or device_map using HQQModelForCausalLM.from_pretrained? HOT 12
- How to load quantized model with flash_attn? HOT 2
- torch.compile() for quantized model HOT 3
- Issue with torchao patching with loaded model HOT 8
- Performance of quantized model HOT 1
- Problem in load from saved model HOT 2
- Add multi-gpu support for `from_quantized` call
- Compatibility Issue: TypeError for Union Type Hints with Python Versions Below 3.10 HOT 1
- Does it support Hqq optimization algorithm in diffusion models? HOT 1
- Can the quantization process be on CPU? HOT 4
- Not able to save quantized model HOT 5
- No module named 'hqq.engine' Error. HOT 2
- prepare_for_inference error HOT 17
- HQQ for convolutional layers HOT 6
- AttributeError: 'LlamaForCausalLM' object has no attribute '_setup_cache' HOT 3
- [Question] Model Outputting Gibberish After Quantization HOT 4
- AttributeError: 'HQQLinearTorchWeightOnlynt4' object has no attribute 'weight' HOT 7
- Running HQQ Quantized Models on CPU HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hqq.