🚀 QwQ-32B量化模型
本項目是基於GPTQ技術對Qwen/QwQ-32B模型進行量化後的成果,可用於文本生成任務,在降低模型存儲和計算成本的同時,保持了較好的性能。
🚀 快速開始
環境準備
確保你已經安裝了必要的庫,如transformers
和gptqmodel
。
代碼示例
from transformers import AutoTokenizer
from gptqmodel import GPTQModel
tokenizer = AutoTokenizer.from_pretrained("ModelCloud/QwQ-32B-gptqmodel-4bit-vortex-v1")
model = GPTQModel.load("ModelCloud/QwQ-32B-gptqmodel-4bit-vortex-v1")
messages = [
{"role": "user", "content": "How many r's are in the word \"strawberry\""},
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_ids=input_tensor.to(model.device), max_new_tokens=512)
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)
✨ 主要特性
- 量化技術:使用GPTQModel進行量化,將模型量化為4位,有效降低存儲和計算成本。
- 多參數配置:支持多種量化參數配置,如
group_size
、desc_act
等,可根據需求進行調整。
📦 安裝指南
暫未提供相關安裝步驟,你可以根據transformers
和gptqmodel
的官方文檔進行安裝。
💻 使用示例
基礎用法
from transformers import AutoTokenizer
from gptqmodel import GPTQModel
tokenizer = AutoTokenizer.from_pretrained("ModelCloud/QwQ-32B-gptqmodel-4bit-vortex-v1")
model = GPTQModel.load("ModelCloud/QwQ-32B-gptqmodel-4bit-vortex-v1")
messages = [
{"role": "user", "content": "How many r's are in the word \"strawberry\""},
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_ids=input_tensor.to(model.device), max_new_tokens=512)
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)
高級用法
目前暫未提供高級用法示例,你可以根據實際需求對代碼進行擴展。
📚 詳細文檔
模型信息
屬性 |
詳情 |
基礎模型 |
Qwen/QwQ-32B |
任務類型 |
文本生成 |
標籤 |
gptqmodel、modelcloud、chat、qwen2、qwq、instruct、int4、gptq、4bit |
量化參數
參數 |
值 |
量化位數 |
4 |
動態量化 |
null |
分組大小 |
32 |
激活描述 |
true |
靜態分組 |
false |
對稱量化 |
true |
語言模型頭量化 |
false |
真正順序量化 |
true |
量化方法 |
gptq |
檢查點格式 |
gptq |
元信息
參數 |
值 |
量化器 |
gptqmodel:2.0.0 |
量化器鏈接 |
https://github.com/modelcloud/gptqmodel |
阻尼百分比 |
0.1 |
阻尼自動增量 |
0.0025 |
📄 許可證
本模型使用Apache-2.0許可證。