Text Generation
Transformers
Safetensors
granitemoehybrid
language
unsloth
granite-4.0
conversational
compressed-tensors
Instructions to use unsloth/granite-4.0-h-tiny-FP8-Dynamic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/granite-4.0-h-tiny-FP8-Dynamic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/granite-4.0-h-tiny-FP8-Dynamic") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/granite-4.0-h-tiny-FP8-Dynamic") model = AutoModelForCausalLM.from_pretrained("unsloth/granite-4.0-h-tiny-FP8-Dynamic") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use unsloth/granite-4.0-h-tiny-FP8-Dynamic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/granite-4.0-h-tiny-FP8-Dynamic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/granite-4.0-h-tiny-FP8-Dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/granite-4.0-h-tiny-FP8-Dynamic
- SGLang
How to use unsloth/granite-4.0-h-tiny-FP8-Dynamic with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "unsloth/granite-4.0-h-tiny-FP8-Dynamic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/granite-4.0-h-tiny-FP8-Dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "unsloth/granite-4.0-h-tiny-FP8-Dynamic" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/granite-4.0-h-tiny-FP8-Dynamic", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use unsloth/granite-4.0-h-tiny-FP8-Dynamic with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/granite-4.0-h-tiny-FP8-Dynamic to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/granite-4.0-h-tiny-FP8-Dynamic to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/granite-4.0-h-tiny-FP8-Dynamic to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="unsloth/granite-4.0-h-tiny-FP8-Dynamic", max_seq_length=2048, ) - Docker Model Runner
How to use unsloth/granite-4.0-h-tiny-FP8-Dynamic with Docker Model Runner:
docker model run hf.co/unsloth/granite-4.0-h-tiny-FP8-Dynamic
Add files using upload-large-folder tool
Browse files- config.json +9 -5
- generation_config.json +1 -1
- model-00001-of-00002.safetensors +1 -1
- model-00002-of-00002.safetensors +2 -2
- model.safetensors.index.json +2 -3
config.json
CHANGED
|
@@ -88,9 +88,11 @@
|
|
| 88 |
"num_bits": 8,
|
| 89 |
"observer": null,
|
| 90 |
"observer_kwargs": {},
|
|
|
|
| 91 |
"strategy": "token",
|
| 92 |
"symmetric": true,
|
| 93 |
-
"type": "float"
|
|
|
|
| 94 |
},
|
| 95 |
"output_activations": null,
|
| 96 |
"targets": [
|
|
@@ -105,9 +107,11 @@
|
|
| 105 |
"num_bits": 8,
|
| 106 |
"observer": "minmax",
|
| 107 |
"observer_kwargs": {},
|
|
|
|
| 108 |
"strategy": "channel",
|
| 109 |
"symmetric": true,
|
| 110 |
-
"type": "float"
|
|
|
|
| 111 |
}
|
| 112 |
}
|
| 113 |
},
|
|
@@ -161,7 +165,7 @@
|
|
| 161 |
"quantization_status": "compressed",
|
| 162 |
"sparsity_config": {},
|
| 163 |
"transform_config": {},
|
| 164 |
-
"version": "0.12.
|
| 165 |
},
|
| 166 |
"residual_multiplier": 0.22,
|
| 167 |
"rms_norm_eps": 1e-05,
|
|
@@ -169,8 +173,8 @@
|
|
| 169 |
"rope_theta": 10000,
|
| 170 |
"router_aux_loss_coef": 0.0,
|
| 171 |
"shared_intermediate_size": 1024,
|
| 172 |
-
"tie_word_embeddings":
|
| 173 |
-
"transformers_version": "4.57.
|
| 174 |
"unsloth_fixed": true,
|
| 175 |
"use_cache": true,
|
| 176 |
"vocab_size": 100352
|
|
|
|
| 88 |
"num_bits": 8,
|
| 89 |
"observer": null,
|
| 90 |
"observer_kwargs": {},
|
| 91 |
+
"scale_dtype": null,
|
| 92 |
"strategy": "token",
|
| 93 |
"symmetric": true,
|
| 94 |
+
"type": "float",
|
| 95 |
+
"zp_dtype": null
|
| 96 |
},
|
| 97 |
"output_activations": null,
|
| 98 |
"targets": [
|
|
|
|
| 107 |
"num_bits": 8,
|
| 108 |
"observer": "minmax",
|
| 109 |
"observer_kwargs": {},
|
| 110 |
+
"scale_dtype": null,
|
| 111 |
"strategy": "channel",
|
| 112 |
"symmetric": true,
|
| 113 |
+
"type": "float",
|
| 114 |
+
"zp_dtype": null
|
| 115 |
}
|
| 116 |
}
|
| 117 |
},
|
|
|
|
| 165 |
"quantization_status": "compressed",
|
| 166 |
"sparsity_config": {},
|
| 167 |
"transform_config": {},
|
| 168 |
+
"version": "0.12.3.a20251114"
|
| 169 |
},
|
| 170 |
"residual_multiplier": 0.22,
|
| 171 |
"rms_norm_eps": 1e-05,
|
|
|
|
| 173 |
"rope_theta": 10000,
|
| 174 |
"router_aux_loss_coef": 0.0,
|
| 175 |
"shared_intermediate_size": 1024,
|
| 176 |
+
"tie_word_embeddings": true,
|
| 177 |
+
"transformers_version": "4.57.1",
|
| 178 |
"unsloth_fixed": true,
|
| 179 |
"use_cache": true,
|
| 180 |
"vocab_size": 100352
|
generation_config.json
CHANGED
|
@@ -4,5 +4,5 @@
|
|
| 4 |
"eos_token_id": 100257,
|
| 5 |
"max_length": 131072,
|
| 6 |
"pad_token_id": 100256,
|
| 7 |
-
"transformers_version": "4.57.
|
| 8 |
}
|
|
|
|
| 4 |
"eos_token_id": 100257,
|
| 5 |
"max_length": 131072,
|
| 6 |
"pad_token_id": 100256,
|
| 7 |
+
"transformers_version": "4.57.1"
|
| 8 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4999103976
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e80671bd29d8523c598fa21fb569c79ae06e3102f701f27f326cccd5a7f35917
|
| 3 |
size 4999103976
|
model-00002-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:963e7dcb29b2a8249147a492b1650b108695a71ee01f1d6615c18767ad183fd6
|
| 3 |
+
size 2112945144
|
model.safetensors.index.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
-
"total_parameters":
|
| 4 |
-
"total_size":
|
| 5 |
},
|
| 6 |
"weight_map": {
|
| 7 |
-
"lm_head.weight": "model-00002-of-00002.safetensors",
|
| 8 |
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
| 9 |
"model.layers.0.block_sparse_moe.input_linear.weight": "model-00001-of-00002.safetensors",
|
| 10 |
"model.layers.0.block_sparse_moe.input_linear.weight_scale": "model-00001-of-00002.safetensors",
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
+
"total_parameters": 6946038016,
|
| 4 |
+
"total_size": 7111950848
|
| 5 |
},
|
| 6 |
"weight_map": {
|
|
|
|
| 7 |
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
| 8 |
"model.layers.0.block_sparse_moe.input_linear.weight": "model-00001-of-00002.safetensors",
|
| 9 |
"model.layers.0.block_sparse_moe.input_linear.weight_scale": "model-00001-of-00002.safetensors",
|