This model was obtained by quantizing the weights of
ibm-granite/granite-3.1-2b-instruct
to INT4 data type, ready for inference with vLLM >= 0.5.2.
This optimization reduces the number of bits per parameter from 16 to 4, reducing the disk size and GPU memory requirements by approximately 75%. Only the weights of the linear operators within transformers blocks are quantized.
Deployment
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
max_model_len, tp_size = 4096, 1
model_name = "neuralmagic/granite-3.1-2b-instruct-quantized.w4a16"
tokenizer = AutoTokenizer.from_pretrained(model_name)
llm = LLM(model=model_name, tensor_parallel_size=tp_size, max_model_len=max_model_len, trust_remote_code=True)
sampling_params = SamplingParams(temperature=0.3, max_tokens=256, stop_token_ids=[tokenizer.eos_token_id])
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.
This model achieves up to 1.9x speedup in single-stream deployment, depending on hardware and use-case scenario.
The following performance benchmarks were conducted with
vLLM
version 0.6.6.post1, and
GuideLLM
.
granite-3.1-2b-instruct-quantized.w4a16 huggingface.co is an AI model on huggingface.co that provides granite-3.1-2b-instruct-quantized.w4a16's model effect (), which can be used instantly with this RedHatAI granite-3.1-2b-instruct-quantized.w4a16 model. huggingface.co supports a free trial of the granite-3.1-2b-instruct-quantized.w4a16 model, and also provides paid use of the granite-3.1-2b-instruct-quantized.w4a16. Support call granite-3.1-2b-instruct-quantized.w4a16 model through api, including Node.js, Python, http.
granite-3.1-2b-instruct-quantized.w4a16 huggingface.co is an online trial and call api platform, which integrates granite-3.1-2b-instruct-quantized.w4a16's modeling effects, including api services, and provides a free online trial of granite-3.1-2b-instruct-quantized.w4a16, you can try granite-3.1-2b-instruct-quantized.w4a16 online for free by clicking the link below.
RedHatAI granite-3.1-2b-instruct-quantized.w4a16 online free url in huggingface.co:
granite-3.1-2b-instruct-quantized.w4a16 is an open source model from GitHub that offers a free installation service, and any user can find granite-3.1-2b-instruct-quantized.w4a16 on GitHub to install. At the same time, huggingface.co provides the effect of granite-3.1-2b-instruct-quantized.w4a16 install, users can directly use granite-3.1-2b-instruct-quantized.w4a16 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
granite-3.1-2b-instruct-quantized.w4a16 install url in huggingface.co: