Downloads · 30 days
22
25% of all-time downloads
TevunahAi/granite-8b-code-instruct-4k-FP8
granite-8b-code-instruct-4k-FP8 is a text generation model from TevunahAi. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
FP8 quantized version of IBM's Granite 8B Code model for efficient inference
Downloads · 30 days
22
25% of all-time downloads
All-time downloads
88
Public
Parameters
8.3B
8.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.7 GB · 100%
How the weights are stored.
F8_E4M37.9B · 95%
From the Hugging Face model README
FP8 quantized version of IBM's Granite 8B Code model for efficient inference
This is an FP8 (E4M3) quantized version of ibm-granite/granite-8b-code-instruct-4k using compressed_tensors format. Quantized by TevunahAi on enterprise-grade hardware.
For optimal performance with full FP8 benefits (2x memory savings + faster inference), use vLLM or TensorRT-LLM:
pip install vllm
Python API:
from vllm import LLM, SamplingParams
# vLLM auto-detects FP8 from model config
llm = LLM(model="TevunahAi/granite-8b-code-instruct-4k-FP8", dtype="auto")
# Generate
prompt = "Write a Python function to calculate fibonacci numbers:"
sampling_params = SamplingParams(temperature=0.7, max_tokens=256)
outputs = llm.generate([prompt], sampling_params)
for output in outputs:
print(output.outputs[0].text)
OpenAI-Compatible API Server:
vllm serve TevunahAi/granite-8b-code-instruct-4k-FP8 \
--dtype auto \
--max-model-len 4096
Then use with OpenAI client:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="token-abc123", # dummy key
)
response = client.chat.completions.create(
model="TevunahAi/granite-8b-code-instruct-4k-FP8",
messages=[
{"role": "user", "content": "Write a Python function to calculate fibonacci numbers"}
],
temperature=0.7,
max_tokens=256,
)
print(response.choices[0].message.content)
This model can also be loaded with transformers. Note: Transformers will decompress FP8 → BF16 during inference. However, at 8B parameters, this is manageable (~16GB VRAM).
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Loads FP8 weights but decompresses to BF16 during compute
model = AutoModelForCausalLM.from_pretrained(
"TevunahAi/granite-8b-code-instruct-4k-FP8",
device_map="auto",
torch_dtype="auto",
low_cpu_mem_usage=True,
)
tokenizer = AutoTokenizer.from_pretrained("TevunahAi/granite-8b-code-instruct-4k-FP8")
# Generate
prompt = "Write a Python function to calculate fibonacci numbers:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Requirements:
pip install torch>=2.1.0 transformers>=4.40.0 accelerate compressed-tensors
System Requirements:
| Property | Value |
|---|---|
| Base Model | ibm-granite/granite-8b-code-instruct-4k |
| Quantization Method | FP8 E4M3 weight-only |
| Framework | llm-compressor + compressed_tensors |
| Calibration Dataset | open_platypus (512 samples) |
| Storage Size | ~8GB (sharded safetensors) |
| VRAM (vLLM) | ~8GB |
| VRAM (Transformers) | ~16GB (decompressed to BF16) |
| Target Hardware | NVIDIA Ada (RTX 4000/5000) or Hopper (H100/GH200) |
| Quantization Time | 21.6 minutes |
Professional hardware ensures consistent, high-quality quantization:
For production inference, use vLLM to realize the full FP8 benefits.
This model is sharded into multiple safetensors files (all required for inference). The compressed format enables efficient storage and faster downloads.
Granite Code models are specifically trained for code generation, editing, and explanation tasks. This 8B parameter version offers strong performance on:
Granite 8B vs Larger Models:
This quantization is based on ibm-granite/granite-8b-code-instruct-4k by IBM.
For comprehensive information about:
Please refer to the original model card.
This model inherits the Apache 2.0 License from the original Granite model.
If you use this model, please cite the original Granite work:
@misc{granite2024,
title={Granite Code Models},
author={IBM Research},
year={2024},
url={https://huggingface.co/ibm-granite/granite-8b-code-instruct-4k}
}
Professional AI Model Quantization by TevunahAi
Enterprise-grade quantization on specialized hardware
</div>