animemory commited on
Commit
9d51efb
1 Parent(s): 84481a3

readme update

Browse files
Files changed (1) hide show
  1. README.md +147 -3
README.md CHANGED
@@ -1,3 +1,147 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Gallery
2
+
3
+ <img src="gallery_demo.png" width="2432" height="1440"/>
4
+
5
+
6
+ Animemory Alpha is a bilingual model primarily focused on anime-style image generation. It utilizes a SDXL-type Unet
7
+ structure and a self-developed bilingual T5-XXL text encoder, achieving good alignment between Chinese and English. We
8
+ first developed our general model using billion-level data and then tuned the anime model through a series of
9
+ post-training strategies and curated data. By open-sourcing the Alpha version, we hope to contribute to the development
10
+ of the anime community, and we greatly value any feedback.
11
+
12
+ # Key Features
13
+
14
+ - Good bilingual prompt following, effectively transforming certain Chinese concepts into anime style.
15
+ - The model is mainly にじげん(二次元) style, supporting common artistic styles and Chinese elements.
16
+ - Competitive image quality, especially in generating detailed characters and landscapes.
17
+ - Prediction mode is x-prediction, so the model tends to produce subjects with cleaner backgrounds; more detailed
18
+ prompts can further refine your images.
19
+ - Impressive creative ability, the more detailed the descriptions are, the more surprises it can produce.
20
+ - Embracing open-source co-construction; we welcome anime fans to join our ecosystem and share your creative ideas
21
+ through our workflow.
22
+ - Better support for Chinese-style elements.
23
+ - Compatible with both tag lists and natural language description-style prompts.
24
+
25
+ # Model Info
26
+
27
+ <table>
28
+ <tr>
29
+ <th>Developed by</th>
30
+ <td>animEEEmpire</td>
31
+ </tr>
32
+ <tr>
33
+ <th>Model Name</th>
34
+ <td>AniMemory-alpha</td>
35
+ </tr>
36
+ <tr>
37
+ <th>Model type</th>
38
+ <td>Diffusion-based text-to-image generative model</td>
39
+ </tr>
40
+ <tr>
41
+ <th>Download link</th>
42
+ <td><a href="https://huggingface.co/animEEEmpire/AniMemory-alpha">Hugging Face</a></td>
43
+ </tr>
44
+ <tr>
45
+ <th rowspan="4">Parameter</th>
46
+ <td>TextEncoder_1: 5.6B</td>
47
+ </tr>
48
+ <tr>
49
+ <td>TextEncoder_2: 950M</td>
50
+ </tr>
51
+ <tr>
52
+ <td>Unet: 3.1B</td>
53
+ </tr>
54
+ <tr>
55
+ <td>VAE: 271M</td>
56
+ </tr>
57
+ <tr>
58
+ <th>Context Length</th>
59
+ <td>227</td>
60
+ </tr>
61
+ <tr>
62
+ <th>Resolution</th>
63
+ <td>Multi-resolution</td>
64
+ </tr>
65
+ </table>
66
+
67
+ # Key Problems and notes
68
+
69
+ - Primarily focuses on text-following ability and basic image quality; it is not a strongly artistic or stylized
70
+ version, making it suitable for open-source co-construction.
71
+ - Quantization and distillation are still in progress, leaving room for significant speed improvements and GPU memory
72
+ savings. We are planning for this and looking forward to volunteers.
73
+ - A relatively complete data filtering and cleaning process has been conducted, so it is not adept at pornographic
74
+ generation; any attempts to force it may result in image crashes.
75
+ - Simple descriptions tend to produce images with simple backgrounds and chibi-style illustrations; you can try to
76
+ enhance the detail by providing comprehensive descriptions.
77
+ - For close-up shots, please use descriptions like "detailed face", "close-up view" etc. to enhance the impact of the
78
+ output.
79
+ - Adding necessary quality descriptors can sometimes improve the overall quality.
80
+ - The issue with small faces still exists in the Alpha version, but it has been slightly improved; feel free to try it
81
+ out.
82
+ - It is better to detail a single object rather than too many objects in one prompt.
83
+
84
+ # Limitations
85
+
86
+ - Although the model data has undergone extensive cleaning, there may still be potential gender, ethnic, or political
87
+ biases.
88
+ - The model's open-sourcing is dedicated to enriching the ecosystem of the anime community and benefiting anime fans.
89
+ - The usage of the model shall not infringe upon the legal rights and interests of designers and creators.
90
+
91
+ # Quick start
92
+
93
+ 1.Install the necessary requirements.
94
+
95
+ - Recommended Python >= 3.10, PyTorch >= 2.3, CUDA >= 12.1.
96
+
97
+ - It is recommended to use Anaconda to create a new environment (Python >=
98
+ 3.10) `conda create -n animemory python=3.10 -y` to run the following example.
99
+
100
+ - run `pip install git+https://github.com/huggingface/diffusers.git torch==2.3.1 transformers==4.43.0 accelerate==0.31.0 sentencepiece`
101
+
102
+ 2.ComfyUI inference.
103
+ Go to [ComfyUI-Animemory-Loader](https://github.com/animEEEmpire/ComfyUI-Animemory-Loader) for comfyui configuration.
104
+
105
+ 3.Diffusers inference.
106
+
107
+ The pipeline has not been merged yet. Please use the following code to setup the environment.
108
+ ```shell
109
+ git clone https://github.com/huggingface/diffusers.git
110
+ cd ..
111
+ git clone https://github.com/animEEEmpire/diffusers_animemory
112
+ cp diffusers_animemory/* diffusers -r
113
+ # then u can install diffusers or just call it locally.
114
+ cd diffusers
115
+ pip install .
116
+ ```
117
+ And then, you can use the following code to generate images.
118
+
119
+ ```python
120
+ from diffusers import AniMemoryPipeLine
121
+ import torch
122
+
123
+ pipe = AniMemoryPipeLine.from_pretrained("animEEEmpire/AniMemory-alpha", torch_dtype=torch.bfloat16)
124
+ pipe.to("cuda")
125
+
126
+ prompt = "一只凶恶的狼,猩红的眼神,在午夜咆哮,月光皎洁"
127
+ negative_prompt = "nsfw, worst quality, low quality, normal quality, low resolution, monochrome, blurry, wrong, Mutated hands and fingers, text, ugly faces, twisted, jpeg artifacts, watermark, low contrast, realistic"
128
+
129
+ images = pipe(prompt=prompt,
130
+ negative_prompt=negative_prompt,
131
+ num_inference_steps=40,
132
+ height=1024, width=1024,
133
+ guidance_scale=7,
134
+ num_images_per_prompt=1
135
+ )[0]
136
+ images.save("output.png")
137
+ ```
138
+
139
+ Use `pipe.enable_sequential_cpu_offload()` to offload the model into CPU for less GPU memory cost (about 14.25 G,
140
+ compared to 25.67 G if CPU offload is not enabled), but the inference time will increase significantly(5.18s v.s.
141
+ 17.74s on A100 40G).
142
+
143
+ 4.For faster inference, please refer to our future work.
144
+
145
+ # License
146
+
147
+ This repo is released under the Apache 2.0 License.