hf2ollama
A Python CLI tool that searches, downloads, and imports HuggingFace GGUF models into Ollama. Handles model discovery, quantization selection, automatic Modelfile generation, and resumable downloads.
What it does
ollama pull only works with models hosted on the Ollama registry. Most open-weight GGUF models live on HuggingFace. This tool bridges that gap: search HuggingFace for GGUF repos, pick a quantization, download the file, auto-generate the correct Modelfile with chat template and stop tokens, and import into Ollama - all in one command.
It also handles a common Python SSL issue where certifi (the default CA bundle) doesn't include certificates from the operating system's trust store. The --ssl-fix flag exports the OS certificate store and configures Python to use it.
Installation
Works on Windows, macOS, and Linux. Requires Python 3.10+.
pip install hf2ollama
From source:
git clone https://github.com/rs2pydev/hf2ollama-python-cli-tool.git
cd hf2ollama-python-cli-tool
pip install -e ".[dev]"
Quick start
# Search for models
hf2ollama search "qwen 7b gguf"
# See available quantizations and file sizes
hf2ollama list-files bartowski/Qwen2.5-Coder-7B-Instruct-GGUF
# Download and import into Ollama
hf2ollama pull bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --quant Q4_K_M
# Fix Python SSL certificate issues if downloads fail
hf2ollama pull bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --ssl-fix
# Use alternative download method (Windows, PowerShell 7 required)
hf2ollama pull bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --alt-download
Commands
pull
Download a GGUF model from HuggingFace and import into Ollama.
hf2ollama pull <repo> [--quant Q4_K_M] [--name my-model] [--keep-gguf] [--ssl-fix] [--alt-download]
Options:
--quant/-q- Quantization level (Q2_K, Q3_K_M, Q4_K_M, Q5_K_M, Q6_K, Q8_0). Default: Q4_K_M.--name/-n- Ollama model name. Auto-generated from filename if not specified.--keep-gguf- Keep the GGUF file after importing into Ollama.--ssl-fix- Use OS certificate store instead of Python's default CA bundle.--alt-download- Use alternative PowerShell-based download method (Windows only, requires PowerShell 7).
The tool auto-detects the model family from the filename and generates the correct Modelfile with chat template and stop tokens.
search
Search HuggingFace for GGUF model repositories.
hf2ollama search "llama 70b" --limit 20 --sort downloads
list-files
Show available GGUF files in a repository with their sizes.
hf2ollama list-files bartowski/Qwen2.5-Coder-7B-Instruct-GGUF
list
List locally installed Ollama models.
hf2ollama list
remove
Delete an Ollama model.
hf2ollama remove my-model:q4_k_m
info
Show details about an installed Ollama model.
hf2ollama info my-model:q4_k_m
recommend
Recommend quantization based on your GPU VRAM and model size.
# Auto-detect GPU VRAM
hf2ollama recommend --params 7
# Specify VRAM manually
hf2ollama recommend --params 70 --vram 24
network-check
Check whether HuggingFace is reachable and whether SSL certificates are configured correctly.
hf2ollama network-check
Supported model families
The tool auto-detects model families from GGUF filenames and generates the correct Ollama Modelfile:
- Llama 3 / 3.1 / 3.2 / 3.3 / 4
- Gemma (2, 3, 4)
- Qwen (2, 2.5, 3)
- Mistral / Mixtral
- Phi (3, 4)
- DeepSeek (R1, V3)
- Granite
- Command-R
- ChatML (fallback for unrecognized models)
Supported quantizations
Q2_K, Q3_K_M, Q4_K_M (default), Q5_K_M, Q6_K, Q8_0
Configuration
Persistent config is stored in ~/.hf2ollama/config.toml:
download_dir = "C:/Users/you/.hf2ollama/downloads"
default_quant = "Q4_K_M"
hf_token = "hf_xxxxx"
Requirements
- Python 3.10+
- Ollama installed locally
- For
--alt-download: Windows + PowerShell 7
Dependencies
- click - CLI framework
- httpx - HTTP client with resumable downloads
- rich - Terminal tables and progress bars
- truststore - OS certificate store access
- certifi - Public CA bundle
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hf2ollama_python_cli_tool-1.0.0.tar.gz.
File metadata
- Download URL: hf2ollama_python_cli_tool-1.0.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f7fe97e3b098550b5b1cce3c9218d62dccd96fd7e2af40da8099bf4fa1ce2c2
|
|
| MD5 |
1142d0332fe17bda38350cba1e32c29c
|
|
| BLAKE2b-256 |
ed429b9fb1026d84f79afb129364cc832891024d97c059088c0e092328a5ab04
|
Provenance
The following attestation bundles were made for hf2ollama_python_cli_tool-1.0.0.tar.gz:
Publisher:
publish.yml on rs2pydev/hf2ollama-python-cli-tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hf2ollama_python_cli_tool-1.0.0.tar.gz -
Subject digest:
9f7fe97e3b098550b5b1cce3c9218d62dccd96fd7e2af40da8099bf4fa1ce2c2 - Sigstore transparency entry: 2655191133
- Sigstore integration time:
-
Permalink:
rs2pydev/hf2ollama-python-cli-tool@fd8e8951842ce00d11645a9463c6ed40b6c9ab96 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/rs2pydev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd8e8951842ce00d11645a9463c6ed40b6c9ab96 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d0e84f80ed8931d87ffab7b72da773de30681f5fad9d8402a3742e3d3ea373
|
|
| MD5 |
5328e93aec2251e5e697b5db09a85802
|
|
| BLAKE2b-256 |
f0955b65b35a499dbc795997b23d47fb67bef13ea614e7900712b6380f827c57
|
Provenance
The following attestation bundles were made for hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on rs2pydev/hf2ollama-python-cli-tool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl -
Subject digest:
70d0e84f80ed8931d87ffab7b72da773de30681f5fad9d8402a3742e3d3ea373 - Sigstore transparency entry: 2655191136
- Sigstore integration time:
-
Permalink:
rs2pydev/hf2ollama-python-cli-tool@fd8e8951842ce00d11645a9463c6ed40b6c9ab96 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/rs2pydev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fd8e8951842ce00d11645a9463c6ed40b6c9ab96 -
Trigger Event:
push
-
Statement type: