ollamadiffuser 1.1.0__tar.gz → 1.1.1__tar.gz
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.
- {ollamadiffuser-1.1.0/ollamadiffuser.egg-info → ollamadiffuser-1.1.1}/PKG-INFO +60 -75
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/README.md +59 -74
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/cli/main.py +55 -14
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/download_utils.py +169 -40
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1/ollamadiffuser.egg-info}/PKG-INFO +60 -75
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/pyproject.toml +1 -1
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/setup.py +1 -1
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/CHANGELOG.md +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/LICENSE +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/MANIFEST.in +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/__main__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/api/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/api/server.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/cli/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/config/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/config/settings.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/inference/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/inference/engine.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/models/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/models/manager.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/controlnet_preprocessors.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/lora_manager.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/ui/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/ui/templates/index.html +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/ui/web.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/utils/__init__.py +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/SOURCES.txt +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/dependency_links.txt +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/entry_points.txt +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/not-zip-safe +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/requires.txt +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/top_level.txt +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/requirements.txt +0 -0
- {ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ollamadiffuser
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: 🎨 Local AI Image Generation with Ollama-style CLI for Stable Diffusion, FLUX.1, and LoRA support
|
|
5
5
|
Home-page: https://github.com/ollamadiffuser/ollamadiffuser
|
|
6
6
|
Author: OllamaDiffuser Team
|
|
@@ -70,6 +70,7 @@ Dynamic: requires-python
|
|
|
70
70
|
[](https://opensource.org/licenses/MIT)
|
|
71
71
|
[](https://www.python.org/downloads/)
|
|
72
72
|
|
|
73
|
+
|
|
73
74
|
## Local AI Image Generation with OllamaDiffuser
|
|
74
75
|
|
|
75
76
|
**OllamaDiffuser** simplifies local deployment of **Stable Diffusion**, **FLUX.1**, and other AI image generation models. An intuitive **local SD** tool inspired by **Ollama's** simplicity - perfect for **local diffuser** workflows with CLI, web UI, and LoRA support.
|
|
@@ -109,7 +110,7 @@ curl -X POST http://localhost:8000/api/generate \
|
|
|
109
110
|
### Option 2: Development Installation
|
|
110
111
|
```bash
|
|
111
112
|
# Clone the repository
|
|
112
|
-
git clone https://github.com/
|
|
113
|
+
git clone https://github.com/ollamadiffuser/ollamadiffuser.git
|
|
113
114
|
cd ollamadiffuser
|
|
114
115
|
|
|
115
116
|
# Install dependencies
|
|
@@ -121,14 +122,19 @@ pip install -e .
|
|
|
121
122
|
# Install a model
|
|
122
123
|
ollamadiffuser pull stable-diffusion-1.5
|
|
123
124
|
|
|
124
|
-
#
|
|
125
|
-
ollamadiffuser
|
|
125
|
+
# Run the model (loads and starts API server)
|
|
126
|
+
ollamadiffuser run stable-diffusion-1.5
|
|
126
127
|
|
|
127
|
-
# Generate an image
|
|
128
|
-
|
|
128
|
+
# Generate an image via API
|
|
129
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
130
|
+
-H "Content-Type: application/json" \
|
|
131
|
+
-d '{"prompt": "a beautiful sunset over mountains"}' \
|
|
132
|
+
--output image.png
|
|
129
133
|
|
|
130
134
|
# Start web interface
|
|
131
135
|
ollamadiffuser --mode ui
|
|
136
|
+
|
|
137
|
+
open http://localhost:8001 in your browser
|
|
132
138
|
```
|
|
133
139
|
|
|
134
140
|
### ControlNet Quick Start
|
|
@@ -136,8 +142,8 @@ ollamadiffuser --mode ui
|
|
|
136
142
|
# Install ControlNet model
|
|
137
143
|
ollamadiffuser pull controlnet-canny-sd15
|
|
138
144
|
|
|
139
|
-
#
|
|
140
|
-
ollamadiffuser
|
|
145
|
+
# Run ControlNet model (loads and starts API server)
|
|
146
|
+
ollamadiffuser run controlnet-canny-sd15
|
|
141
147
|
|
|
142
148
|
# Generate with control image
|
|
143
149
|
curl -X POST http://localhost:8000/api/generate/controlnet \
|
|
@@ -219,21 +225,29 @@ ollamadiffuser lora unload
|
|
|
219
225
|
|
|
220
226
|
### Command Line Interface
|
|
221
227
|
```bash
|
|
222
|
-
#
|
|
223
|
-
ollamadiffuser
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
# Pull and run a model
|
|
229
|
+
ollamadiffuser pull stable-diffusion-1.5
|
|
230
|
+
ollamadiffuser run stable-diffusion-1.5
|
|
231
|
+
|
|
232
|
+
# In another terminal, generate images via API
|
|
233
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
234
|
+
-H "Content-Type: application/json" \
|
|
235
|
+
-d '{
|
|
236
|
+
"prompt": "a futuristic cityscape",
|
|
237
|
+
"negative_prompt": "blurry, low quality",
|
|
238
|
+
"num_inference_steps": 30,
|
|
239
|
+
"guidance_scale": 7.5,
|
|
240
|
+
"width": 1024,
|
|
241
|
+
"height": 1024
|
|
242
|
+
}' \
|
|
243
|
+
--output image.png
|
|
230
244
|
```
|
|
231
245
|
|
|
232
246
|
### Web UI
|
|
233
247
|
```bash
|
|
234
248
|
# Start web interface
|
|
235
249
|
ollamadiffuser --mode ui
|
|
236
|
-
|
|
250
|
+
Open http://localhost:8001
|
|
237
251
|
```
|
|
238
252
|
|
|
239
253
|
Features:
|
|
@@ -247,6 +261,8 @@ Features:
|
|
|
247
261
|
# Start API server
|
|
248
262
|
ollamadiffuser --mode api
|
|
249
263
|
|
|
264
|
+
ollamadiffuser load stable-diffusion-1.5
|
|
265
|
+
|
|
250
266
|
# Generate image
|
|
251
267
|
curl -X POST http://localhost:8000/api/generate \
|
|
252
268
|
-H "Content-Type: application/json" \
|
|
@@ -258,16 +274,19 @@ curl -X POST http://localhost:8000/api/generate \
|
|
|
258
274
|
from ollamadiffuser.core.models.manager import model_manager
|
|
259
275
|
|
|
260
276
|
# Load model
|
|
261
|
-
model_manager.load_model("stable-diffusion-1.5")
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
success = model_manager.load_model("stable-diffusion-1.5")
|
|
278
|
+
if success:
|
|
279
|
+
engine = model_manager.loaded_model
|
|
280
|
+
|
|
281
|
+
# Generate image
|
|
282
|
+
image = engine.generate_image(
|
|
283
|
+
prompt="a beautiful sunset",
|
|
284
|
+
width=1024,
|
|
285
|
+
height=1024
|
|
286
|
+
)
|
|
287
|
+
image.save("output.jpg")
|
|
288
|
+
else:
|
|
289
|
+
print("Failed to load model")
|
|
271
290
|
```
|
|
272
291
|
|
|
273
292
|
## 📦 Supported Models
|
|
@@ -297,18 +316,6 @@ Models are automatically configured with optimal settings:
|
|
|
297
316
|
- **Precision Handling**: FP16/BF16 support for efficiency
|
|
298
317
|
- **Safety Features**: NSFW filter bypass for creative freedom
|
|
299
318
|
|
|
300
|
-
### Performance Tuning
|
|
301
|
-
```bash
|
|
302
|
-
# Enable verbose logging
|
|
303
|
-
ollamadiffuser -v generate "test prompt"
|
|
304
|
-
|
|
305
|
-
# Check system status
|
|
306
|
-
ollamadiffuser status
|
|
307
|
-
|
|
308
|
-
# Monitor memory usage
|
|
309
|
-
ollamadiffuser info
|
|
310
|
-
```
|
|
311
|
-
|
|
312
319
|
## 🔧 Advanced Usage
|
|
313
320
|
|
|
314
321
|
### ControlNet Parameters
|
|
@@ -331,8 +338,9 @@ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_prepro
|
|
|
331
338
|
controlnet_preprocessor.initialize()
|
|
332
339
|
|
|
333
340
|
# Process multiple images
|
|
334
|
-
|
|
335
|
-
|
|
341
|
+
prompt = "beautiful landscape" # Define the prompt
|
|
342
|
+
for i, image_path in enumerate(image_list):
|
|
343
|
+
control_img = controlnet_preprocessor.preprocess(image_path, "canny")
|
|
336
344
|
result = engine.generate_image(prompt, control_image=control_img)
|
|
337
345
|
result.save(f"output_{i}.jpg")
|
|
338
346
|
```
|
|
@@ -360,8 +368,6 @@ with open("control.jpg", "rb") as f:
|
|
|
360
368
|
## 📚 Documentation & Guides
|
|
361
369
|
|
|
362
370
|
- **[ControlNet Guide](CONTROLNET_GUIDE.md)**: Comprehensive ControlNet usage and examples
|
|
363
|
-
- **[LoRA Guide](LORA_GUIDE.md)**: LoRA management and best practices
|
|
364
|
-
- **[API Reference](API_REFERENCE.md)**: Complete API documentation
|
|
365
371
|
- **[Website Documentation](https://www.ollamadiffuser.com/)**: Complete tutorials and guides
|
|
366
372
|
|
|
367
373
|
## 🚀 Performance & Hardware
|
|
@@ -407,46 +413,26 @@ curl -X POST http://localhost:8000/api/controlnet/initialize
|
|
|
407
413
|
|
|
408
414
|
#### Memory Issues
|
|
409
415
|
```bash
|
|
410
|
-
# Use smaller image sizes
|
|
411
|
-
|
|
416
|
+
# Use smaller image sizes via API
|
|
417
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
418
|
+
-H "Content-Type: application/json" \
|
|
419
|
+
-d '{"prompt": "test", "width": 512, "height": 512}' \
|
|
420
|
+
--output test.png
|
|
412
421
|
|
|
413
|
-
#
|
|
414
|
-
# Close other applications
|
|
422
|
+
# CPU offloading is automatic
|
|
423
|
+
# Close other applications to free memory
|
|
415
424
|
# Use basic preprocessors instead of advanced ones
|
|
416
425
|
```
|
|
417
426
|
|
|
418
427
|
### Debug Mode
|
|
419
428
|
```bash
|
|
420
429
|
# Enable verbose logging
|
|
421
|
-
ollamadiffuser
|
|
422
|
-
|
|
423
|
-
# Check system information
|
|
424
|
-
ollamadiffuser info
|
|
425
|
-
|
|
426
|
-
# Validate installation
|
|
427
|
-
ollamadiffuser doctor
|
|
430
|
+
ollamadiffuser --verbose run model-name
|
|
428
431
|
```
|
|
429
432
|
|
|
430
433
|
## 🤝 Contributing
|
|
431
434
|
|
|
432
|
-
We welcome contributions! Please
|
|
433
|
-
|
|
434
|
-
### Development Setup
|
|
435
|
-
```bash
|
|
436
|
-
# Clone repository
|
|
437
|
-
git clone https://github.com/yourusername/ollamadiffuser.git
|
|
438
|
-
cd ollamadiffuser
|
|
439
|
-
|
|
440
|
-
# Install in development mode
|
|
441
|
-
pip install -e ".[dev]"
|
|
442
|
-
|
|
443
|
-
# Run tests
|
|
444
|
-
pytest tests/
|
|
445
|
-
|
|
446
|
-
# Run linting
|
|
447
|
-
flake8 ollamadiffuser/
|
|
448
|
-
black ollamadiffuser/
|
|
449
|
-
```
|
|
435
|
+
We welcome contributions! Please check the GitHub repository for contribution guidelines.
|
|
450
436
|
|
|
451
437
|
## 🤝 Community & Support
|
|
452
438
|
|
|
@@ -476,9 +462,8 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
476
462
|
|
|
477
463
|
## 📞 Support
|
|
478
464
|
|
|
479
|
-
- **
|
|
480
|
-
- **
|
|
481
|
-
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/ollamadiffuser/discussions)
|
|
465
|
+
- **Issues**: [GitHub Issues](https://github.com/ollamadiffuser/ollamadiffuser/issues)
|
|
466
|
+
- **Discussions**: [GitHub Discussions](https://github.com/ollamadiffuser/ollamadiffuser/discussions)
|
|
482
467
|
|
|
483
468
|
---
|
|
484
469
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.python.org/downloads/)
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
## Local AI Image Generation with OllamaDiffuser
|
|
8
9
|
|
|
9
10
|
**OllamaDiffuser** simplifies local deployment of **Stable Diffusion**, **FLUX.1**, and other AI image generation models. An intuitive **local SD** tool inspired by **Ollama's** simplicity - perfect for **local diffuser** workflows with CLI, web UI, and LoRA support.
|
|
@@ -43,7 +44,7 @@ curl -X POST http://localhost:8000/api/generate \
|
|
|
43
44
|
### Option 2: Development Installation
|
|
44
45
|
```bash
|
|
45
46
|
# Clone the repository
|
|
46
|
-
git clone https://github.com/
|
|
47
|
+
git clone https://github.com/ollamadiffuser/ollamadiffuser.git
|
|
47
48
|
cd ollamadiffuser
|
|
48
49
|
|
|
49
50
|
# Install dependencies
|
|
@@ -55,14 +56,19 @@ pip install -e .
|
|
|
55
56
|
# Install a model
|
|
56
57
|
ollamadiffuser pull stable-diffusion-1.5
|
|
57
58
|
|
|
58
|
-
#
|
|
59
|
-
ollamadiffuser
|
|
59
|
+
# Run the model (loads and starts API server)
|
|
60
|
+
ollamadiffuser run stable-diffusion-1.5
|
|
60
61
|
|
|
61
|
-
# Generate an image
|
|
62
|
-
|
|
62
|
+
# Generate an image via API
|
|
63
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
64
|
+
-H "Content-Type: application/json" \
|
|
65
|
+
-d '{"prompt": "a beautiful sunset over mountains"}' \
|
|
66
|
+
--output image.png
|
|
63
67
|
|
|
64
68
|
# Start web interface
|
|
65
69
|
ollamadiffuser --mode ui
|
|
70
|
+
|
|
71
|
+
open http://localhost:8001 in your browser
|
|
66
72
|
```
|
|
67
73
|
|
|
68
74
|
### ControlNet Quick Start
|
|
@@ -70,8 +76,8 @@ ollamadiffuser --mode ui
|
|
|
70
76
|
# Install ControlNet model
|
|
71
77
|
ollamadiffuser pull controlnet-canny-sd15
|
|
72
78
|
|
|
73
|
-
#
|
|
74
|
-
ollamadiffuser
|
|
79
|
+
# Run ControlNet model (loads and starts API server)
|
|
80
|
+
ollamadiffuser run controlnet-canny-sd15
|
|
75
81
|
|
|
76
82
|
# Generate with control image
|
|
77
83
|
curl -X POST http://localhost:8000/api/generate/controlnet \
|
|
@@ -153,21 +159,29 @@ ollamadiffuser lora unload
|
|
|
153
159
|
|
|
154
160
|
### Command Line Interface
|
|
155
161
|
```bash
|
|
156
|
-
#
|
|
157
|
-
ollamadiffuser
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
# Pull and run a model
|
|
163
|
+
ollamadiffuser pull stable-diffusion-1.5
|
|
164
|
+
ollamadiffuser run stable-diffusion-1.5
|
|
165
|
+
|
|
166
|
+
# In another terminal, generate images via API
|
|
167
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
168
|
+
-H "Content-Type: application/json" \
|
|
169
|
+
-d '{
|
|
170
|
+
"prompt": "a futuristic cityscape",
|
|
171
|
+
"negative_prompt": "blurry, low quality",
|
|
172
|
+
"num_inference_steps": 30,
|
|
173
|
+
"guidance_scale": 7.5,
|
|
174
|
+
"width": 1024,
|
|
175
|
+
"height": 1024
|
|
176
|
+
}' \
|
|
177
|
+
--output image.png
|
|
164
178
|
```
|
|
165
179
|
|
|
166
180
|
### Web UI
|
|
167
181
|
```bash
|
|
168
182
|
# Start web interface
|
|
169
183
|
ollamadiffuser --mode ui
|
|
170
|
-
|
|
184
|
+
Open http://localhost:8001
|
|
171
185
|
```
|
|
172
186
|
|
|
173
187
|
Features:
|
|
@@ -181,6 +195,8 @@ Features:
|
|
|
181
195
|
# Start API server
|
|
182
196
|
ollamadiffuser --mode api
|
|
183
197
|
|
|
198
|
+
ollamadiffuser load stable-diffusion-1.5
|
|
199
|
+
|
|
184
200
|
# Generate image
|
|
185
201
|
curl -X POST http://localhost:8000/api/generate \
|
|
186
202
|
-H "Content-Type: application/json" \
|
|
@@ -192,16 +208,19 @@ curl -X POST http://localhost:8000/api/generate \
|
|
|
192
208
|
from ollamadiffuser.core.models.manager import model_manager
|
|
193
209
|
|
|
194
210
|
# Load model
|
|
195
|
-
model_manager.load_model("stable-diffusion-1.5")
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
211
|
+
success = model_manager.load_model("stable-diffusion-1.5")
|
|
212
|
+
if success:
|
|
213
|
+
engine = model_manager.loaded_model
|
|
214
|
+
|
|
215
|
+
# Generate image
|
|
216
|
+
image = engine.generate_image(
|
|
217
|
+
prompt="a beautiful sunset",
|
|
218
|
+
width=1024,
|
|
219
|
+
height=1024
|
|
220
|
+
)
|
|
221
|
+
image.save("output.jpg")
|
|
222
|
+
else:
|
|
223
|
+
print("Failed to load model")
|
|
205
224
|
```
|
|
206
225
|
|
|
207
226
|
## 📦 Supported Models
|
|
@@ -231,18 +250,6 @@ Models are automatically configured with optimal settings:
|
|
|
231
250
|
- **Precision Handling**: FP16/BF16 support for efficiency
|
|
232
251
|
- **Safety Features**: NSFW filter bypass for creative freedom
|
|
233
252
|
|
|
234
|
-
### Performance Tuning
|
|
235
|
-
```bash
|
|
236
|
-
# Enable verbose logging
|
|
237
|
-
ollamadiffuser -v generate "test prompt"
|
|
238
|
-
|
|
239
|
-
# Check system status
|
|
240
|
-
ollamadiffuser status
|
|
241
|
-
|
|
242
|
-
# Monitor memory usage
|
|
243
|
-
ollamadiffuser info
|
|
244
|
-
```
|
|
245
|
-
|
|
246
253
|
## 🔧 Advanced Usage
|
|
247
254
|
|
|
248
255
|
### ControlNet Parameters
|
|
@@ -265,8 +272,9 @@ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_prepro
|
|
|
265
272
|
controlnet_preprocessor.initialize()
|
|
266
273
|
|
|
267
274
|
# Process multiple images
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
prompt = "beautiful landscape" # Define the prompt
|
|
276
|
+
for i, image_path in enumerate(image_list):
|
|
277
|
+
control_img = controlnet_preprocessor.preprocess(image_path, "canny")
|
|
270
278
|
result = engine.generate_image(prompt, control_image=control_img)
|
|
271
279
|
result.save(f"output_{i}.jpg")
|
|
272
280
|
```
|
|
@@ -294,8 +302,6 @@ with open("control.jpg", "rb") as f:
|
|
|
294
302
|
## 📚 Documentation & Guides
|
|
295
303
|
|
|
296
304
|
- **[ControlNet Guide](CONTROLNET_GUIDE.md)**: Comprehensive ControlNet usage and examples
|
|
297
|
-
- **[LoRA Guide](LORA_GUIDE.md)**: LoRA management and best practices
|
|
298
|
-
- **[API Reference](API_REFERENCE.md)**: Complete API documentation
|
|
299
305
|
- **[Website Documentation](https://www.ollamadiffuser.com/)**: Complete tutorials and guides
|
|
300
306
|
|
|
301
307
|
## 🚀 Performance & Hardware
|
|
@@ -341,46 +347,26 @@ curl -X POST http://localhost:8000/api/controlnet/initialize
|
|
|
341
347
|
|
|
342
348
|
#### Memory Issues
|
|
343
349
|
```bash
|
|
344
|
-
# Use smaller image sizes
|
|
345
|
-
|
|
350
|
+
# Use smaller image sizes via API
|
|
351
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
352
|
+
-H "Content-Type: application/json" \
|
|
353
|
+
-d '{"prompt": "test", "width": 512, "height": 512}' \
|
|
354
|
+
--output test.png
|
|
346
355
|
|
|
347
|
-
#
|
|
348
|
-
# Close other applications
|
|
356
|
+
# CPU offloading is automatic
|
|
357
|
+
# Close other applications to free memory
|
|
349
358
|
# Use basic preprocessors instead of advanced ones
|
|
350
359
|
```
|
|
351
360
|
|
|
352
361
|
### Debug Mode
|
|
353
362
|
```bash
|
|
354
363
|
# Enable verbose logging
|
|
355
|
-
ollamadiffuser
|
|
356
|
-
|
|
357
|
-
# Check system information
|
|
358
|
-
ollamadiffuser info
|
|
359
|
-
|
|
360
|
-
# Validate installation
|
|
361
|
-
ollamadiffuser doctor
|
|
364
|
+
ollamadiffuser --verbose run model-name
|
|
362
365
|
```
|
|
363
366
|
|
|
364
367
|
## 🤝 Contributing
|
|
365
368
|
|
|
366
|
-
We welcome contributions! Please
|
|
367
|
-
|
|
368
|
-
### Development Setup
|
|
369
|
-
```bash
|
|
370
|
-
# Clone repository
|
|
371
|
-
git clone https://github.com/yourusername/ollamadiffuser.git
|
|
372
|
-
cd ollamadiffuser
|
|
373
|
-
|
|
374
|
-
# Install in development mode
|
|
375
|
-
pip install -e ".[dev]"
|
|
376
|
-
|
|
377
|
-
# Run tests
|
|
378
|
-
pytest tests/
|
|
379
|
-
|
|
380
|
-
# Run linting
|
|
381
|
-
flake8 ollamadiffuser/
|
|
382
|
-
black ollamadiffuser/
|
|
383
|
-
```
|
|
369
|
+
We welcome contributions! Please check the GitHub repository for contribution guidelines.
|
|
384
370
|
|
|
385
371
|
## 🤝 Community & Support
|
|
386
372
|
|
|
@@ -410,9 +396,8 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
410
396
|
|
|
411
397
|
## 📞 Support
|
|
412
398
|
|
|
413
|
-
- **
|
|
414
|
-
- **
|
|
415
|
-
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/ollamadiffuser/discussions)
|
|
399
|
+
- **Issues**: [GitHub Issues](https://github.com/ollamadiffuser/ollamadiffuser/issues)
|
|
400
|
+
- **Discussions**: [GitHub Discussions](https://github.com/ollamadiffuser/ollamadiffuser/discussions)
|
|
416
401
|
|
|
417
402
|
---
|
|
418
403
|
|
|
@@ -5,8 +5,9 @@ import logging
|
|
|
5
5
|
from typing import Optional
|
|
6
6
|
from rich.console import Console
|
|
7
7
|
from rich.table import Table
|
|
8
|
-
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
8
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, DownloadColumn, TransferSpeedColumn, TimeRemainingColumn
|
|
9
9
|
from rich import print as rprint
|
|
10
|
+
import time
|
|
10
11
|
|
|
11
12
|
from ..core.models.manager import model_manager
|
|
12
13
|
from ..core.config.settings import settings
|
|
@@ -14,6 +15,44 @@ from ..api.server import run_server
|
|
|
14
15
|
|
|
15
16
|
console = Console()
|
|
16
17
|
|
|
18
|
+
class OllamaStyleProgress:
|
|
19
|
+
"""Enhanced progress tracker that mimics Ollama's progress display"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, console: Console):
|
|
22
|
+
self.console = console
|
|
23
|
+
self.last_message = ""
|
|
24
|
+
|
|
25
|
+
def update(self, message: str):
|
|
26
|
+
"""Update progress with a message"""
|
|
27
|
+
# Skip duplicate messages
|
|
28
|
+
if message == self.last_message:
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
self.last_message = message
|
|
32
|
+
|
|
33
|
+
# Handle different types of messages
|
|
34
|
+
if message.startswith("pulling ") and ":" in message and "%" in message:
|
|
35
|
+
# This is a file progress message from download_utils
|
|
36
|
+
# Format: "pulling e6a7edc1a4d7: 12% ▕██ ▏ 617 MB/5200 MB 44 MB/s 1m44s"
|
|
37
|
+
self.console.print(message)
|
|
38
|
+
elif message.startswith("pulling manifest"):
|
|
39
|
+
self.console.print(message)
|
|
40
|
+
elif message.startswith("📦 Repository:"):
|
|
41
|
+
# Repository info
|
|
42
|
+
self.console.print(f"[dim]{message}[/dim]")
|
|
43
|
+
elif message.startswith("📁 Found"):
|
|
44
|
+
# Existing files info
|
|
45
|
+
self.console.print(f"[dim]{message}[/dim]")
|
|
46
|
+
elif message.startswith("✅") and "download completed" in message:
|
|
47
|
+
self.console.print(f"[green]{message}[/green]")
|
|
48
|
+
elif message.startswith("❌"):
|
|
49
|
+
self.console.print(f"[red]{message}[/red]")
|
|
50
|
+
elif message.startswith("⚠️"):
|
|
51
|
+
self.console.print(f"[yellow]{message}[/yellow]")
|
|
52
|
+
else:
|
|
53
|
+
# For other messages, print with dimmed style
|
|
54
|
+
self.console.print(f"[dim]{message}[/dim]")
|
|
55
|
+
|
|
17
56
|
@click.group()
|
|
18
57
|
@click.option('--verbose', '-v', is_flag=True, help='Enable verbose output')
|
|
19
58
|
def cli(verbose):
|
|
@@ -30,24 +69,26 @@ def pull(model_name: str, force: bool):
|
|
|
30
69
|
"""Download model"""
|
|
31
70
|
rprint(f"[blue]Downloading model: {model_name}[/blue]")
|
|
32
71
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"""Update progress display with download status"""
|
|
42
|
-
progress.update(task, description=message)
|
|
43
|
-
|
|
72
|
+
# Use the new Ollama-style progress tracker
|
|
73
|
+
progress_tracker = OllamaStyleProgress(console)
|
|
74
|
+
|
|
75
|
+
def progress_callback(message: str):
|
|
76
|
+
"""Enhanced progress callback with Ollama-style display"""
|
|
77
|
+
progress_tracker.update(message)
|
|
78
|
+
|
|
79
|
+
try:
|
|
44
80
|
if model_manager.pull_model(model_name, force=force, progress_callback=progress_callback):
|
|
45
|
-
|
|
81
|
+
progress_tracker.update("✅ download completed")
|
|
46
82
|
rprint(f"[green]Model {model_name} downloaded successfully![/green]")
|
|
47
83
|
else:
|
|
48
|
-
progress.update(task, description=f"❌ {model_name} download failed")
|
|
49
84
|
rprint(f"[red]Model {model_name} download failed![/red]")
|
|
50
85
|
sys.exit(1)
|
|
86
|
+
except KeyboardInterrupt:
|
|
87
|
+
rprint("\n[yellow]Download cancelled by user[/yellow]")
|
|
88
|
+
sys.exit(1)
|
|
89
|
+
except Exception as e:
|
|
90
|
+
rprint(f"[red]Download failed: {str(e)}[/red]")
|
|
91
|
+
sys.exit(1)
|
|
51
92
|
|
|
52
93
|
@cli.command()
|
|
53
94
|
@click.argument('model_name')
|
|
@@ -11,25 +11,107 @@ from pathlib import Path
|
|
|
11
11
|
from huggingface_hub import snapshot_download, hf_hub_download, HfApi
|
|
12
12
|
from tqdm import tqdm
|
|
13
13
|
import threading
|
|
14
|
+
import requests
|
|
14
15
|
|
|
15
16
|
logger = logging.getLogger(__name__)
|
|
16
17
|
|
|
17
|
-
class
|
|
18
|
-
"""
|
|
18
|
+
class EnhancedProgressTracker:
|
|
19
|
+
"""Enhanced progress tracker that provides Ollama-style detailed progress information"""
|
|
19
20
|
|
|
20
21
|
def __init__(self, total_files: int = 0, progress_callback: Optional[Callable] = None):
|
|
21
22
|
self.total_files = total_files
|
|
22
23
|
self.completed_files = 0
|
|
23
24
|
self.current_file = ""
|
|
24
25
|
self.file_progress = {}
|
|
26
|
+
self.file_start_times = {}
|
|
27
|
+
self.file_speeds = {}
|
|
25
28
|
self.progress_callback = progress_callback
|
|
26
29
|
self.lock = threading.Lock()
|
|
30
|
+
self.overall_start_time = time.time()
|
|
31
|
+
self.total_size = 0
|
|
32
|
+
self.downloaded_size = 0
|
|
27
33
|
|
|
34
|
+
def set_total_size(self, total_size: int):
|
|
35
|
+
"""Set the total size for all files"""
|
|
36
|
+
with self.lock:
|
|
37
|
+
self.total_size = total_size
|
|
38
|
+
|
|
39
|
+
def start_file(self, filename: str, file_size: int = 0):
|
|
40
|
+
"""Mark a file as started"""
|
|
41
|
+
with self.lock:
|
|
42
|
+
self.current_file = filename
|
|
43
|
+
self.file_start_times[filename] = time.time()
|
|
44
|
+
self.file_progress[filename] = (0, file_size)
|
|
45
|
+
|
|
46
|
+
# Extract hash-like identifier for Ollama-style display
|
|
47
|
+
import re
|
|
48
|
+
hash_match = re.search(r'([a-f0-9]{8,})', filename)
|
|
49
|
+
if hash_match:
|
|
50
|
+
display_name = hash_match.group(1)[:12] # First 12 characters
|
|
51
|
+
else:
|
|
52
|
+
# Fallback to filename without extension
|
|
53
|
+
display_name = Path(filename).stem[:12]
|
|
54
|
+
|
|
55
|
+
if self.progress_callback:
|
|
56
|
+
self.progress_callback(f"pulling {display_name}")
|
|
57
|
+
|
|
28
58
|
def update_file_progress(self, filename: str, downloaded: int, total: int):
|
|
29
|
-
"""Update progress for a specific file"""
|
|
59
|
+
"""Update progress for a specific file with speed calculation"""
|
|
30
60
|
with self.lock:
|
|
61
|
+
current_time = time.time()
|
|
62
|
+
|
|
63
|
+
# Update file progress
|
|
64
|
+
old_downloaded = self.file_progress.get(filename, (0, 0))[0]
|
|
31
65
|
self.file_progress[filename] = (downloaded, total)
|
|
32
|
-
|
|
66
|
+
|
|
67
|
+
# Update overall downloaded size
|
|
68
|
+
size_diff = downloaded - old_downloaded
|
|
69
|
+
self.downloaded_size += size_diff
|
|
70
|
+
|
|
71
|
+
# Calculate speed for this file
|
|
72
|
+
if filename in self.file_start_times:
|
|
73
|
+
elapsed = current_time - self.file_start_times[filename]
|
|
74
|
+
if elapsed > 0 and downloaded > 0:
|
|
75
|
+
speed = downloaded / elapsed # bytes per second
|
|
76
|
+
self.file_speeds[filename] = speed
|
|
77
|
+
|
|
78
|
+
# Report progress in Ollama style
|
|
79
|
+
if self.progress_callback and total > 0:
|
|
80
|
+
percentage = (downloaded / total) * 100
|
|
81
|
+
|
|
82
|
+
# Format sizes
|
|
83
|
+
downloaded_mb = downloaded / (1024 * 1024)
|
|
84
|
+
total_mb = total / (1024 * 1024)
|
|
85
|
+
|
|
86
|
+
# Calculate speed in MB/s
|
|
87
|
+
speed_mbps = self.file_speeds.get(filename, 0) / (1024 * 1024)
|
|
88
|
+
|
|
89
|
+
# Calculate ETA
|
|
90
|
+
if speed_mbps > 0:
|
|
91
|
+
remaining_mb = total_mb - downloaded_mb
|
|
92
|
+
eta_seconds = remaining_mb / speed_mbps
|
|
93
|
+
eta_min = int(eta_seconds // 60)
|
|
94
|
+
eta_sec = int(eta_seconds % 60)
|
|
95
|
+
eta_str = f"{eta_min}m{eta_sec:02d}s"
|
|
96
|
+
else:
|
|
97
|
+
eta_str = "?"
|
|
98
|
+
|
|
99
|
+
# Extract hash for display
|
|
100
|
+
import re
|
|
101
|
+
hash_match = re.search(r'([a-f0-9]{8,})', filename)
|
|
102
|
+
if hash_match:
|
|
103
|
+
display_name = hash_match.group(1)[:12]
|
|
104
|
+
else:
|
|
105
|
+
display_name = Path(filename).stem[:12]
|
|
106
|
+
|
|
107
|
+
# Create progress bar
|
|
108
|
+
bar_width = 20
|
|
109
|
+
filled = int((percentage / 100) * bar_width)
|
|
110
|
+
bar = "█" * filled + " " * (bar_width - filled)
|
|
111
|
+
|
|
112
|
+
progress_msg = f"pulling {display_name}: {percentage:3.0f}% ▕{bar}▏ {downloaded_mb:.0f} MB/{total_mb:.0f} MB {speed_mbps:.0f} MB/s {eta_str}"
|
|
113
|
+
|
|
114
|
+
self.progress_callback(progress_msg)
|
|
33
115
|
|
|
34
116
|
def complete_file(self, filename: str):
|
|
35
117
|
"""Mark a file as completed"""
|
|
@@ -38,34 +120,42 @@ class ProgressTracker:
|
|
|
38
120
|
if filename in self.file_progress:
|
|
39
121
|
downloaded, total = self.file_progress[filename]
|
|
40
122
|
self.file_progress[filename] = (total, total)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
123
|
+
|
|
124
|
+
# Report completion
|
|
125
|
+
if self.progress_callback:
|
|
126
|
+
import re
|
|
127
|
+
hash_match = re.search(r'([a-f0-9]{8,})', filename)
|
|
128
|
+
if hash_match:
|
|
129
|
+
display_name = hash_match.group(1)[:12]
|
|
130
|
+
else:
|
|
131
|
+
display_name = Path(filename).stem[:12]
|
|
132
|
+
|
|
133
|
+
total_mb = self.file_progress.get(filename, (0, 0))[1] / (1024 * 1024)
|
|
134
|
+
self.progress_callback(f"pulling {display_name}: 100% ▕████████████████████▏ {total_mb:.0f} MB/{total_mb:.0f} MB")
|
|
48
135
|
|
|
49
|
-
def
|
|
50
|
-
"""Report
|
|
136
|
+
def report_overall_progress(self):
|
|
137
|
+
"""Report overall progress"""
|
|
51
138
|
if self.progress_callback:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
139
|
+
if self.total_size > 0:
|
|
140
|
+
overall_percent = (self.downloaded_size / self.total_size) * 100
|
|
141
|
+
downloaded_gb = self.downloaded_size / (1024 * 1024 * 1024)
|
|
142
|
+
total_gb = self.total_size / (1024 * 1024 * 1024)
|
|
143
|
+
|
|
144
|
+
elapsed = time.time() - self.overall_start_time
|
|
145
|
+
if elapsed > 0:
|
|
146
|
+
overall_speed = self.downloaded_size / elapsed / (1024 * 1024) # MB/s
|
|
147
|
+
|
|
148
|
+
if overall_speed > 0:
|
|
149
|
+
remaining_gb = total_gb - downloaded_gb
|
|
150
|
+
eta_seconds = (remaining_gb * 1024) / overall_speed # Convert GB to MB for calculation
|
|
151
|
+
eta_min = int(eta_seconds // 60)
|
|
152
|
+
eta_sec = int(eta_seconds % 60)
|
|
153
|
+
eta_str = f"{eta_min}m{eta_sec:02d}s"
|
|
154
|
+
else:
|
|
155
|
+
eta_str = "?"
|
|
156
|
+
|
|
157
|
+
progress_msg = f"Overall progress: {overall_percent:.1f}% | {downloaded_gb:.1f} GB/{total_gb:.1f} GB | {overall_speed:.1f} MB/s | ETA: {eta_str}"
|
|
158
|
+
self.progress_callback(progress_msg)
|
|
69
159
|
|
|
70
160
|
def configure_hf_environment():
|
|
71
161
|
"""Configure HuggingFace Hub environment for better downloads"""
|
|
@@ -132,7 +222,7 @@ def robust_snapshot_download(
|
|
|
132
222
|
|
|
133
223
|
# Get file list and sizes for progress tracking
|
|
134
224
|
if progress_callback:
|
|
135
|
-
progress_callback("
|
|
225
|
+
progress_callback("pulling manifest")
|
|
136
226
|
|
|
137
227
|
file_sizes = get_repo_file_list(repo_id)
|
|
138
228
|
total_size = sum(file_sizes.values())
|
|
@@ -140,20 +230,65 @@ def robust_snapshot_download(
|
|
|
140
230
|
if progress_callback and file_sizes:
|
|
141
231
|
progress_callback(f"📦 Repository: {len(file_sizes)} files, {format_size(total_size)} total")
|
|
142
232
|
|
|
233
|
+
# Initialize enhanced progress tracker
|
|
234
|
+
progress_tracker = EnhancedProgressTracker(len(file_sizes), progress_callback)
|
|
235
|
+
progress_tracker.set_total_size(total_size)
|
|
236
|
+
|
|
143
237
|
# Check what's already downloaded
|
|
144
238
|
local_path = Path(local_dir)
|
|
239
|
+
existing_size = 0
|
|
145
240
|
if local_path.exists() and not force_download:
|
|
146
241
|
existing_files = []
|
|
147
|
-
existing_size = 0
|
|
148
242
|
for file_path in local_path.rglob('*'):
|
|
149
243
|
if file_path.is_file():
|
|
150
244
|
rel_path = file_path.relative_to(local_path)
|
|
151
245
|
existing_files.append(str(rel_path))
|
|
152
|
-
|
|
246
|
+
file_size = file_path.stat().st_size
|
|
247
|
+
existing_size += file_size
|
|
248
|
+
# Mark existing files as completed in progress tracker
|
|
249
|
+
progress_tracker.file_progress[str(rel_path)] = (file_size, file_size)
|
|
250
|
+
progress_tracker.downloaded_size += file_size
|
|
251
|
+
progress_tracker.completed_files += 1
|
|
153
252
|
|
|
154
253
|
if progress_callback and existing_files:
|
|
155
254
|
progress_callback(f"📁 Found {len(existing_files)} existing files ({format_size(existing_size)})")
|
|
156
255
|
|
|
256
|
+
# Custom tqdm class to capture HuggingFace download progress
|
|
257
|
+
class OllamaStyleTqdm(tqdm):
|
|
258
|
+
def __init__(self, *args, **kwargs):
|
|
259
|
+
# Extract description to get filename
|
|
260
|
+
desc = kwargs.get('desc', '')
|
|
261
|
+
self.current_filename = desc
|
|
262
|
+
|
|
263
|
+
# Get file size from our pre-fetched data
|
|
264
|
+
file_size = file_sizes.get(self.current_filename, 0)
|
|
265
|
+
if file_size > 0:
|
|
266
|
+
kwargs['total'] = file_size
|
|
267
|
+
|
|
268
|
+
super().__init__(*args, **kwargs)
|
|
269
|
+
|
|
270
|
+
# Start tracking this file
|
|
271
|
+
if self.current_filename and progress_callback:
|
|
272
|
+
progress_tracker.start_file(self.current_filename, file_size)
|
|
273
|
+
|
|
274
|
+
def update(self, n=1):
|
|
275
|
+
super().update(n)
|
|
276
|
+
|
|
277
|
+
# Update our progress tracker
|
|
278
|
+
if self.current_filename and progress_callback:
|
|
279
|
+
downloaded = getattr(self, 'n', 0)
|
|
280
|
+
total = getattr(self, 'total', 0) or file_sizes.get(self.current_filename, 0)
|
|
281
|
+
|
|
282
|
+
if total > 0:
|
|
283
|
+
progress_tracker.update_file_progress(self.current_filename, downloaded, total)
|
|
284
|
+
|
|
285
|
+
def close(self):
|
|
286
|
+
super().close()
|
|
287
|
+
|
|
288
|
+
# Mark file as completed
|
|
289
|
+
if self.current_filename and progress_callback:
|
|
290
|
+
progress_tracker.complete_file(self.current_filename)
|
|
291
|
+
|
|
157
292
|
last_exception = None
|
|
158
293
|
|
|
159
294
|
for attempt in range(max_retries):
|
|
@@ -166,12 +301,6 @@ def robust_snapshot_download(
|
|
|
166
301
|
|
|
167
302
|
logger.info(f"Download attempt {attempt + 1}/{max_retries} with {workers} workers")
|
|
168
303
|
|
|
169
|
-
# Create a custom progress callback for tqdm
|
|
170
|
-
def tqdm_callback(t):
|
|
171
|
-
def inner(chunk_size):
|
|
172
|
-
t.update(chunk_size)
|
|
173
|
-
return inner
|
|
174
|
-
|
|
175
304
|
result = snapshot_download(
|
|
176
305
|
repo_id=repo_id,
|
|
177
306
|
local_dir=local_dir,
|
|
@@ -181,7 +310,7 @@ def robust_snapshot_download(
|
|
|
181
310
|
resume_download=True, # Enable resume
|
|
182
311
|
etag_timeout=300 + (attempt * 60), # Increase timeout on retries
|
|
183
312
|
force_download=force_download,
|
|
184
|
-
tqdm_class=
|
|
313
|
+
tqdm_class=OllamaStyleTqdm if progress_callback else None
|
|
185
314
|
)
|
|
186
315
|
|
|
187
316
|
if progress_callback:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ollamadiffuser
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: 🎨 Local AI Image Generation with Ollama-style CLI for Stable Diffusion, FLUX.1, and LoRA support
|
|
5
5
|
Home-page: https://github.com/ollamadiffuser/ollamadiffuser
|
|
6
6
|
Author: OllamaDiffuser Team
|
|
@@ -70,6 +70,7 @@ Dynamic: requires-python
|
|
|
70
70
|
[](https://opensource.org/licenses/MIT)
|
|
71
71
|
[](https://www.python.org/downloads/)
|
|
72
72
|
|
|
73
|
+
|
|
73
74
|
## Local AI Image Generation with OllamaDiffuser
|
|
74
75
|
|
|
75
76
|
**OllamaDiffuser** simplifies local deployment of **Stable Diffusion**, **FLUX.1**, and other AI image generation models. An intuitive **local SD** tool inspired by **Ollama's** simplicity - perfect for **local diffuser** workflows with CLI, web UI, and LoRA support.
|
|
@@ -109,7 +110,7 @@ curl -X POST http://localhost:8000/api/generate \
|
|
|
109
110
|
### Option 2: Development Installation
|
|
110
111
|
```bash
|
|
111
112
|
# Clone the repository
|
|
112
|
-
git clone https://github.com/
|
|
113
|
+
git clone https://github.com/ollamadiffuser/ollamadiffuser.git
|
|
113
114
|
cd ollamadiffuser
|
|
114
115
|
|
|
115
116
|
# Install dependencies
|
|
@@ -121,14 +122,19 @@ pip install -e .
|
|
|
121
122
|
# Install a model
|
|
122
123
|
ollamadiffuser pull stable-diffusion-1.5
|
|
123
124
|
|
|
124
|
-
#
|
|
125
|
-
ollamadiffuser
|
|
125
|
+
# Run the model (loads and starts API server)
|
|
126
|
+
ollamadiffuser run stable-diffusion-1.5
|
|
126
127
|
|
|
127
|
-
# Generate an image
|
|
128
|
-
|
|
128
|
+
# Generate an image via API
|
|
129
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
130
|
+
-H "Content-Type: application/json" \
|
|
131
|
+
-d '{"prompt": "a beautiful sunset over mountains"}' \
|
|
132
|
+
--output image.png
|
|
129
133
|
|
|
130
134
|
# Start web interface
|
|
131
135
|
ollamadiffuser --mode ui
|
|
136
|
+
|
|
137
|
+
open http://localhost:8001 in your browser
|
|
132
138
|
```
|
|
133
139
|
|
|
134
140
|
### ControlNet Quick Start
|
|
@@ -136,8 +142,8 @@ ollamadiffuser --mode ui
|
|
|
136
142
|
# Install ControlNet model
|
|
137
143
|
ollamadiffuser pull controlnet-canny-sd15
|
|
138
144
|
|
|
139
|
-
#
|
|
140
|
-
ollamadiffuser
|
|
145
|
+
# Run ControlNet model (loads and starts API server)
|
|
146
|
+
ollamadiffuser run controlnet-canny-sd15
|
|
141
147
|
|
|
142
148
|
# Generate with control image
|
|
143
149
|
curl -X POST http://localhost:8000/api/generate/controlnet \
|
|
@@ -219,21 +225,29 @@ ollamadiffuser lora unload
|
|
|
219
225
|
|
|
220
226
|
### Command Line Interface
|
|
221
227
|
```bash
|
|
222
|
-
#
|
|
223
|
-
ollamadiffuser
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
# Pull and run a model
|
|
229
|
+
ollamadiffuser pull stable-diffusion-1.5
|
|
230
|
+
ollamadiffuser run stable-diffusion-1.5
|
|
231
|
+
|
|
232
|
+
# In another terminal, generate images via API
|
|
233
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
234
|
+
-H "Content-Type: application/json" \
|
|
235
|
+
-d '{
|
|
236
|
+
"prompt": "a futuristic cityscape",
|
|
237
|
+
"negative_prompt": "blurry, low quality",
|
|
238
|
+
"num_inference_steps": 30,
|
|
239
|
+
"guidance_scale": 7.5,
|
|
240
|
+
"width": 1024,
|
|
241
|
+
"height": 1024
|
|
242
|
+
}' \
|
|
243
|
+
--output image.png
|
|
230
244
|
```
|
|
231
245
|
|
|
232
246
|
### Web UI
|
|
233
247
|
```bash
|
|
234
248
|
# Start web interface
|
|
235
249
|
ollamadiffuser --mode ui
|
|
236
|
-
|
|
250
|
+
Open http://localhost:8001
|
|
237
251
|
```
|
|
238
252
|
|
|
239
253
|
Features:
|
|
@@ -247,6 +261,8 @@ Features:
|
|
|
247
261
|
# Start API server
|
|
248
262
|
ollamadiffuser --mode api
|
|
249
263
|
|
|
264
|
+
ollamadiffuser load stable-diffusion-1.5
|
|
265
|
+
|
|
250
266
|
# Generate image
|
|
251
267
|
curl -X POST http://localhost:8000/api/generate \
|
|
252
268
|
-H "Content-Type: application/json" \
|
|
@@ -258,16 +274,19 @@ curl -X POST http://localhost:8000/api/generate \
|
|
|
258
274
|
from ollamadiffuser.core.models.manager import model_manager
|
|
259
275
|
|
|
260
276
|
# Load model
|
|
261
|
-
model_manager.load_model("stable-diffusion-1.5")
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
success = model_manager.load_model("stable-diffusion-1.5")
|
|
278
|
+
if success:
|
|
279
|
+
engine = model_manager.loaded_model
|
|
280
|
+
|
|
281
|
+
# Generate image
|
|
282
|
+
image = engine.generate_image(
|
|
283
|
+
prompt="a beautiful sunset",
|
|
284
|
+
width=1024,
|
|
285
|
+
height=1024
|
|
286
|
+
)
|
|
287
|
+
image.save("output.jpg")
|
|
288
|
+
else:
|
|
289
|
+
print("Failed to load model")
|
|
271
290
|
```
|
|
272
291
|
|
|
273
292
|
## 📦 Supported Models
|
|
@@ -297,18 +316,6 @@ Models are automatically configured with optimal settings:
|
|
|
297
316
|
- **Precision Handling**: FP16/BF16 support for efficiency
|
|
298
317
|
- **Safety Features**: NSFW filter bypass for creative freedom
|
|
299
318
|
|
|
300
|
-
### Performance Tuning
|
|
301
|
-
```bash
|
|
302
|
-
# Enable verbose logging
|
|
303
|
-
ollamadiffuser -v generate "test prompt"
|
|
304
|
-
|
|
305
|
-
# Check system status
|
|
306
|
-
ollamadiffuser status
|
|
307
|
-
|
|
308
|
-
# Monitor memory usage
|
|
309
|
-
ollamadiffuser info
|
|
310
|
-
```
|
|
311
|
-
|
|
312
319
|
## 🔧 Advanced Usage
|
|
313
320
|
|
|
314
321
|
### ControlNet Parameters
|
|
@@ -331,8 +338,9 @@ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_prepro
|
|
|
331
338
|
controlnet_preprocessor.initialize()
|
|
332
339
|
|
|
333
340
|
# Process multiple images
|
|
334
|
-
|
|
335
|
-
|
|
341
|
+
prompt = "beautiful landscape" # Define the prompt
|
|
342
|
+
for i, image_path in enumerate(image_list):
|
|
343
|
+
control_img = controlnet_preprocessor.preprocess(image_path, "canny")
|
|
336
344
|
result = engine.generate_image(prompt, control_image=control_img)
|
|
337
345
|
result.save(f"output_{i}.jpg")
|
|
338
346
|
```
|
|
@@ -360,8 +368,6 @@ with open("control.jpg", "rb") as f:
|
|
|
360
368
|
## 📚 Documentation & Guides
|
|
361
369
|
|
|
362
370
|
- **[ControlNet Guide](CONTROLNET_GUIDE.md)**: Comprehensive ControlNet usage and examples
|
|
363
|
-
- **[LoRA Guide](LORA_GUIDE.md)**: LoRA management and best practices
|
|
364
|
-
- **[API Reference](API_REFERENCE.md)**: Complete API documentation
|
|
365
371
|
- **[Website Documentation](https://www.ollamadiffuser.com/)**: Complete tutorials and guides
|
|
366
372
|
|
|
367
373
|
## 🚀 Performance & Hardware
|
|
@@ -407,46 +413,26 @@ curl -X POST http://localhost:8000/api/controlnet/initialize
|
|
|
407
413
|
|
|
408
414
|
#### Memory Issues
|
|
409
415
|
```bash
|
|
410
|
-
# Use smaller image sizes
|
|
411
|
-
|
|
416
|
+
# Use smaller image sizes via API
|
|
417
|
+
curl -X POST http://localhost:8000/api/generate \
|
|
418
|
+
-H "Content-Type: application/json" \
|
|
419
|
+
-d '{"prompt": "test", "width": 512, "height": 512}' \
|
|
420
|
+
--output test.png
|
|
412
421
|
|
|
413
|
-
#
|
|
414
|
-
# Close other applications
|
|
422
|
+
# CPU offloading is automatic
|
|
423
|
+
# Close other applications to free memory
|
|
415
424
|
# Use basic preprocessors instead of advanced ones
|
|
416
425
|
```
|
|
417
426
|
|
|
418
427
|
### Debug Mode
|
|
419
428
|
```bash
|
|
420
429
|
# Enable verbose logging
|
|
421
|
-
ollamadiffuser
|
|
422
|
-
|
|
423
|
-
# Check system information
|
|
424
|
-
ollamadiffuser info
|
|
425
|
-
|
|
426
|
-
# Validate installation
|
|
427
|
-
ollamadiffuser doctor
|
|
430
|
+
ollamadiffuser --verbose run model-name
|
|
428
431
|
```
|
|
429
432
|
|
|
430
433
|
## 🤝 Contributing
|
|
431
434
|
|
|
432
|
-
We welcome contributions! Please
|
|
433
|
-
|
|
434
|
-
### Development Setup
|
|
435
|
-
```bash
|
|
436
|
-
# Clone repository
|
|
437
|
-
git clone https://github.com/yourusername/ollamadiffuser.git
|
|
438
|
-
cd ollamadiffuser
|
|
439
|
-
|
|
440
|
-
# Install in development mode
|
|
441
|
-
pip install -e ".[dev]"
|
|
442
|
-
|
|
443
|
-
# Run tests
|
|
444
|
-
pytest tests/
|
|
445
|
-
|
|
446
|
-
# Run linting
|
|
447
|
-
flake8 ollamadiffuser/
|
|
448
|
-
black ollamadiffuser/
|
|
449
|
-
```
|
|
435
|
+
We welcome contributions! Please check the GitHub repository for contribution guidelines.
|
|
450
436
|
|
|
451
437
|
## 🤝 Community & Support
|
|
452
438
|
|
|
@@ -476,9 +462,8 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
476
462
|
|
|
477
463
|
## 📞 Support
|
|
478
464
|
|
|
479
|
-
- **
|
|
480
|
-
- **
|
|
481
|
-
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/ollamadiffuser/discussions)
|
|
465
|
+
- **Issues**: [GitHub Issues](https://github.com/ollamadiffuser/ollamadiffuser/issues)
|
|
466
|
+
- **Discussions**: [GitHub Discussions](https://github.com/ollamadiffuser/ollamadiffuser/discussions)
|
|
482
467
|
|
|
483
468
|
---
|
|
484
469
|
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="ollamadiffuser",
|
|
8
|
-
version="1.1.
|
|
8
|
+
version="1.1.1",
|
|
9
9
|
author="OllamaDiffuser Team",
|
|
10
10
|
author_email="ollamadiffuser@gmail.com",
|
|
11
11
|
description="🎨 Ollama-like image generation model management tool with LoRA support",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ollamadiffuser-1.1.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/controlnet_preprocessors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|