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
Metadata
Release files for hf2ollama-python-cli-tool 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hf2ollama_python_cli_tool-1.0.0.tar.gz | 18.9 kB | With provenance | Details for hf2ollama_python_cli_tool-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl |
Total release size: 46.5 kB
Release files / hf2ollama_python_cli_tool-1.0.0.tar.gz
| Download URL | hf2ollama_python_cli_tool-1.0.0.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f7fe97e3b098550b5b1cce3c9218d62dccd96fd7e2af40da8099bf4fa1ce2c2
|
|
BLAKE2b-256 checksum How to use checksums |
ed429b9fb1026d84f79afb129364cc832891024d97c059088c0e092328a5ab04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.
Transparency logRelease files / hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl
| Download URL | hf2ollama_python_cli_tool-1.0.0-py3-none-any.whl |
|---|---|
| Size | 27.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70d0e84f80ed8931d87ffab7b72da773de30681f5fad9d8402a3742e3d3ea373
|
|
BLAKE2b-256 checksum How to use checksums |
f0955b65b35a499dbc795997b23d47fb67bef13ea614e7900712b6380f827c57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.
Transparency logSecurity for hf2ollama-python-cli-tool 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for hf2ollama_python_cli_tool-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.