模型概述
模型特點
模型能力
使用案例
🚀 雅典娜 v4 - GPTQ
本項目提供了 IkariDev + Undi95 的雅典娜 v4 的 GPTQ 模型文件,包含多種量化參數選項,可根據硬件和需求選擇,還介紹了不同方式的下載和使用方法。
🚀 快速開始
模型信息
屬性 | 詳情 |
---|---|
基礎模型 | IkariDev/Athena-v4 |
推理 | 否 |
許可證 | cc-by-nc-4.0 |
模型創建者 | IkariDev + Undi95 |
模型名稱 | 雅典娜 v4 |
模型類型 | llama |
提示模板 | Below is an instruction that describes a task. Write a response that appropriately completes the request.### Instruction:{prompt}### Response: |
量化者 | TheBloke |
模型倉庫
- 適用於 GPU 推理的 AWQ 模型
- 適用於 GPU 推理的 GPTQ 模型,有多種量化參數選項
- 適用於 CPU+GPU 推理的 2、3、4、5、6 和 8 位 GGUF 模型
- IkariDev + Undi95 原始的未量化 fp16 格式 PyTorch 模型,用於 GPU 推理和進一步轉換
提示模板
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{prompt}
### Response:
✨ 主要特性
- 提供多種 GPTQ 量化參數選項,可根據硬件和需求選擇最佳參數。
- 支持從不同分支下載模型,方便使用不同量化配置。
- 兼容多種推理工具和環境,如 text-generation-webui、Text Generation Inference (TGI) 等。
📦 安裝指南
在 text-generation-webui 中下載
- 從
main
分支下載,在“下載模型”框中輸入TheBloke/Athena-v4-GPTQ
。 - 從其他分支下載,在下載名稱後添加
:branchname
,例如TheBloke/Athena-v4-GPTQ:gptq-4bit-32g-actorder_True
。
從命令行下載
推薦使用 huggingface-hub
Python 庫:
pip3 install huggingface-hub
下載 main
分支到名為 Athena-v4-GPTQ
的文件夾:
mkdir Athena-v4-GPTQ
huggingface-cli download TheBloke/Athena-v4-GPTQ --local-dir Athena-v4-GPTQ --local-dir-use-symlinks False
從不同分支下載,添加 --revision
參數:
mkdir Athena-v4-GPTQ
huggingface-cli download TheBloke/Athena-v4-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Athena-v4-GPTQ --local-dir-use-symlinks False
使用 git
下載(不推薦)
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Athena-v4-GPTQ
💻 使用示例
在 text-generation-webui 中使用
- 點擊“模型”選項卡。
- 在“下載自定義模型或 LoRA”下,輸入
TheBloke/Athena-v4-GPTQ
。若從特定分支下載,輸入如TheBloke/Athena-v4-GPTQ:gptq-4bit-32g-actorder_True
。 - 點擊“下載”。
- 模型開始下載,完成後顯示“完成”。
- 在左上角,點擊“模型”旁邊的刷新圖標。
- 在“模型”下拉菜單中,選擇剛下載的模型
Athena-v4-GPTQ
。 - 模型將自動加載,即可使用。
- 若需要自定義設置,設置後點擊右上角的“保存此模型的設置”,然後點擊“重新加載模型”。
- 準備好後,點擊“文本生成”選項卡,輸入提示開始使用。
從 Python 代碼使用
安裝必要的包
pip3 install transformers optimum
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # 若使用 CUDA 11.7,使用 cu117
若使用預構建的輪子安裝 AutoGPTQ 有問題,從源代碼安裝:
pip3 uninstall -y auto-gptq
git clone https://github.com/PanQiWei/AutoGPTQ
cd AutoGPTQ
git checkout v0.4.2
pip3 install .
使用代碼示例
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_name_or_path = "TheBloke/Athena-v4-GPTQ"
# 若使用不同分支,更改 revision
# 例如: revision="gptq-4bit-32g-actorder_True"
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
device_map="auto",
trust_remote_code=False,
revision="main")
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
prompt = "Tell me about AI"
prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{prompt}
### Response:
'''
print("\n\n*** Generate:")
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
print(tokenizer.decode(output[0]))
# 也可以使用 transformers 的 pipeline 進行推理
print("*** Pipeline:")
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
max_new_tokens=512,
do_sample=True,
temperature=0.7,
top_p=0.95,
top_k=40,
repetition_penalty=1.1
)
print(pipe(prompt_template)[0]['generated_text'])
從 Text Generation Inference (TGI) 服務模型
推薦使用 TGI 版本 1.1.0 或更高版本,官方 Docker 容器為:ghcr.io/huggingface/text-generation-inference:1.1.0
示例 Docker 參數:
--model-id TheBloke/Athena-v4-GPTQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
示例 Python 代碼與 TGI 交互(需要 huggingface-hub 0.17.0 或更高版本):
pip3 install huggingface-hub
from huggingface_hub import InferenceClient
endpoint_url = "https://your-endpoint-url-here"
prompt = "Tell me about AI"
prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{prompt}
### Response:
'''
client = InferenceClient(endpoint_url)
response = client.text_generation(prompt,
max_new_tokens=128,
do_sample=True,
temperature=0.7,
top_p=0.95,
top_k=40,
repetition_penalty=1.1)
print(f"Model output: {response}")
🔧 技術細節
提供的文件和 GPTQ 參數
提供多種量化參數,每個單獨的量化在不同分支中。大多數 GPTQ 文件使用 AutoGPTQ 製作,Mistral 模型目前使用 Transformers 製作。
分支 | 比特數 | 組大小 | Act Order | Damp % | GPTQ 數據集 | 序列長度 | 大小 | ExLlama 兼容性 | 描述 |
---|---|---|---|---|---|---|---|---|---|
main | 4 | 128 | 是 | 0.1 | wikitext | 4096 | 7.26 GB | 是 | 4 位,帶有 Act Order 和組大小 128g。比 64g 使用更少的 VRAM,但準確性稍低。 |
gptq-4bit-32g-actorder_True | 4 | 32 | 是 | 0.1 | wikitext | 4096 | 8.00 GB | 是 | 4 位,帶有 Act Order 和組大小 32g。提供最高的推理質量,但使用最大的 VRAM。 |
gptq-8bit--1g-actorder_True | 8 | 無 | 是 | 0.1 | wikitext | 4096 | 13.36 GB | 否 | 8 位,帶有 Act Order。無組大小,以降低 VRAM 需求。 |
gptq-8bit-128g-actorder_True | 8 | 128 | 是 | 0.1 | wikitext | 4096 | 13.65 GB | 否 | 8 位,組大小 128g 以提高推理質量,帶有 Act Order 以提高準確性。 |
gptq-8bit-32g-actorder_True | 8 | 32 | 是 | 0.1 | wikitext | 4096 | 14.54 GB | 否 | 8 位,組大小 32g 和 Act Order 以實現最大推理質量。 |
gptq-4bit-64g-actorder_True | 4 | 64 | 是 | 0.1 | wikitext | 4096 | 7.51 GB | 是 | 4 位,帶有 Act Order 和組大小 64g。比 32g 使用更少的 VRAM,但準確性稍低。 |
GPTQ 參數解釋
- 比特數:量化模型的位大小。
- 組大小(GS):GPTQ 組大小。較高的數字使用更少的 VRAM,但量化準確性較低。“None”是最低可能值。
- Act Order:真或假。也稱為
desc_act
。真會導致更好的量化準確性。一些 GPTQ 客戶端在使用 Act Order 加組大小的模型時遇到問題,但現在通常已解決。 - Damp %:影響量化樣本處理的 GPTQ 參數。默認值為 0.01,但 0.1 會導致稍高的準確性。
- GPTQ 數據集:量化期間使用的校準數據集。使用更適合模型訓練的數據集可以提高量化準確性。請注意,GPTQ 校準數據集與用於訓練模型的數據集不同,請參考原始模型倉庫瞭解訓練數據集的詳細信息。
- 序列長度:量化使用的數據集序列長度。理想情況下,這與模型序列長度相同。對於一些非常長序列的模型(16+K),可能需要使用較低的序列長度。請注意,較低的序列長度不會限制量化模型的序列長度,它僅影響較長推理序列的量化準確性。
- ExLlama 兼容性:此文件是否可以使用 ExLlama 加載,目前 ExLlama 僅支持 4 位的 Llama 模型。
📄 許可證
源模型的創建者將其許可證列為 cc-by-nc-4.0
,因此此量化使用了相同的許可證。由於此模型基於 Llama 2,它也受 Meta Llama 2 許可證條款的約束,並且還包含了該許可證文件。因此,應認為該模型聲稱同時受這兩個許可證的約束。已聯繫 Hugging Face 以澄清雙重許可問題,但他們尚未有官方立場。如果情況發生變化,或者 Meta 對此情況提供任何反饋,將相應更新此部分。
在此期間,有關許可的任何問題,特別是這兩個許可證如何相互作用的問題,應直接諮詢原始模型倉庫:IkariDev + Undi95 的雅典娜 v4。
🔗 其他信息
兼容性
提供的文件經測試可與 AutoGPTQ 一起使用,可通過 Transformers 或直接使用 AutoGPTQ。它們也應與 Occ4m 的 GPTQ-for-LLaMa 分支 兼容。ExLlama 與 4 位的 Llama 和 Mistral 模型兼容。Huggingface Text Generation Inference (TGI) 與所有 GPTQ 模型兼容。
Discord 社區
如需進一步支持和討論這些模型及 AI 相關內容,可加入 TheBloke AI 的 Discord 服務器。
貢獻與感謝
感謝 chirper.ai 團隊和 gpus.llm-utils.org 的 Clay。如果願意貢獻,將不勝感激,這將有助於繼續提供更多模型並開展新的 AI 項目。捐贈者將在任何 AI/LLM/模型問題和請求上獲得優先支持,訪問私人 Discord 房間以及其他福利。
- Patreon:https://patreon.com/TheBlokeAI
- Ko-Fi:https://ko-fi.com/TheBlokeAI
特別感謝 Aemon Algiz 以及眾多 Patreon 支持者。
原始模型信息
模型評分
若希望自己的評分展示在此處,可在 Discord 上發送消息給 "ikaridev"。
使用的模型和配方
- Athena-v3
- Xwin-LM/Xwin-LM-13B-V0.1
- Undi95/PsyMedRP-v1-13B
- cgato/Thespis-13b-v0.2
- jondurbin/airoboros-l2-13b-3.0
Athena-v4-tmp1 = [ Athena-v3(0.85)+Xwin-LM/Xwin-LM-13B-V0.1(0.15) ]
Athena-v4-tmp2 = [ Undi95/PsyMedRP-v1-13B(0.55)+cgato/Thespis-13b-v0.2(0.45) ]
Athena-v4-tmp3 = Athena-v4-tmp1(0.55) + Athena-v4-tmp2(0.35)
Athena-v4 = Athena-v4-tmp3 + jondurbin/airoboros-l2-13b-3.0(0.1)
感謝 Undi95 為雅典娜 v2 和雅典娜 v3 提供機器,並提供相關信息。未來將使用朋友提供的合併服務器。



