OpenDiff StyleLab is a notebook-first generative AI MVP built around Hugging Face Diffusers and Stable Diffusion. The project walks through a lightweight image-generation workflow, from setup and dummy dataset creation to text-to-image inference, image-to-image style transfer, and a simulated LoRA fine-tuning loop.
Generative_AI_MVP.ipynb- the main end-to-end notebook.env- local environment variables for secrets such as Hugging Face access tokens.venv/- local virtual environment (ignored by Git)
The notebook is organized into the following sections:
- Setup and imports
- Dataset loading with sample dummy images
- Stable Diffusion model loading
- Fine-tuning simulation with LoRA-style concepts
- Training metric visualization
- Text-to-image inference
- Image-to-image style transfer
- Python
- Jupyter Notebook
- PyTorch
- Hugging Face Diffusers
- Transformers
- Accelerate
- PEFT
- Matplotlib
- Pillow
- NumPy
PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1pip install diffusers transformers accelerate peft matplotlib datasets torch torchvision pillow numpy jupyterCreate a .env file for local secrets:
HF_READ_TOKEN=your_huggingface_token_hereIf you load the token inside the notebook, make sure it is read from the environment instead of being hardcoded.
jupyter notebookOpen Generative_AI_MVP.ipynb and run the notebook cells in order.
- The current notebook is designed as an MVP and uses a dummy dataset for demonstration.
- The model referenced in the notebook is
OFA-Sys/small-stable-diffusion-v0, which is lightweight enough for experimentation on limited hardware. - CPU execution works for learning and validation, but inference will be much slower than on a CUDA-enabled GPU.
- Move reusable code from the notebook into Python modules
- Add a
requirements.txtorpyproject.toml - Load a real dataset instead of generated dummy images
- Save generated outputs into a dedicated
outputs/directory - Add clearer token-loading and configuration cells
Before pushing this repo:
- Confirm
.envis not tracked - Keep
.venv/out of version control - Add a remote with
git remote add origin <your-repo-url> - Commit your files and push with:
git add .
git commit -m "Initial project setup"
git push -u origin main