ollamadiffuser 1.0.0__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.
Files changed (36) hide show
  1. ollamadiffuser-1.0.0/CHANGELOG.md +65 -0
  2. ollamadiffuser-1.0.0/LICENSE +21 -0
  3. ollamadiffuser-1.0.0/MANIFEST.in +8 -0
  4. ollamadiffuser-1.0.0/PKG-INFO +493 -0
  5. ollamadiffuser-1.0.0/README.md +438 -0
  6. ollamadiffuser-1.0.0/ollamadiffuser/__init__.py +0 -0
  7. ollamadiffuser-1.0.0/ollamadiffuser/__main__.py +50 -0
  8. ollamadiffuser-1.0.0/ollamadiffuser/api/__init__.py +0 -0
  9. ollamadiffuser-1.0.0/ollamadiffuser/api/server.py +297 -0
  10. ollamadiffuser-1.0.0/ollamadiffuser/cli/__init__.py +0 -0
  11. ollamadiffuser-1.0.0/ollamadiffuser/cli/main.py +597 -0
  12. ollamadiffuser-1.0.0/ollamadiffuser/core/__init__.py +0 -0
  13. ollamadiffuser-1.0.0/ollamadiffuser/core/config/__init__.py +0 -0
  14. ollamadiffuser-1.0.0/ollamadiffuser/core/config/settings.py +137 -0
  15. ollamadiffuser-1.0.0/ollamadiffuser/core/inference/__init__.py +0 -0
  16. ollamadiffuser-1.0.0/ollamadiffuser/core/inference/engine.py +926 -0
  17. ollamadiffuser-1.0.0/ollamadiffuser/core/models/__init__.py +0 -0
  18. ollamadiffuser-1.0.0/ollamadiffuser/core/models/manager.py +436 -0
  19. ollamadiffuser-1.0.0/ollamadiffuser/core/utils/__init__.py +3 -0
  20. ollamadiffuser-1.0.0/ollamadiffuser/core/utils/download_utils.py +356 -0
  21. ollamadiffuser-1.0.0/ollamadiffuser/core/utils/lora_manager.py +390 -0
  22. ollamadiffuser-1.0.0/ollamadiffuser/ui/__init__.py +0 -0
  23. ollamadiffuser-1.0.0/ollamadiffuser/ui/templates/index.html +496 -0
  24. ollamadiffuser-1.0.0/ollamadiffuser/ui/web.py +278 -0
  25. ollamadiffuser-1.0.0/ollamadiffuser/utils/__init__.py +0 -0
  26. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/PKG-INFO +493 -0
  27. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/SOURCES.txt +34 -0
  28. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/dependency_links.txt +1 -0
  29. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/entry_points.txt +2 -0
  30. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/not-zip-safe +1 -0
  31. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/requires.txt +25 -0
  32. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/top_level.txt +1 -0
  33. ollamadiffuser-1.0.0/pyproject.toml +107 -0
  34. ollamadiffuser-1.0.0/requirements.txt +18 -0
  35. ollamadiffuser-1.0.0/setup.cfg +4 -0
  36. ollamadiffuser-1.0.0/setup.py +66 -0
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ All notable changes to OllamaDiffuser will be documented in this file.
4
+
5
+ ## [1.0.0] - 2024-12-XX
6
+
7
+ ### โœจ Added
8
+ - **Web UI Mode**: Beautiful web interface with `ollamadiffuser --mode ui`
9
+ - **LoRA Support**: Complete LoRA management via CLI and Web UI
10
+ - Download LoRAs from HuggingFace Hub
11
+ - Load/unload LoRAs with adjustable strength
12
+ - Real-time LoRA status indicators
13
+ - **Multiple Running Modes**: CLI, API server, and Web UI modes
14
+ - **Model Support**:
15
+ - Stable Diffusion 1.5
16
+ - Stable Diffusion XL
17
+ - Stable Diffusion 3.5 Medium
18
+ - FLUX.1-dev (with HuggingFace token support)
19
+ - FLUX.1-schnell (with HuggingFace token support)
20
+ - **Hardware Optimization**: Auto-detection for CUDA, MPS, and CPU
21
+ - **Comprehensive CLI**: Ollama-style commands for model management
22
+ - **REST API**: Full API for integration with other applications
23
+ - **Cross-platform**: Windows, macOS, and Linux support
24
+
25
+ ### ๐Ÿ”ง Technical Features
26
+ - FastAPI-based web server
27
+ - Jinja2 templating for Web UI
28
+ - Rich CLI with beautiful output
29
+ - Automatic memory optimization
30
+ - Progress tracking for downloads
31
+ - Configuration management
32
+ - Error handling and recovery
33
+
34
+ ### ๐Ÿ“š Documentation
35
+ - Comprehensive README with all guides merged
36
+ - LoRA usage examples
37
+ - Model-specific setup instructions
38
+ - API documentation
39
+ - Troubleshooting guide
40
+
41
+ ### ๐Ÿงน Project Cleanup
42
+ - Organized project structure
43
+ - Moved examples to dedicated directory
44
+ - Consolidated documentation
45
+ - Improved .gitignore
46
+ - Better package metadata
47
+
48
+ ## [Unreleased]
49
+
50
+ ### ๐Ÿš€ Planned Features
51
+ - ControlNet support
52
+ - Image-to-image generation
53
+ - Batch generation
54
+ - Model quantization
55
+ - Plugin system
56
+ - Docker support
57
+
58
+ ---
59
+
60
+ ## Version Format
61
+
62
+ This project follows [Semantic Versioning](https://semver.org/):
63
+ - **MAJOR**: Incompatible API changes
64
+ - **MINOR**: New functionality (backwards compatible)
65
+ - **PATCH**: Bug fixes (backwards compatible)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 OllamaDiffuser
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.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include requirements.txt
5
+ recursive-include ollamadiffuser/ui/templates *.html
6
+ recursive-include ollamadiffuser/ui/static *
7
+ recursive-exclude * __pycache__
8
+ recursive-exclude * *.py[co]
@@ -0,0 +1,493 @@
1
+ Metadata-Version: 2.4
2
+ Name: ollamadiffuser
3
+ Version: 1.0.0
4
+ Summary: ๐ŸŽจ Ollama-like image generation model management tool with LoRA support
5
+ Home-page: https://github.com/ollamadiffuser/ollamadiffuser
6
+ Author: OllamaDiffuser Team
7
+ Author-email: OllamaDiffuser Team <ollamadiffuser@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/ollamadiffuser/ollamadiffuser
10
+ Project-URL: Repository, https://github.com/ollamadiffuser/ollamadiffuser
11
+ Project-URL: Issues, https://github.com/ollamadiffuser/ollamadiffuser/issues
12
+ Keywords: diffusion,image-generation,ai,machine-learning,lora,ollama
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Multimedia :: Graphics
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: torch>=2.1.0
28
+ Requires-Dist: diffusers>=0.25.0
29
+ Requires-Dist: transformers>=4.35.0
30
+ Requires-Dist: accelerate>=0.25.0
31
+ Requires-Dist: fastapi>=0.104.0
32
+ Requires-Dist: uvicorn>=0.23.0
33
+ Requires-Dist: huggingface-hub>=0.16.0
34
+ Requires-Dist: Pillow>=9.0.0
35
+ Requires-Dist: click>=8.0.0
36
+ Requires-Dist: rich>=13.0.0
37
+ Requires-Dist: pydantic>=2.0.0
38
+ Requires-Dist: protobuf>=3.20.0
39
+ Requires-Dist: sentencepiece>=0.1.99
40
+ Requires-Dist: safetensors>=0.3.0
41
+ Requires-Dist: python-multipart>=0.0.0
42
+ Requires-Dist: psutil>=5.9.0
43
+ Requires-Dist: jinja2>=3.0.0
44
+ Requires-Dist: peft>=0.10.0
45
+ Provides-Extra: dev
46
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
47
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
48
+ Requires-Dist: black>=23.0.0; extra == "dev"
49
+ Requires-Dist: isort>=5.12.0; extra == "dev"
50
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
51
+ Dynamic: author
52
+ Dynamic: home-page
53
+ Dynamic: license-file
54
+ Dynamic: requires-python
55
+
56
+ # OllamaDiffuser
57
+
58
+ ๐ŸŽจ **An Ollama-like image generation model management tool** - Simplify local deployment and management of various image generation models (Stable Diffusion and variants).
59
+
60
+ ## โœจ Features
61
+
62
+ - ๐Ÿš€ **One-click Model Management**: Download, run, and switch between different image generation models
63
+ - ๐Ÿ”„ **LoRA Support**: Load/unload LoRA adapters with adjustable strength via CLI and Web UI
64
+ - ๐ŸŒ **Multiple Interfaces**: CLI, REST API, and beautiful Web UI
65
+ - ๐Ÿ–ฅ๏ธ **Cross-platform**: Windows, macOS, Linux with automatic hardware optimization
66
+ - โšก **Hardware Optimization**: Auto-detect and optimize for CUDA, MPS, CPU
67
+ - ๐ŸŽฏ **Ollama-style UX**: Familiar command-line experience focused on image generation
68
+
69
+ ## ๐Ÿš€ Quick Start
70
+
71
+ ### Installation
72
+
73
+ ```bash
74
+ # Clone the repository
75
+ git clone https://github.com/your-username/ollamadiffuser.git
76
+ cd ollamadiffuser
77
+
78
+ # Quick setup (recommended)
79
+ python quick_start.py
80
+
81
+ # Or manual installation
82
+ python -m venv venv
83
+ source venv/bin/activate # Linux/Mac
84
+ # venv\Scripts\activate # Windows
85
+ pip install -r requirements.txt
86
+ pip install -e .
87
+ ```
88
+
89
+ ### Basic Usage
90
+
91
+ ```bash
92
+ # List available models
93
+ ollamadiffuser list
94
+
95
+ # Download a model (start with smaller ones)
96
+ ollamadiffuser pull stable-diffusion-1.5
97
+
98
+ # Check download status and integrity
99
+ ollamadiffuser check stable-diffusion-1.5
100
+ ollamadiffuser check --list # Check all models
101
+
102
+ # Run model with API server
103
+ ollamadiffuser run stable-diffusion-1.5
104
+
105
+ # Or start Web UI (recommended for beginners)
106
+ ollamadiffuser --mode ui
107
+ # Visit: http://localhost:8001
108
+ ```
109
+
110
+ ### Generate Your First Image
111
+
112
+ **Via Web UI** (Easiest):
113
+ 1. Run `ollamadiffuser --mode ui`
114
+ 2. Open http://localhost:8001 in your browser
115
+ 3. Load a model, enter a prompt, and generate!
116
+
117
+ **Via API**:
118
+ ```bash
119
+ curl -X POST http://localhost:8000/api/generate \
120
+ -H "Content-Type: application/json" \
121
+ -d '{"prompt": "A beautiful sunset over mountains"}' \
122
+ --output image.png
123
+ ```
124
+
125
+ **Fast Generation with FLUX.1-schnell** (No HuggingFace token required):
126
+ ```bash
127
+ # Download and run FLUX.1-schnell (Apache 2.0 license)
128
+ ollamadiffuser pull flux.1-schnell
129
+ ollamadiffuser run flux.1-schnell
130
+
131
+ # Generate high-quality image in ~4 steps (very fast!)
132
+ curl -X POST http://localhost:8000/api/generate \
133
+ -H "Content-Type: application/json" \
134
+ -d '{
135
+ "prompt": "A beautiful sunset over mountains",
136
+ "num_inference_steps": 4,
137
+ "guidance_scale": 0.0,
138
+ "width": 1024,
139
+ "height": 1024
140
+ }' \
141
+ --output image.png
142
+ ```
143
+
144
+ ## ๐Ÿ“‹ Supported Models
145
+
146
+ | Model | Size | VRAM | Quality | Speed | License | Best For |
147
+ |-------|------|------|---------|-------|---------|----------|
148
+ | **Stable Diffusion 1.5** | 5GB | 4GB+ | Good | Fast | CreativeML Open RAIL-M | Learning, quick tests |
149
+ | **Stable Diffusion XL** | 7GB | 6GB+ | High | Medium | CreativeML Open RAIL-M | High-quality images |
150
+ | **Stable Diffusion 3.5** | 8GB | 8GB+ | Very High | Medium | CreativeML Open RAIL-M | Professional work |
151
+ | **FLUX.1-dev** | 15GB | 12GB+ | Excellent | Slow | Non-commercial only | Top-tier quality (research) |
152
+ | **FLUX.1-schnell** | 15GB | 12GB+ | Excellent | โšก **Very Fast** | โœ… **Apache 2.0** | **Fast production use** |
153
+
154
+ ### Hardware Requirements
155
+
156
+ **Minimum**: 8GB RAM, 4GB VRAM (or CPU-only)
157
+ **Recommended**: 16GB+ RAM, 8GB+ VRAM
158
+ **For FLUX**: 24GB+ RAM, 12GB+ VRAM
159
+
160
+ ### ๐Ÿš€ FLUX Model Comparison
161
+
162
+ | Aspect | FLUX.1-schnell | FLUX.1-dev |
163
+ |--------|----------------|-------------|
164
+ | **Speed** | โšก 4 steps (12x faster) | ๐ŸŒ 50 steps |
165
+ | **Quality** | ๐ŸŽฏ Excellent | ๐ŸŽฏ Excellent |
166
+ | **License** | โœ… Apache 2.0 | โš ๏ธ Non-commercial only |
167
+ | **HF Token** | โŒ Not required | โœ… Required |
168
+ | **Commercial Use** | โœ… Allowed | โŒ Not allowed |
169
+ | **Guidance Scale** | 0.0 (distilled) | 3.5 (standard) |
170
+ | **Best For** | Fast production use | Research/non-commercial |
171
+
172
+ ## ๐ŸŽฏ Command Reference
173
+
174
+ ### Model Management
175
+ ```bash
176
+ ollamadiffuser list # List all models
177
+ ollamadiffuser list --hardware # Show hardware requirements
178
+ ollamadiffuser pull MODEL_NAME # Download model
179
+ ollamadiffuser check MODEL_NAME # Check download status and integrity
180
+ ollamadiffuser check --list # List all models with status
181
+ ollamadiffuser show MODEL_NAME # Show model details
182
+ ollamadiffuser rm MODEL_NAME # Remove model
183
+ ```
184
+
185
+ ### Service Management
186
+ ```bash
187
+ ollamadiffuser run MODEL_NAME # Run model with API server
188
+ ollamadiffuser load MODEL_NAME # Load model into memory
189
+ ollamadiffuser unload # Unload current model
190
+ ollamadiffuser ps # Show running status
191
+ ollamadiffuser stop # Stop server
192
+ ```
193
+
194
+ ### Running Modes
195
+ ```bash
196
+ ollamadiffuser --mode cli # CLI mode (default)
197
+ ollamadiffuser --mode api # API server only
198
+ ollamadiffuser --mode ui # Web UI mode
199
+ ```
200
+
201
+ ### LoRA Management
202
+ ```bash
203
+ # Download LoRA
204
+ ollamadiffuser lora pull REPO_ID --alias NAME
205
+
206
+ # Load LoRA (requires running model)
207
+ ollamadiffuser lora load NAME --scale 1.0
208
+
209
+ # List and manage LoRAs
210
+ ollamadiffuser lora list
211
+ ollamadiffuser lora unload
212
+ ollamadiffuser lora rm NAME
213
+ ```
214
+
215
+ ## ๐Ÿ”„ LoRA Usage Guide
216
+
217
+ LoRAs (Low-Rank Adaptations) allow you to modify model behavior for different styles, faster generation, or specific aesthetics.
218
+
219
+ ### Quick LoRA Workflow
220
+
221
+ 1. **Start a model**:
222
+ ```bash
223
+ ollamadiffuser run stable-diffusion-3.5-medium
224
+ ```
225
+
226
+ 2. **Download LoRA** (in new terminal):
227
+ ```bash
228
+ # Turbo LoRA for faster generation
229
+ ollamadiffuser lora pull tensorart/stable-diffusion-3.5-medium-turbo \
230
+ --weight-name lora_sd3.5m_turbo_8steps.safetensors \
231
+ --alias turbo
232
+
233
+ # Anime style LoRA
234
+ ollamadiffuser lora pull XLabs-AI/flux-RealismLora \
235
+ --alias realism
236
+ ```
237
+
238
+ 3. **Load LoRA**:
239
+ ```bash
240
+ ollamadiffuser lora load turbo --scale 1.0
241
+ ```
242
+
243
+ 4. **Generate with LoRA**:
244
+ ```bash
245
+ curl -X POST http://localhost:8000/api/generate \
246
+ -H "Content-Type: application/json" \
247
+ -d '{"prompt": "A beautiful landscape", "num_inference_steps": 8}' \
248
+ --output image.png
249
+ ```
250
+
251
+ ### Popular LoRAs
252
+
253
+ **For FLUX.1-dev**:
254
+ - `openfree/flux-chatgpt-ghibli-lora` - Studio Ghibli style
255
+ - `XLabs-AI/flux-RealismLora` - Photorealistic enhancement
256
+ - `alvdansen/flux-koda` - Kodak film aesthetic
257
+
258
+ **For SD3.5**:
259
+ - `tensorart/stable-diffusion-3.5-medium-turbo` - 8-step fast generation
260
+ - `XLabs-AI/sd3-anime-lora` - Anime/manga style
261
+
262
+ **LoRA Scale Guidelines**:
263
+ - `0.5-0.7`: Subtle effect
264
+ - `0.8-1.0`: Normal strength (recommended)
265
+ - `1.1-1.5`: Strong effect
266
+
267
+ ## ๐ŸŒ Web UI Features
268
+
269
+ The Web UI provides a beautiful, user-friendly interface with:
270
+
271
+ - ๐ŸŽจ **Model Management**: Load/unload models with visual status indicators
272
+ - ๐Ÿ”„ **LoRA Management**: Download, load, and manage LoRAs with strength control
273
+ - ๐Ÿ“ **Image Generation**: Intuitive form with parameter controls
274
+ - ๐Ÿ“Š **Real-time Status**: Live model and LoRA status indicators
275
+ - ๐Ÿ–ผ๏ธ **Image Display**: Immediate preview of generated images
276
+ - ๐Ÿ“ฑ **Responsive Design**: Works on desktop and mobile
277
+
278
+ Access via: `ollamadiffuser --mode ui` โ†’ http://localhost:8001
279
+
280
+ ## ๐ŸŒ API Reference
281
+
282
+ ### Image Generation
283
+ ```http
284
+ POST /api/generate
285
+ Content-Type: application/json
286
+
287
+ {
288
+ "prompt": "A beautiful sunset over mountains",
289
+ "negative_prompt": "low quality, blurry",
290
+ "num_inference_steps": 28,
291
+ "guidance_scale": 3.5,
292
+ "width": 1024,
293
+ "height": 1024
294
+ }
295
+ ```
296
+
297
+ ### Model Management
298
+ ```http
299
+ GET /api/models # List all models
300
+ GET /api/models/running # Get current model status
301
+ POST /api/models/load # Load model
302
+ POST /api/models/unload # Unload model
303
+ ```
304
+
305
+ ### LoRA Management
306
+ ```http
307
+ POST /api/lora/load # Load LoRA
308
+ POST /api/lora/unload # Unload LoRA
309
+ GET /api/lora/status # Get LoRA status
310
+ ```
311
+
312
+ ### Health Check
313
+ ```http
314
+ GET /api/health # Service health
315
+ POST /api/shutdown # Graceful shutdown
316
+ ```
317
+
318
+ ## ๐Ÿ”ง Model-Specific Guides
319
+
320
+ ### FLUX.1-dev Setup
321
+
322
+ FLUX.1-dev requires HuggingFace access:
323
+
324
+ 1. **Get HuggingFace Token**:
325
+ - Visit [HuggingFace FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev)
326
+ - Accept license agreement
327
+ - Create access token at [Settings > Access Tokens](https://huggingface.co/settings/tokens)
328
+
329
+ 2. **Set Token**:
330
+ ```bash
331
+ export HF_TOKEN=your_token_here
332
+ # or
333
+ huggingface-cli login
334
+ ```
335
+
336
+ 3. **Download and Run**:
337
+ ```bash
338
+ ollamadiffuser pull flux.1-dev
339
+ ollamadiffuser run flux.1-dev
340
+ ```
341
+
342
+ **FLUX.1-dev Optimal Settings**:
343
+ ```json
344
+ {
345
+ "num_inference_steps": 50,
346
+ "guidance_scale": 3.5,
347
+ "width": 1024,
348
+ "height": 1024,
349
+ "max_sequence_length": 512
350
+ }
351
+ ```
352
+
353
+ ### FLUX.1-schnell Setup
354
+
355
+ FLUX.1-schnell is the fast, distilled version of FLUX.1-dev with Apache 2.0 license:
356
+
357
+ 1. **Download and Run** (no token required):
358
+ ```bash
359
+ ollamadiffuser pull flux.1-schnell
360
+ ollamadiffuser check flux.1-schnell # Check download status
361
+ ollamadiffuser run flux.1-schnell
362
+ ```
363
+
364
+ **FLUX.1-schnell Optimal Settings**:
365
+ ```json
366
+ {
367
+ "num_inference_steps": 4,
368
+ "guidance_scale": 0.0,
369
+ "width": 1024,
370
+ "height": 1024,
371
+ "max_sequence_length": 256
372
+ }
373
+ ```
374
+
375
+ **Key Benefits**:
376
+ - โœ… **No HuggingFace token required** (Apache 2.0 license)
377
+ - โœ… **Commercial use allowed**
378
+ - โšก **12x faster generation** (4 steps vs 50 steps)
379
+ - ๐ŸŽฏ **Same quality** as FLUX.1-dev
380
+ - ๐Ÿค– **Automatic optimization** - engine detects schnell and optimizes parameters
381
+ - โš ๏ธ **No guidance scale** (distilled model - automatically set to 0.0)
382
+
383
+ **Enhanced Features**:
384
+ - **Automatic detection**: Engine automatically optimizes for FLUX.1-schnell
385
+ - **Smart parameter adjustment**: Reduces steps to 4 and sets guidance_scale to 0.0
386
+ - **Download verification**: Use `ollamadiffuser check flux.1-schnell` for status
387
+ - **Universal checker**: Works with all supported models
388
+
389
+ ### Stable Diffusion 3.5
390
+
391
+ **Optimal Settings**:
392
+ ```json
393
+ {
394
+ "num_inference_steps": 28,
395
+ "guidance_scale": 3.5,
396
+ "width": 1024,
397
+ "height": 1024
398
+ }
399
+ ```
400
+
401
+ **With Turbo LoRA**:
402
+ ```json
403
+ {
404
+ "num_inference_steps": 8,
405
+ "guidance_scale": 3.5
406
+ }
407
+ ```
408
+
409
+ ## ๐Ÿ› ๏ธ Architecture
410
+
411
+ ```
412
+ ollamadiffuser/
413
+ โ”œโ”€โ”€ cli/ # Command-line interface
414
+ โ”œโ”€โ”€ core/ # Core functionality
415
+ โ”‚ โ”œโ”€โ”€ models/ # Model management
416
+ โ”‚ โ”œโ”€โ”€ inference/ # Inference engines
417
+ โ”‚ โ”œโ”€โ”€ config/ # Configuration
418
+ โ”‚ โ””โ”€โ”€ utils/ # Utilities (LoRA manager, etc.)
419
+ โ”œโ”€โ”€ api/ # REST API server
420
+ โ”œโ”€โ”€ ui/ # Web interface
421
+ โ”‚ โ”œโ”€โ”€ web.py # FastAPI app
422
+ โ”‚ โ””โ”€โ”€ templates/ # HTML templates
423
+ โ””โ”€โ”€ utils/ # Helper scripts
424
+ ```
425
+
426
+ ## ๐Ÿ“ฆ Dependencies
427
+
428
+ **Core Requirements**:
429
+ - Python 3.8+
430
+ - PyTorch 2.0+
431
+ - Diffusers 0.21+
432
+ - FastAPI 0.100+
433
+ - Click 8.0+
434
+ - Rich 13.0+
435
+
436
+ **Hardware Support**:
437
+ - NVIDIA CUDA (recommended)
438
+ - Apple Metal Performance Shaders (M1/M2)
439
+ - CPU fallback (slower)
440
+
441
+ ## ๐Ÿšจ Troubleshooting
442
+
443
+ ### Common Issues
444
+
445
+ **"Model doesn't have a device attribute"**:
446
+ ```bash
447
+ pip install -U diffusers transformers
448
+ ```
449
+
450
+ **VRAM Out of Memory**:
451
+ - Use smaller models (SD 1.5 instead of FLUX)
452
+ - Reduce image resolution
453
+ - Enable CPU offloading (automatic)
454
+
455
+ **LoRA Loading Fails**:
456
+ - Ensure model is loaded first
457
+ - Check LoRA compatibility with current model
458
+ - Verify HuggingFace token for gated models
459
+
460
+ **Slow Generation**:
461
+ - Use GPU instead of CPU
462
+ - Try Turbo LoRAs for faster generation
463
+ - Reduce inference steps
464
+
465
+ ### Performance Tips
466
+
467
+ 1. **Start Small**: Begin with SD 1.5, then upgrade to larger models
468
+ 2. **Use LoRAs**: Turbo LoRAs can reduce generation time significantly
469
+ 3. **Batch Generation**: Generate multiple images in sequence for efficiency
470
+ 4. **Monitor Resources**: Use `ollamadiffuser ps` to check memory usage
471
+
472
+ ## ๐Ÿ“„ License
473
+
474
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
475
+
476
+ **Model Licenses**:
477
+ - **Stable Diffusion models**: CreativeML Open RAIL-M
478
+ - **FLUX.1-dev**: FLUX.1-dev Non-Commercial License (non-commercial use only)
479
+ - **FLUX.1-schnell**: Apache 2.0 (commercial use allowed)
480
+
481
+ ## ๐Ÿค Contributing
482
+
483
+ Contributions are welcome! Please feel free to submit a Pull Request.
484
+
485
+ ## ๐Ÿ”— Links
486
+
487
+ - [HuggingFace Models](https://huggingface.co/models?pipeline_tag=text-to-image)
488
+ - [Diffusers Documentation](https://huggingface.co/docs/diffusers)
489
+ - [LoRA Collections](https://huggingface.co/models?other=lora)
490
+
491
+ ---
492
+
493
+ **Happy generating!** ๐ŸŽจโœจ