--- license: mit pipeline_tag: text-to-image tags: - model_hub_mixin - pytorch_model_hub_mixin language: - en metrics: - mse datasets: - zalando-datasets/fashion_mnist --- # 🌀 Fashion-MNIST Diffusion (Class-Conditional UNet) This repository hosts a **class-conditional diffusion model** trained on the [Fashion-MNIST](https://github.com/zalandoresearch/fashion-mnist) dataset. The model uses a **UNet-based architecture** with **timestep and label conditioning**, implemented using PyTorch and integrated with the 🤗 **Hugging Face Hub** via `PyTorchModelHubMixin`. --- ## 🧩 Model Details | Property | Description | |-----------|-------------| | **Architecture** | Conditional UNet with residual and skip connections | | **Conditioning** | Class embedding (10 Fashion-MNIST labels) + timestep embedding | | **Framework** | PyTorch | | **Pipeline** | `text-to-image` (adapted for diffusion) | | **License** | MIT | | **Author** | [Sherwin Roger](https://huggingface.co/Sherwinroger002) | The model learns to **denoise images progressively**, generating class-conditional samples (e.g., shoes, shirts, coats) from Gaussian noise through iterative diffusion steps. --- ## 🚀 Load from Hugging Face You can directly load the model using huggingface_hub: ```python from huggingface_hub import hf_hub_download import sys import importlib.util model_file = hf_hub_download( repo_id="Sherwinroger002/fashion_mnist_diffusion_class_conditional", filename="modeling.py" ) spec = importlib.util.spec_from_file_location("modeling", model_file) modeling = importlib.util.module_from_spec(spec) sys.modules["modeling"] = modeling spec.loader.exec_module(modeling) model = modeling.EmbUnetModel.from_pretrained( "Sherwinroger002/fashion_mnist_diffusion_class_conditional" ) image = modeling.generate("Sneaker", model) modeling.show_image(image) ``` ## Sample output ![image](https://cdn-uploads.huggingface.co/production/uploads/6453c886096d57ae122c5213/Y59CTaVl7WaLAkgyqpaQF.png) ## Usage This model can generate only these classes [ 'T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot' ] Pass the class name to make the model to generate the image ## 🪪 License Released under the **MIT License** — free for commercial and research use. If you use this model, please cite the repository and give credit to **Sherwin Roger**. --- ## Citation ``` @software{fashion_mnist_diffusion_2025, author = {Sherwin Roger}, title = {Fashion-MNIST Diffusion (Class-Conditional UNet)}, year = {2025}, url = {https://huggingface.co/Sherwinroger002/fashion_mnist_diffusion_class_conditional} } ```