hf2ollama-python-cli-tool 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.5
2
+ Name: hf2ollama-python-cli-tool
3
+ Version: 1.0.0
4
+ Summary: Search, download, and import HuggingFace GGUF models into Ollama
5
+ Project-URL: Repository, https://github.com/rs2pydev/hf2ollama-python-cli-tool
6
+ Author: Tanmoy Dutta
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: gguf,huggingface,llm,model-management,ollama
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: certifi
21
+ Requires-Dist: click>=8.0
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: truststore>=0.9
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == 'dev'
27
+ Requires-Dist: respx>=0.21; extra == 'dev'
28
+ Requires-Dist: ruff>=0.4; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # hf2ollama
32
+
33
+ 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.
34
+
35
+ ## What it does
36
+
37
+ `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.
38
+
39
+ 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.
40
+
41
+ ## Installation
42
+
43
+ Works on Windows, macOS, and Linux. Requires Python 3.10+.
44
+
45
+ ```shell
46
+ pip install hf2ollama
47
+ ```
48
+
49
+ From source:
50
+
51
+ ```shell
52
+ git clone https://github.com/rs2pydev/hf2ollama-python-cli-tool.git
53
+ cd hf2ollama-python-cli-tool
54
+ pip install -e ".[dev]"
55
+ ```
56
+
57
+ ## Quick start
58
+
59
+ ```shell
60
+ # Search for models
61
+ hf2ollama search "qwen 7b gguf"
62
+
63
+ # See available quantizations and file sizes
64
+ hf2ollama list-files bartowski/Qwen2.5-Coder-7B-Instruct-GGUF
65
+
66
+ # Download and import into Ollama
67
+ hf2ollama pull bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --quant Q4_K_M
68
+
69
+ # Fix Python SSL certificate issues if downloads fail
70
+ hf2ollama pull bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --ssl-fix
71
+
72
+ # Use alternative download method (Windows, PowerShell 7 required)
73
+ hf2ollama pull bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --alt-download
74
+ ```
75
+
76
+ ## Commands
77
+
78
+ ### pull
79
+
80
+ Download a GGUF model from HuggingFace and import into Ollama.
81
+
82
+ ```shell
83
+ hf2ollama pull <repo> [--quant Q4_K_M] [--name my-model] [--keep-gguf] [--ssl-fix] [--alt-download]
84
+ ```
85
+
86
+ Options:
87
+
88
+ - `--quant` / `-q` - Quantization level (Q2_K, Q3_K_M, Q4_K_M, Q5_K_M, Q6_K, Q8_0). Default: Q4_K_M.
89
+ - `--name` / `-n` - Ollama model name. Auto-generated from filename if not specified.
90
+ - `--keep-gguf` - Keep the GGUF file after importing into Ollama.
91
+ - `--ssl-fix` - Use OS certificate store instead of Python's default CA bundle.
92
+ - `--alt-download` - Use alternative PowerShell-based download method (Windows only, requires PowerShell 7).
93
+
94
+ The tool auto-detects the model family from the filename and generates the correct Modelfile with chat template and stop tokens.
95
+
96
+ ### search
97
+
98
+ Search HuggingFace for GGUF model repositories.
99
+
100
+ ```shell
101
+ hf2ollama search "llama 70b" --limit 20 --sort downloads
102
+ ```
103
+
104
+ ### list-files
105
+
106
+ Show available GGUF files in a repository with their sizes.
107
+
108
+ ```shell
109
+ hf2ollama list-files bartowski/Qwen2.5-Coder-7B-Instruct-GGUF
110
+ ```
111
+
112
+ ### list
113
+
114
+ List locally installed Ollama models.
115
+
116
+ ```shell
117
+ hf2ollama list
118
+ ```
119
+
120
+ ### remove
121
+
122
+ Delete an Ollama model.
123
+
124
+ ```shell
125
+ hf2ollama remove my-model:q4_k_m
126
+ ```
127
+
128
+ ### info
129
+
130
+ Show details about an installed Ollama model.
131
+
132
+ ```shell
133
+ hf2ollama info my-model:q4_k_m
134
+ ```
135
+
136
+ ### recommend
137
+
138
+ Recommend quantization based on your GPU VRAM and model size.
139
+
140
+ ```shell
141
+ # Auto-detect GPU VRAM
142
+ hf2ollama recommend --params 7
143
+
144
+ # Specify VRAM manually
145
+ hf2ollama recommend --params 70 --vram 24
146
+ ```
147
+
148
+ ### network-check
149
+
150
+ Check whether HuggingFace is reachable and whether SSL certificates are configured correctly.
151
+
152
+ ```shell
153
+ hf2ollama network-check
154
+ ```
155
+
156
+ ## Supported model families
157
+
158
+ The tool auto-detects model families from GGUF filenames and generates the correct Ollama Modelfile:
159
+
160
+ - Llama 3 / 3.1 / 3.2 / 3.3 / 4
161
+ - Gemma (2, 3, 4)
162
+ - Qwen (2, 2.5, 3)
163
+ - Mistral / Mixtral
164
+ - Phi (3, 4)
165
+ - DeepSeek (R1, V3)
166
+ - Granite
167
+ - Command-R
168
+ - ChatML (fallback for unrecognized models)
169
+
170
+ ## Supported quantizations
171
+
172
+ Q2_K, Q3_K_M, Q4_K_M (default), Q5_K_M, Q6_K, Q8_0
173
+
174
+ ## Configuration
175
+
176
+ Persistent config is stored in `~/.hf2ollama/config.toml`:
177
+
178
+ ```toml
179
+ download_dir = "C:/Users/you/.hf2ollama/downloads"
180
+ default_quant = "Q4_K_M"
181
+ hf_token = "hf_xxxxx"
182
+ ```
183
+
184
+ ## Requirements
185
+
186
+ - Python 3.10+
187
+ - Ollama installed locally
188
+ - For `--alt-download`: Windows + PowerShell 7
189
+
190
+ ## Dependencies
191
+
192
+ - click - CLI framework
193
+ - httpx - HTTP client with resumable downloads
194
+ - rich - Terminal tables and progress bars
195
+ - truststore - OS certificate store access
196
+ - certifi - Public CA bundle
197
+
198
+ ## License
199
+
200
+ MIT
@@ -0,0 +1,24 @@
1
+ hf2ollama/__init__.py,sha256=u4aaDMltD1BbvSdlfZQewQsaFoVbafEf3wdHccpHQUo,107
2
+ hf2ollama/cli.py,sha256=0JDujTIUDJV9Rk8OPou74s89jGRFdWeJYa2cx2rilf4,10879
3
+ hf2ollama/core/__init__.py,sha256=qzmey-_8Gn3vLix4pBLQq5h-eQNiVcyJiB7NN2l8ILc,77
4
+ hf2ollama/core/config.py,sha256=JbKg1C7bbVE8HQsD6-r01fqyXEAzcNPgqaPwd9ucrYk,2140
5
+ hf2ollama/core/ollama.py,sha256=4ghLiK9DQFPb-YoPJGBx2fvv2pZyODQCwU07rLRxyl8,3451
6
+ hf2ollama/hf/__init__.py,sha256=6eD_Q6fcUdM5glDIzAtw3pj_B76Q9Ww8_jioxbTvGvI,63
7
+ hf2ollama/hf/alt_download.py,sha256=jYnx89CGjvVwB1YWFnRy-fgSqnDucVccC22eU3O7Chg,1877
8
+ hf2ollama/hf/api.py,sha256=TV_Tp_utnND_xqOShLf7nD5wng6QGBQuYe_0GfeVk2g,4856
9
+ hf2ollama/hf/download.py,sha256=JOSmAwOgb9BfFz6iPKd_SMiuIavFnJH5f74XG9Mr4gw,3356
10
+ hf2ollama/modelfile/__init__.py,sha256=X-_-Cv5sAxqg_5m4IC8V2T01oVM7y3ZlisXkgilJGXA,72
11
+ hf2ollama/modelfile/generator.py,sha256=qfzbNhEe-to-WgwYBGpo26lKaTtGBdzcc5poBpJ2uIY,2299
12
+ hf2ollama/modelfile/templates.py,sha256=2-P2ve3Hw2qF_TSs4fo5_m_DZqIw9FA-WyoyAxTJ-L8,4537
13
+ hf2ollama/network/__init__.py,sha256=1_d4a9VusKoERwpvuNJiT4A62Uu3Wz6AH6MsDAAc0jo,76
14
+ hf2ollama/network/detect.py,sha256=XIH3MSPm2xXHBUgsMhah2n1jCnjvS4ptMygA8_tshDQ,1715
15
+ hf2ollama/network/ssl_fix.py,sha256=zhMXhirHtWRhJIFU9_smzY6h7P7ifY0UumnzKv1gNBw,2125
16
+ hf2ollama/scripts/HfDownload.ps1,sha256=MFvU4DTjapW05eB8x4gsCg9jN0ERLFXD7xAjWUHjeoo,8955
17
+ hf2ollama/utils/__init__.py,sha256=Q3PTIhsN4KTYUqjuOVNVDa0sPjeHiBN6CwVgvyXZ6wg,63
18
+ hf2ollama/utils/vram.py,sha256=zZhFtbFHg1ai8ABPmbKTlA4q_t2daB6rIQW873IFlsA,1743
19
+ hf2ollama_python_cli_tool-1.0.0.data/data/hf2ollama/scripts/HfDownload.ps1,sha256=MFvU4DTjapW05eB8x4gsCg9jN0ERLFXD7xAjWUHjeoo,8955
20
+ hf2ollama_python_cli_tool-1.0.0.dist-info/METADATA,sha256=ZSFChGCGDU8ODGzw4RnY1v6t3PJQCph4OG5s4Dfg0yo,5392
21
+ hf2ollama_python_cli_tool-1.0.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
22
+ hf2ollama_python_cli_tool-1.0.0.dist-info/entry_points.txt,sha256=d2JsyhZ5wcOXU09BqB5UHQ2nZYEdQ5ZpC0mLHPcymoM,49
23
+ hf2ollama_python_cli_tool-1.0.0.dist-info/licenses/LICENSE,sha256=0LXwWLVpnURdwP9QZYvThNWHlwXNgeHGdrJlyYFtMD4,1069
24
+ hf2ollama_python_cli_tool-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hf2ollama = hf2ollama.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Tanmoy Dutta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.