Instructions to use QuantFactory/granite-3.1-8b-instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/granite-3.1-8b-instruct-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/granite-3.1-8b-instruct-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/granite-3.1-8b-instruct-GGUF", filename="granite-3.1-8b-instruct.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/granite-3.1-8b-instruct-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/granite-3.1-8b-instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/granite-3.1-8b-instruct-GGUF 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 "QuantFactory/granite-3.1-8b-instruct-GGUF" \ --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": "QuantFactory/granite-3.1-8b-instruct-GGUF", "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 "QuantFactory/granite-3.1-8b-instruct-GGUF" \ --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": "QuantFactory/granite-3.1-8b-instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with Ollama:
ollama run hf.co/QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/granite-3.1-8b-instruct-GGUF 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 QuantFactory/granite-3.1-8b-instruct-GGUF 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 QuantFactory/granite-3.1-8b-instruct-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/granite-3.1-8b-instruct-GGUF to start chatting
- Pi new
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/granite-3.1-8b-instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/granite-3.1-8b-instruct-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.granite-3.1-8b-instruct-GGUF-Q4_K_M
List all available models
lemonade list
jinja2.exceptions.UndefinedError: 'strftime_now' is undefined
transformers 4.48.0
transformers-stream-generator 0.0.5
Traceback (most recent call last):
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/queueing.py", line 541, in process_events
response = await route_utils.call_process_api(
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/blocks.py", line 1928, in process_api
result = await self.call_function(
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/blocks.py", line 1526, in call_function
prediction = await utils.async_iteration(iterator)
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/utils.py", line 657, in async_iteration
return await iterator.anext()
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/utils.py", line 650, in anext
return await anyio.to_thread.run_sync(
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2134, in run_sync_in_worker_thread
return await future
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 851, in run
result = context.run(func, *args)
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/utils.py", line 633, in run_sync_iterator_async
return next(iterator)
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/gradio/utils.py", line 816, in gen_wrapper
response = next(iterator)
File "/home/user/text-generation-webui/modules/chat.py", line 443, in generate_chat_reply_wrapper
for i, history in enumerate(generate_chat_reply(text, state, regenerate, _continue, loading_message=True, for_ui=True)):
File "/home/user/text-generation-webui/modules/chat.py", line 410, in generate_chat_reply
for history in chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message, for_ui=for_ui):
File "/home/user/text-generation-webui/modules/chat.py", line 305, in chatbot_wrapper
stopping_strings = get_stopping_strings(state)
File "/home/user/text-generation-webui/modules/chat.py", line 265, in get_stopping_strings
prefix_bot, suffix_bot = get_generation_prompt(renderer, impersonate=False)
File "/home/user/text-generation-webui/modules/chat.py", line 71, in get_generation_prompt
prompt = renderer(messages=messages)
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/jinja2/environment.py", line 1295, in render
self.environment.handle_exception()
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/jinja2/environment.py", line 942, in handle_exception
raise rewrite_traceback_stack(source=source)
File "", line 5, in top-level template code
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/jinja2/sandbox.py", line 399, in call
if not __self.is_safe_callable(__obj):
File "/home/user/miniconda3/envs/textgen/lib/python3.10/site-packages/jinja2/sandbox.py", line 265, in is_safe_callable
getattr(obj, "unsafe_callable", False) or getattr(obj, "alters_data", False)
jinja2.exceptions.UndefinedError: 'strftime_now' is undefined