模型简介
模型特点
模型能力
使用案例
🚀 MythoMax L2 13B - AWQ
本项目提供了 Gryphe 的 MythoMax L2 13B 模型的 AWQ 量化版本,能有效提升推理效率。
🚀 快速开始
从 vLLM 服务此模型
安装和使用 vLLM 的文档可点击此处查看。
- 当使用 vLLM 作为服务器时,需传递
--quantization awq
参数,示例如下:
python3 python -m vllm.entrypoints.api_server --model TheBloke/MythoMax-L2-13B-AWQ --quantization awq
当从 Python 代码中使用 vLLM 时,传递 quantization=awq
参数,示例如下:
from vllm import LLM, SamplingParams
prompts = [
"Hello, my name is",
"The president of the United States is",
"The capital of France is",
"The future of AI is",
]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
llm = LLM(model="TheBloke/MythoMax-L2-13B-AWQ", quantization="awq")
outputs = llm.generate(prompts, sampling_params)
# Print the outputs.
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
从 Python 代码使用此 AWQ 模型
安装必要的包
需要 AutoAWQ 0.0.2 或更高版本:
pip3 install autoawq
若使用预构建的轮子安装 AutoAWQ 时遇到问题,可从源代码安装:
pip3 uninstall -y autoawq
git clone https://github.com/casper-hansen/AutoAWQ
cd AutoAWQ
pip3 install .
示例代码
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer
model_name_or_path = "TheBloke/MythoMax-L2-13B-AWQ"
# Load model
model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
trust_remote_code=False, safetensors=True)
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
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:")
tokens = tokenizer(
prompt_template,
return_tensors='pt'
).input_ids.cuda()
# Generate output
generation_output = model.generate(
tokens,
do_sample=True,
temperature=0.7,
top_p=0.95,
top_k=40,
max_new_tokens=512
)
print("Output: ", tokenizer.decode(generation_output[0]))
# Inference can also be done using transformers' pipeline
from transformers import 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'])
✨ 主要特性
- 高效量化:采用 AWQ 量化方法,支持 4 位量化,相比 GPTQ 能提供更快的基于 Transformer 的推理。
- 多平台支持:支持连续批处理服务器 vLLM,可在多用户服务器场景中实现高吞吐量并发推理。
- 多格式可用:提供 AWQ、GPTQ、GGUF 等多种量化格式的模型文件,以及原始的未量化 fp16 模型。
📦 安装指南
安装 vLLM
安装和使用 vLLM 的文档可点击此处查看。
安装 AutoAWQ
pip3 install autoawq
若使用预构建的轮子安装 AutoAWQ 时遇到问题,可从源代码安装:
pip3 uninstall -y autoawq
git clone https://github.com/casper-hansen/AutoAWQ
cd AutoAWQ
pip3 install .
📚 详细文档
模型信息
- 模型创建者:Gryphe
- 原始模型:MythoMax L2 13B
可用仓库
- 用于 GPU 推理的 AWQ 模型
- 具有多种量化参数选项的 GPU 推理 GPTQ 模型
- 用于 CPU+GPU 推理的 2、3、4、5、6 和 8 位 GGUF 模型
- Gryphe 原始的未量化 fp16 格式 PyTorch 模型,用于 GPU 推理和进一步转换
提示模板
{system_message}
### Instruction:
{prompt}
(For roleplay purposes, I suggest the following - Write <CHAR NAME>'s next reply in a chat between <YOUR NAME> and <CHAR NAME>. Write a single reply only.)
### Response:
提供的文件和 AWQ 参数
首次发布的 AWQ 模型仅包含 128g 模型。若有需求,后续会考虑添加 32g 模型。目前 32g 模型尚未在 AutoAWQ 和 vLLM 中完全测试。 模型以分片的 safetensors 文件形式发布。
分支 | 位数 | GS | AWQ 数据集 | 序列长度 | 大小 |
---|---|---|---|---|---|
main | 4 | 128 | wikitext | 4096 | 7.25 GB |
兼容性
提供的文件已测试可与 AutoAWQ 和 vLLM 配合使用。 Huggingface Text Generation Inference (TGI) 目前尚不支持 AWQ,但有一个 PR 正在处理中,预计很快会提供支持:TGI PR #781。
🔧 技术细节
模型合并原理
此模型是 MythoLogic-L2 和 Huginn 的合并模型,每个层由多个张量组成,这些张量负责特定功能。以 MythoLogic-L2 的强大理解能力为输入,Huginn 的广泛写作能力为输出,得到了在这两方面都表现出色的模型。
量化方法
采用 AWQ 量化方法,这是一种高效、准确且快速的低比特权重量化方法,目前支持 4 位量化。
📄 许可证
源模型的创建者将其许可证列为 other
,因此此量化版本也使用相同的许可证。
由于该模型基于 Llama 2,它也受 Meta Llama 2 许可证条款的约束,相关许可证文件也已包含在内。因此,应认为该模型同时受这两个许可证的约束。已联系 Hugging Face 以澄清双重许可问题,但他们尚未有官方立场。若情况发生变化,或 Meta 对此情况提供任何反馈,将相应更新此部分内容。
有关许可的任何问题,特别是这两个许可证如何相互作用的问题,应咨询原始模型仓库:Gryphe's MythoMax L2 13B。
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 特别提及:Alicia Loh、Stephen Murray 等众多贡献者。



