---
title: "Create an infinite icon library by fine-tuning Stable Diffusion"
description: "Stable Diffusion v1.5 is fully fine-tuned on the ~300-icon Heroicons set to generate new icons in a similar black-and-white line style."
url: "https://swe.quest/articles/create-an-infinite-icon-library-by-fine-tuning-stable-diffusion-bfc1ceb5caaf1412"
canonical: "https://modal.com/blog/fine-tuning-stable-diffusion"
source: "Modal"
published: "2024-05-21"
difficulty: "medium"
kind: "How-to"
reading_minutes: 12
tags: ["model-training","computer-vision","inference","serverless","python"]
---

# Create an infinite icon library by fine-tuning Stable Diffusion

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-05-21, 12 min read, How-to. Original: [https://modal.com/blog/fine-tuning-stable-diffusion](https://modal.com/blog/fine-tuning-stable-diffusion)

## Summary

Stable Diffusion v1.5 is fully fine-tuned on the ~300-icon Heroicons set to generate new icons in a similar black-and-white line style. Captions are derived from icon names like "golden-retriever" or "barack-obama". The walkthrough covers choosing between full, sequential-adapter and parallel-adapter (LoRA) fine-tuning, then preparing the data: rasterizing SVGs to PNG, adding white backgrounds, and building a metadata.csv of captions. Training uses the Diffusers train\_text\_to\_image script on an A100 via Modal, with 4000 steps, learning rate 1e-5, batch size 1 and 128px resolution. Weights are saved to a Modal Volume and served on a cheaper A10G behind a Gradio UI, and dataset preparation proved the hardest and most important part.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- diffusion model basics
- fine-tuning concepts ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

Stable Diffusion, Heroicons, Modal, Diffusers, Hugging Face, Accelerate, LoRA, Gradio

## Related posts

- [Making a web app generator with open ML models](https://swe.quest/articles/making-a-web-app-generator-with-open-ml-models-3da427bd1ac5acd0.md): Hugging Face · 2023-07-03 · Medium · 9 min read · LLMs, AI for coding, JavaScript, Inference & serving
  A Node.js/Express server can generate web apps from a text prompt by streaming tokens from a code LLM (WizardCoder-15B on Hugging Face Inference Endpoints) straight into the browser as HTML.
- [Instruction-tuning Stable Diffusion with InstructPix2Pix](https://swe.quest/articles/instruction-tuning-stable-diffusion-with-instructpix2pix-2ba1ff22f8e3f013.md): Hugging Face · 2023-05-23 · Hard · 11 min read · Computer vision, Model training, Machine learning
  Fine-tuning InstructPix2Pix on FLAN-style instruction-prompted datasets teaches Stable Diffusion to follow specific image transformation instructions such as cartoonization and low-level image processing (deraining, denoising, deblurring, low-light enhancement).
- [Generate Images Locally with Docker Model Runner and Open WebUI](https://swe.quest/articles/generate-images-locally-with-docker-model-runner-and-open-webui-a7d2d8b5e6b87cba.md): Docker · 2026-05-05 · Medium · 7 min read · Inference & serving, Containers, Developer tools, Computer vision
  Docker Model Runner can now serve diffusion image models locally through an OpenAI-compatible /v1/images/generations endpoint.
- [2D Asset Generation: AI for Game Development #4](https://swe.quest/articles/2d-asset-generation-ai-for-game-development-4-01cd732635277696.md): Hugging Face · 2023-01-26 · Medium · 8 min read · Computer vision, Games
  Stable Diffusion's Image2Image mode can be used as one step in a conventional 2D art workflow rather than a replacement for it: rough hand sketches are fed in, the output is painted over in an image editor, and the result is fed back in.
- [Run ComfyUI workflows for free with Gradio on Hugging Face Spaces](https://swe.quest/articles/run-comfyui-workflows-for-free-with-gradio-on-hugging-face-spaces-4962232981692f52.md): Hugging Face · 2024-01-14 · Medium · 13 min read · Python, Inference & serving, Serverless, Computer vision, Deployment
  A ComfyUI node workflow can be turned into a standalone Gradio app and hosted for free on Hugging Face Spaces' serverless ZeroGPU tier.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
