base_model: DiscoResearch/DiscoLM_German_7b_v1
inference: false
language:
-
德语
-
英语
license: apache-2.0
model-index:
-
name: DiscoLM_German_7b_v1
results: []
model_creator: Disco Research
model_name: DiscoLM German 7B v1
model_type: mistral
prompt_template: '<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
'
quantized_by: TheBloke
tags:
-
Mistral
-
微调
-
chatml
-
DPO
-
德语
-
Deutsch
-
合成数据
DiscoLM German 7B v1 - AWQ
描述
本仓库包含Disco Research的DiscoLM German 7B v1的AWQ模型文件。
这些文件由Massed Compute慷慨提供的硬件进行了量化。
关于AWQ
AWQ是一种高效、准确且极速的低比特权重量化方法,目前支持4比特量化。与GPTQ相比,它在基于Transformers的推理中提供了更快的速度,同时保持与最常用GPTQ设置相当或更好的质量。
AWQ模型目前支持Linux和Windows系统,仅限NVIDIA GPU。macOS用户请使用GGUF模型。
支持以下平台:
可用仓库
提示模板:ChatML
<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
提供的文件及AWQ参数
目前仅发布128g GEMM模型。正在积极考虑添加group_size 32模型和GEMV内核模型。
模型以分片safetensors文件形式发布。
请确保您使用的是最新版本的text-generation-webui。
强烈建议使用text-generation-webui的一键安装程序,除非您确定如何进行手动安装。
- 点击模型选项卡。
- 在下载自定义模型或LoRA下,输入
TheBloke/DiscoLM_German_7b_v1-AWQ
。
- 点击下载。
- 模型将开始下载。完成后会显示“完成”。
- 在左上角,点击模型旁边的刷新图标。
- 在模型下拉菜单中,选择您刚刚下载的模型:
DiscoLM_German_7b_v1-AWQ
- 选择加载器:AutoAWQ。
- 点击加载,模型将加载并准备就绪。
- 如果需要任何自定义设置,设置后点击保存此模型的设置,然后在右上角点击重新加载模型。
- 准备就绪后,点击文本生成选项卡并输入提示开始!
多用户推理服务器:vLLM
安装和使用vLLM的文档可在此处找到。
- 请确保使用vLLM版本0.2或更高。
- 使用vLLM作为服务器时,传递
--quantization awq
参数。
例如:
python3 -m vllm.entrypoints.api_server --model TheBloke/DiscoLM_German_7b_v1-AWQ --quantization awq --dtype auto
- 在Python代码中使用vLLM时,同样设置
quantization=awq
。
例如:
from vllm import LLM, SamplingParams
prompts = [
"告诉我关于AI的事情",
"写一个关于美洲驼的故事",
"291减150等于多少?",
"如果一只土拨鼠能扔木头,它能扔多少木头?",
]
prompt_template=f'''<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
'''
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
llm = LLM(model="TheBloke/DiscoLM_German_7b_v1-AWQ", quantization="awq", dtype="auto")
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"提示:{prompt!r}, 生成文本:{generated_text!r}")
多用户推理服务器:Hugging Face文本生成推理(TGI)
使用TGI版本1.1.0或更高。官方Docker容器为:ghcr.io/huggingface/text-generation-inference:1.1.0
示例Docker参数:
--model-id TheBloke/DiscoLM_German_7b_v1-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
与TGI交互的Python代码示例(需要huggingface-hub 0.17.0或更高):
pip3 install huggingface-hub
from huggingface_hub import InferenceClient
endpoint_url = "https://your-endpoint-url-here"
prompt = "告诉我关于AI的事情"
prompt_template=f'''<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
'''
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"模型输出:", response)
使用Transformers从Python代码进行推理
安装必要的包
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
注意:如果您使用PyTorch 2.0.1,上述AutoAWQ命令将自动升级到PyTorch 2.1.0。
如果您使用CUDA 11.8并希望继续使用PyTorch 2.0.1,请运行以下命令:
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
如果使用预构建的wheel安装AutoAWQ遇到问题,请从源码安装:
pip3 uninstall -y autoawq
git clone https://github.com/casper-hansen/AutoAWQ
cd AutoAWQ
pip3 install .
Transformers示例代码(需要Transformers 4.35.0及更高)
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model_name_or_path = "TheBloke/DiscoLM_German_7b_v1-AWQ"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModelForCausalLM.from_pretrained(
model_name_or_path,
low_cpu_mem_usage=True,
device_map="cuda:0"
)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
prompt = "告诉我关于AI的事情"
prompt_template=f'''<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
'''
tokens = tokenizer(
prompt_template,
return_tensors='pt'
).input_ids.cuda()
generation_params = {
"do_sample": True,
"temperature": 0.7,
"top_p