Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 6 min read Case study mediumAdept

Japanese Stable Diffusion

rinna built Japanese Stable Diffusion by fine-tuning Stable Diffusion on about 100 million Japanese-captioned images, including the Japanese subset of LAION-5B, filtered with a Japanese CLOOB model. Following PITI, training ran in two stages. First, the latent diffusion model was frozen while a new Japanese text encoder with a sentencepiece tokenizer was trained, because CLIP's tokenizer splits Japanese into uninterpretable byte tokens. Second, the encoder and diffusion model were fine-tuned together so outputs reflect Japanese culture, e.g. rendering "salary man" with Japanese rather than Western faces. Fine-tuning from the English model compensates for a dataset 1/20th the size, though the result is less versatile than the original.

Assumes: diffusion models basicsCLIP text encoderstokenization

Related posts

  • Open Preference Dataset for Text-to-Image Generation by the 🤗 Community

    Hugging Face easyNovice

    Data is Better Together released an Apache 2.0 text-to-image preference dataset of 10K pairs, with over 30K annotations from more than 250 community members collected in under two weeks. Imgsys prompts were deduplicated, filtered for NSFW content with text and image classifiers plus manual review, and rewritten with distilabel across style categories and simple versus complex variants. Images came from FLUX.1-dev and Stable Diffusion 3.5 Large. Annotators found FLUX better for anime, manga and 3D, and SD3.5 better for cinematic and art styles. A LoRA fine-tune of FLUX-dev on the chosen samples improved its weaker art and cinematic outputs.

  • Stable Diffusion with 🧨 Diffusers

    Hugging Face mediumAdept

    Stable Diffusion is a latent diffusion model that denoises compressed 64×64 latents rather than pixels, combining a VAE, a text-conditioned U-Net with cross-attention, and a frozen CLIP text encoder. The Diffusers walkthrough covers running it in a few lines with StableDiffusionPipeline, including fp16 loading for GPUs under 10GB, seeded generators for determinism, and tuning num_inference_steps (50 recommended) and guidance_scale (7–8.5). It explains why the 8× VAE compression (3×512×512 to 4×64×64) makes generation feasible on 16GB GPUs. It then shows how to build a custom inference pipeline by loading components individually and swapping in schedulers such as K-LMS.

  • Finetune Stable Diffusion Models with DDPO via TRL

    Hugging Face hardMaster

    Denoising Diffusion Policy Optimization (DDPO) fine-tunes diffusion models with reinforcement learning by treating the full denoising process as a multistep MDP. Because each step's policy is an isotropic Gaussian, it can use exact per-step likelihoods, unlike reward-weighted regression, which stacks approximations, and it then applies PPO with customized trajectory collection. TRL's new DDPOTrainer lets you fine-tune Stable Diffusion against a CLIP-based aesthetic reward model, needs at least an A100, and ships recommended single-GPU hyperparameters. LoRA training is stable and generalizes across prompts even with a small prompt set; full fine-tuning can give more intricate images but needs a low learning rate (~1e-5) and careful tuning.

  • 2D Asset Generation: AI for Game Development #4

    Hugging Face mediumAdept

    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. Denoising strength sets how far the output strays from the input. A corn icon was produced in under 10 minutes by starting at 0.8 for exploration and dropping to 0.6 for refinement. A scythe icon was harder because training data skews toward weapons. That kind of bias can be countered with prompt engineering and negative prompts, or with customization techniques such as DreamBooth, textual inversion and LoRA.

  • Training Stable Diffusion with Dreambooth using Diffusers

    Hugging Face mediumAdept

    Dreambooth fine-tuning of Stable Diffusion overfits quickly, so learning rate and step count must be tuned together. Experiments on 2x A100s found low learning rates (2e-6 for objects at ~400 steps, 1e-6 to 2e-6 with 800-1200 steps for faces) work best. Prior preservation matters mainly for faces, and the DDIM scheduler with ~100 inference steps cleans up noise from overfit models. Fine-tuning the text encoder alongside the UNet gave the biggest quality gain but needs ~24 GB of GPU memory; 8-bit Adam, fp16 or gradient accumulation bring training down to 16 GB.

The quest for software engineering knowledge.

Look:
Layout: