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

baichuan2-7B-Chat awq fuse_layer=True error #539

Open
feipengheart opened this issue Jul 12, 2024 · 0 comments
Open

baichuan2-7B-Chat awq fuse_layer=True error #539

feipengheart opened this issue Jul 12, 2024 · 0 comments

Comments

@feipengheart
Copy link

root@localhost:/opt/AI# CUDA_VISIBLE_DEVICES=3 python Baichuan2/awq_chat.py
Xformers is not installed correctly. If you want to use memory_efficient_attention to accelerate training use the following command to install Xformers
pip install xformers.
Replacing layers...: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 32/32 [00:02<00:00, 10.70it/s]
Fusing layers...: 0%| | 0/32 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/opt/AI/Baichuan2/awq_chat.py", line 7, in
model = AutoAWQForCausalLM.from_quantized(quant_path, fuse_layers=True)
File "/usr/local/lib/python3.9/site-packages/awq/models/auto.py", line 94, in from_quantized
return AWQ_CAUSAL_LM_MODEL_MAP[model_type].from_quantized(
File "/usr/local/lib/python3.9/site-packages/awq/models/base.py", line 434, in from_quantized
self.fuse_layers(model)
File "/usr/local/lib/python3.9/site-packages/awq/models/baichuan.py", line 19, in fuse_layers
fuser.fuse_transformer()
File "/usr/local/lib/python3.9/site-packages/awq/models/baichuan.py", line 113, in fuse_transformer
module.input_layernorm.weight, module.input_layernorm.epsilon
File "/usr/local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1709, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'RMSNorm' object has no attribute 'epsilon'

inference code:
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer, TextStreamer

quant_path = "/opt/AI/models/Baichuan2-7B-Chat-awq"

Load model

model = AutoAWQForCausalLM.from_quantized(quant_path, fuse_layers=True)
tokenizer = AutoTokenizer.from_pretrained(quant_path, trust_remote_code=True)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
print(model)

prompt_template = "<reserved_106>{prompt}<reserved_107>"

prompt = "You're standing on the surface of the Earth. "
"You walk one mile south, one mile west and one mile north. "
"You end up exactly where you started. Where are you?"

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