This model was obtained by quantizing the weights and activations of
DeepSeek-R1-Distill-Llama-8B
to INT8 data type.
This optimization reduces the number of bits used to represent weights and activations from 16 to 8, reducing GPU memory requirements (by approximately 50%) and increasing matrix-multiply compute throughput (by approximately 2x).
Weight quantization also reduces disk size requirements by approximately 50%.
Only the weights and activations of the linear operators within transformers blocks are quantized.
Weights are quantized using a symmetric per-channel scheme, whereas quantizations are quantized using a symmetric per-token scheme.
The
GPTQ
algorithm is applied for quantization, as implemented in the
llm-compressor
library.
Use with vLLM
This model can be deployed efficiently using the
vLLM
backend, as shown in the example below.
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
number_gpus = 1
model_name = "neuralmagic/DeepSeek-R1-Distill-Llama-8B-quantized.w8a8"
tokenizer = AutoTokenizer.from_pretrained(model_name)
sampling_params = SamplingParams(temperature=0.6, max_tokens=256, stop_token_ids=[tokenizer.eos_token_id])
llm = LLM(model=model_name, tensor_parallel_size=number_gpus, trust_remote_code=True)
messages_list = [
[{"role": "user", "content": "Who are you? Please respond in pirate speak!"}],
]
prompt_token_ids = [tokenizer.apply_chat_template(messages, add_generation_prompt=True) for messages in messages_list]
outputs = llm.generate(prompt_token_ids=prompt_token_ids, sampling_params=sampling_params)
generated_text = [output.outputs[0].text for output in outputs]
print(generated_text)
vLLM also supports OpenAI-compatible serving. See the
documentation
for more details.
Creation
This model was created with
llm-compressor
by running the code snippet below.
from transformers import AutoModelForCausalLM, AutoTokenizer
from llmcompressor.modifiers.quantization import QuantizationModifier
from llmcompressor.modifiers.smoothquant import SmoothQuantModifier
from llmcompressor.transformers import oneshot
# Load model
model_stub = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B"
model_name = model_stub.split("/")[-1]
num_samples = 1024
max_seq_len = 8192
tokenizer = AutoTokenizer.from_pretrained(model_stub)
model = AutoModelForCausalLM.from_pretrained(
model_stub,
device_map=device_map,
torch_dtype="auto",
)
defpreprocess_fn(example):
return {"text": tokenizer.apply_chat_template(example["messages"], add_generation_prompt=False, tokenize=False)}
ds = load_dataset("neuralmagic/LLM_compression_calibration", split="train")
ds = ds.map(preprocess_fn)
# Configure the quantization algorithm and scheme
recipe = [
SmoothQuantModifier(smoothing_strength=0.8),
QuantizationModifier(
targets="Linear",
scheme="W8A8",
ignore=["lm_head"],
dampening_frac=0.1,
),
]
# Apply quantization
oneshot(
model=model,
dataset=ds,
recipe=recipe,
max_seq_length=max_seq_len,
num_calibration_samples=num_samples,
)
# Save to disk in compressed-tensors format
save_path = model_name + "-quantized.w8a8model.save_pretrained(save_path)tokenizer.save_pretrained(save_path)print(f"Model and tokenizer saved to: {save_path}")
Evaluation
The model was evaluated on OpenLLM Leaderboard
V1
and
V2
, using the following commands:
This model achieves up to 1.6x speedup in single-stream deployment and up to 1.4x speedup in multi-stream asynchronous deployment, depending on hardware and use-case scenario.
The following performance benchmarks were conducted with
vLLM
version 0.7.2, and
GuideLLM
.
DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 huggingface.co is an AI model on huggingface.co that provides DeepSeek-R1-Distill-Llama-8B-quantized.w8a8's model effect (), which can be used instantly with this neuralmagic DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 model. huggingface.co supports a free trial of the DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 model, and also provides paid use of the DeepSeek-R1-Distill-Llama-8B-quantized.w8a8. Support call DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 model through api, including Node.js, Python, http.
DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 huggingface.co is an online trial and call api platform, which integrates DeepSeek-R1-Distill-Llama-8B-quantized.w8a8's modeling effects, including api services, and provides a free online trial of DeepSeek-R1-Distill-Llama-8B-quantized.w8a8, you can try DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 online for free by clicking the link below.
neuralmagic DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 online free url in huggingface.co:
DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 is an open source model from GitHub that offers a free installation service, and any user can find DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 on GitHub to install. At the same time, huggingface.co provides the effect of DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 install, users can directly use DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
DeepSeek-R1-Distill-Llama-8B-quantized.w8a8 install url in huggingface.co: