Benvenuti nel progetto CPU-Only Stable Diffusion Image Generator! Questo è un potente strumento che democratizza la generazione di immagini tramite AI, rendendo accessibile a tutti la magia della creazione artistica attraverso l'intelligenza artificiale, anche senza disporre di costose GPU.
Questo progetto innovativo ti permette di sperimentare con diversi modelli di Stable Diffusion e altre architetture AI, tutti ottimizzati per funzionare esclusivamente su CPU. Potrai generare immagini straordinarie semplicemente descrivendo ciò che desideri vedere, e il sistema utilizzerà automaticamente multiple versioni di modelli AI per offrirti diverse interpretazioni della tua idea.
Immagina di poter creare arte digitale, concept art, illustrazioni o qualsiasi altra forma di contenuto visivo semplicemente descrivendo la tua visione in parole. Questo è esattamente ciò che questo progetto ti permette di fare, offrendo:
- La possibilità di confrontare i risultati tra diversi modelli AI
- Un'implementazione ottimizzata per CPU che non richiede hardware specializzato
- Un'interfaccia semplice e intuitiva per la generazione di immagini
- La libertà di sperimentare con diversi stili e approcci artistici
- Multiple AI Models: Automatically generates images using several pre-trained models:
- Stable Diffusion v1.4 (CompVis)
- Stable Diffusion v2.1 (Stability AI)
- Stable Diffusion v1.5
- Animagine XL 4.0 (Specialized in anime-style images)
- OpenJourney (Midjourney-style images)
- CPU-Only Operation: Generate images without requiring a GPU
- Memory Efficient: Automatic memory management and cleanup
- Easy to Use: Simple interface for image generation
- Organized Output: Generated images are saved with model name and timestamp
The project includes several carefully selected AI models, each with its own strengths:
-
CompVis/stable-diffusion-v1-4
- Base Stable Diffusion model
- Good all-around performance
- Excellent for general-purpose image generation
-
stabilityai/stable-diffusion-2-1
- Improved image quality over v1
- Better understanding of prompts
- Enhanced detail generation
-
stable-diffusion-v1-5
- Refined version of v1.4
- Better consistency in outputs
- Improved handling of complex prompts
-
cagliostrolab/animagine-xl-4.0
- Specialized in anime and manga-style images
- High-quality character generation
- Excellent for artistic and stylized content
-
prompthero/openjourney
- Midjourney-inspired model
- Artistic and creative outputs
- Great for unique artistic interpretations
Each model will process the same prompt, allowing you to compare different interpretations and choose the best result for your needs.
- Average generation time: 2-3 minutes per image on CPU
- Memory usage: ~4-6GB RAM during generation
- Disk space required: ~10GB for all models
- Python 3.12 or higher
- Minimum 8GB RAM recommended for CPU processing
- Sufficient disk space for models and generated images
-
Clone the Repository
git clone [url-repository] cd StableDiffusionOnlyCPU -
Set Up Virtual Environment
# Windows python -m venv venv .\venv\Scripts\activate # Linux/MacOS python -m venv venv source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
StableDiffusionOnlyCPU/
├── ML/ # Models and output directory
├── out/ # Generated images directory (one per model)
├── main.py # Main script
├── requirements.txt # Project dependencies
└── README.md # Documentation
You can customize the generation parameters in config.py:
# Example configuration
MAX_MEMORY = "4GB" # Maximum memory usage
BATCH_SIZE = 1 # Number of images to generate
STEPS = 20 # Number of inference stepsTo generate images with all available models:
python main.pyThis will:
- Load each model sequentially
- Generate an image from your prompt with each model
- Save the results in the
outdirectory with the format:image_[model_name]_[timestamp].png
You can easily customize the image generation by:
- Modifying the prompt in
main.py - Enabling/disabling specific models in the
AVAILABLE_MODELSlist - Adjusting the output directory in the
generate_and_save_imagefunction
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
See CHANGELOG.md for details on the latest updates and modifications.
- diffusers>=0.24.0
- torch>=2.1.0
- transformers>=4.36.0
- accelerate>=0.25.0
- The first run will require downloading the model (approximately 4GB)
- CPU processing may take longer than GPU processing
- The model will be downloaded automatically on the first run
This project's code is licensed under the MIT License - see the LICENSE file for details.
While our code is MIT licensed, the actual usage of this project is subject to the licenses of the AI models being used. Each model has its own terms and conditions that must be followed:
- CompVis/stable-diffusion-v1-4: CreativeML Open RAIL-M License
- stabilityai/stable-diffusion-2-1: CreativeML Open RAIL-S License
- stable-diffusion-v1-5: CreativeML Open RAIL-M License
- cagliostrolab/animagine-xl-4.0: CreativeML Open RAIL-M License
- prompthero/openjourney: CreativeML Open RAIL-M License
Your use of this project must comply with all licenses involved, including both our MIT license and the respective AI model licenses.
However, these permissions are limited by the AI model licenses. For example, some models may:
⚠️ Restrict commercial use⚠️ Require attribution⚠️ Have specific usage guidelines⚠️ Prohibit certain types of content generation
Please review each model's license before using it in your projects.