Chinese Stable Diffusion Model Card
<!-- -->
svjack/Stable-Diffusion-FineTuned-zh-v0 is a Chinese-specific latent text-to-image diffusion model capable of generating images given any Chinese text input.
This model was trained by using a powerful text-to-image model, diffusers For more information about our training method, see train_zh_model.py. With the help of a good baseline model Taiyi-Stable-Diffusion-1B-Chinese-v0.1 from IDEA-CCNL
Model Details
- Developed by: Zhipeng Yang
- Model type: Diffusion-based text-to-image generation model
- Language(s): Chinese
- License: The CreativeML OpenRAIL M license is an Open RAIL M license, adapted from the work that BigScience and the RAIL Initiative are jointly carrying in the area of responsible AI licensing. See also the article about the BLOOM Open RAIL license on which our license is based.
- Model Description: This is a model that can be used to generate and modify images based on text prompts. It is a Latent Diffusion Model (LDM) that used Stable Diffusion as a pre-trained model.
- Resources for more information: https://github.com/svjack/Stable-Diffusion-Chinese-Extend
Examples
Firstly, install our package as follows. This package is modified 🤗's Diffusers library to run Chinese Stable Diffusion.
diffusers==0.6.0
transformers
torch
datasets
accelerate
sentencepiece
Run this command to log in with your HF Hub token if you haven't before:
huggingface-cli login
Running the pipeline with the LMSDiscreteScheduler scheduler:
from diffusers import StableDiffusionPipeline
pipeline = StableDiffusionPipeline.from_pretrained("svjack/Stable-Diffusion-FineTuned-zh-v2")
pipeline.safety_checker = lambda images, clip_input: (images, False)
pipeline = pipeline.to("cuda")
prompt = '女孩们打开了另一世界的大门'
image = pipeline(prompt, guidance_scale=7.5).images[0]
Generator Results comparison
https://github.com/svjack/Stable-Diffusion-Chinese-Extend
<!--
Note: JapaneseStableDiffusionPipeline
is almost same as diffusers' StableDiffusionPipeline
but added some lines to initialize our models properly.
Misuse, Malicious Use, and Out-of-Scope Use
Note: This section is taken from the DALLE-MINI model card, but applies in the same way to Stable Diffusion v1.
The model should not be used to intentionally create or disseminate images that create hostile or alienating environments for people. This includes generating images that people would foreseeably find disturbing, distressing, or offensive; or content that propagates historical or current stereotypes.
Out-of-Scope Use
The model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
Misuse and Malicious Use
Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:
- Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
- Intentionally promoting or propagating discriminatory content or harmful stereotypes.
- Impersonating individuals without their consent.
- Sexual content without consent of the people who might see it.
- Mis- and disinformation
- Representations of egregious violence and gore
- Sharing of copyrighted or licensed material in violation of its terms of use.
- Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
Limitations and Bias
Limitations
- The model does not achieve perfect photorealism
- The model cannot render legible text
- The model does not perform well on more difficult tasks which involve compositionality, such as rendering an image corresponding to “A red cube on top of a blue sphere”
- Faces and people in general may not be generated properly.
- The model was trained mainly with Japanese captions and will not work as well in other languages.
- The autoencoding part of the model is lossy
- The model was trained on a subset of a large-scale dataset LAION-5B which contains adult material and is not fit for product use without additional safety mechanisms and considerations.
- No additional measures were used to deduplicate the dataset. As a result, we observe some degree of memorization for images that are duplicated in the training data. The training data can be searched at https://rom1504.github.io/clip-retrieval/ to possibly assist in the detection of memorized images.
Bias
While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases. Japanese Stable Diffusion was trained on Japanese datasets including LAION-5B with Japanese captions, which consists of images that are primarily limited to Japanese descriptions. Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for. This affects the overall output of the model. Further, the ability of the model to generate content with non-Japanese prompts is significantly worse than with Japanese-language prompts.
Safety Module
The intended use of this model is with the Safety Checker in Diffusers.
This checker works by checking model outputs against known hard-coded NSFW concepts.
The concepts are intentionally hidden to reduce the likelihood of reverse-engineering this filter.
Specifically, the checker compares the class probability of harmful concepts in the embedding space of the CLIPTextModel
after generation of the images.
The concepts are passed into the model with the generated image and compared to a hand-engineered weight for each NSFW concept.
Training
Training Data We used the following dataset for training the model:
- Approximately 100 million images with Japanese captions, including the Japanese subset of LAION-5B.
Training Procedure Japanese Stable Diffusion has the same architecture as Stable Diffusion and was trained by using Stable Diffusion. Because Stable Diffusion was trained on English dataset and the CLIP tokenizer is basically for English, we had 2 stages to transfer to a language-specific model, inspired by PITI.
- Train a Japanese-specific text encoder with our Japanese tokenizer from scratch with the latent diffusion model fixed. This stage is expected to map Japanese captions to Stable Diffusion's latent space.
- Fine-tune the text encoder and the latent diffusion model jointly. This stage is expected to generate Japanese-style images more.
-->