Text Generation
Transformers
Safetensors
granite
granite-4.2
reasoning
thinking
tool-calling
ibm
conversational
Instructions to use PYTHAI/granite-4.2-3b-fork with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PYTHAI/granite-4.2-3b-fork with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PYTHAI/granite-4.2-3b-fork") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PYTHAI/granite-4.2-3b-fork") model = AutoModelForCausalLM.from_pretrained("PYTHAI/granite-4.2-3b-fork", device_map="auto") 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 Settings
- vLLM
How to use PYTHAI/granite-4.2-3b-fork with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PYTHAI/granite-4.2-3b-fork" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PYTHAI/granite-4.2-3b-fork", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PYTHAI/granite-4.2-3b-fork
- SGLang
How to use PYTHAI/granite-4.2-3b-fork 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 "PYTHAI/granite-4.2-3b-fork" \ --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": "PYTHAI/granite-4.2-3b-fork", "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 "PYTHAI/granite-4.2-3b-fork" \ --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": "PYTHAI/granite-4.2-3b-fork", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PYTHAI/granite-4.2-3b-fork with Docker Model Runner:
docker model run hf.co/PYTHAI/granite-4.2-3b-fork
Download FORK.json from PYTHAI/granite-4.2-3b-fork: direct link, hf CLI and curl.
- Browser
- Download file 2.9 kB
-
https://huggingface.co/PYTHAI/granite-4.2-3b-fork/resolve/main/FORK.json
- Command line
-
hf download hf://PYTHAI/granite-4.2-3b-fork/FORK.json
-
curl -L -o FORK.json https://huggingface.co/PYTHAI/granite-4.2-3b-fork/resolve/main/FORK.json
2.9 kB
| { | |
| "kind": "licence-locked pointer fork", | |
| "source_repo": "ibm-granite/granite-4.2-3b", | |
| "source_url": "https://huggingface.co/ibm-granite/granite-4.2-3b", | |
| "source_commit": "e459acceac81e5fe67c07d9cfc72329a332e7eb1", | |
| "forked_at_utc": "2026-09-13T23:55:35Z", | |
| "licence_tag": "apache-2.0", | |
| "licence_file": { | |
| "path": "LICENSE", | |
| "bytes": 11544, | |
| "sha256": "bbedc3fda3305820b977265f01b8619d87570a6739de3a5582c3464840f1e57a", | |
| "provenance": "upstream ships no LICENSE file at this commit; its model card declares license: apache-2.0. The Apache License 2.0 text was added here, byte-identical to the LICENSE in Qwen/Qwen3.8-27B at 1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0, because Apache-2.0 section 4(a) requires a copy of the licence with any redistribution." | |
| }, | |
| "weights_copied": false, | |
| "weights_not_copied": { | |
| "files": 2, | |
| "bytes": 7319517120 | |
| }, | |
| "parameters": 3659737600, | |
| "load_weights_with": "from_pretrained('ibm-granite/granite-4.2-3b', revision='e459acceac81e5fe67c07d9cfc72329a332e7eb1')", | |
| "files": [ | |
| { | |
| "path": "README.md", | |
| "bytes": 35640, | |
| "sha256": "8f22ddce440f0c15ecb58fc9f8501b882baf5f2b7ab0d13872fe77d88c1ad792" | |
| }, | |
| { | |
| "path": "chat_template.jinja", | |
| "bytes": 9013, | |
| "sha256": "f0ba43f79b3cabca5e5a7584c77aec92f49feae45cdf7779c87d9fc54cd90258" | |
| }, | |
| { | |
| "path": "config.json", | |
| "bytes": 905, | |
| "sha256": "e4f44b9c6924a283f1d1d36057a89f1a04404bf1561fc2c0b64cf98180e72915" | |
| }, | |
| { | |
| "path": "generation_config.json", | |
| "bytes": 207, | |
| "sha256": "1b9baf0a7959d31d7fb58ff6b506c27d09a73d395cadccc7e6dd1d4b7e43fd9d" | |
| }, | |
| { | |
| "path": "granite_thinking_parser.py", | |
| "bytes": 4649, | |
| "sha256": "cd5eef99f559f33dc402e0475174a97dcb43724d7e810149c702e9bbc473048a" | |
| }, | |
| { | |
| "path": "merges.txt", | |
| "bytes": 916646, | |
| "sha256": "b6fe424e334903f7fb84d3a106d9730455f4744b9fe3c21ee136d97a00e72502" | |
| }, | |
| { | |
| "path": "model.safetensors.index.json", | |
| "bytes": 31356, | |
| "sha256": "281a9fd788ed108b66ec5fc6e4147c882a9a3c2e8571930029ad19103b23eca8" | |
| }, | |
| { | |
| "path": "model.sig", | |
| "bytes": 10989, | |
| "sha256": "13d9d24518aa7708a92950a4a7ec25744d0dc66885b504af0cf8cc6212cc51f3" | |
| }, | |
| { | |
| "path": "special_tokens_map.json", | |
| "bytes": 563, | |
| "sha256": "e9435fefd6d838fd9fcbbc44b97a8e3ff322be7f6dfb7e4fd2468586574bb52b" | |
| }, | |
| { | |
| "path": "tokenizer.json", | |
| "bytes": 7153414, | |
| "sha256": "883975314d58743726347caaf2c32ac89afd5ad57222cffbc4f052f2ab27b2d7" | |
| }, | |
| { | |
| "path": "tokenizer_config.json", | |
| "bytes": 17677, | |
| "sha256": "2007f26df166ed10a2d6fa881c1c8f3cdd151e451469f59b274897f14449835f" | |
| }, | |
| { | |
| "path": "vocab.json", | |
| "bytes": 1612694, | |
| "sha256": "a1be0c1e0a89b5bacda6af6f8b63df09668cb8d1f656229ee9123140c9507810" | |
| } | |
| ], | |
| "why": "preserve the licence terms of this exact commit and pin the revision; the weights stay at the source and are addressed by commit sha", | |
| "forked_by": "mindX (PYTHAI) via the node token" | |
| } |