Linaqruf commited on
Commit
e793fef
1 Parent(s): ac846f6

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +214 -0
README.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: diffusers
3
+ license: openrail++
4
+ language:
5
+ - en
6
+ tags:
7
+ - text-to-image
8
+ - stable-diffusion
9
+ - lora
10
+ - safetensors
11
+ - stable-diffusion-xl
12
+ base_model: Linaqruf/animagine-xl-2.0
13
+ widget:
14
+ - text: face focus, cute, masterpiece, best quality, sketch, monochrome, greyscale, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
15
+ parameter:
16
+ negative_prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
17
+ example_title: 1girl
18
+ - text: face focus, bishounen, masterpiece, best quality, sketch, monochrome, greyscale, 1boy, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
19
+ parameter:
20
+ negative_prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
21
+ example_title: 1boy
22
+ ---
23
+
24
+ <style>
25
+ .title-container {
26
+ display: flex;
27
+ flex-direction: column; /* Allow vertical stacking of title and subtitle */
28
+ justify-content: center;
29
+ align-items: center;
30
+ height: 100vh;
31
+ background-color: #f5f5f5;
32
+ }
33
+
34
+ .title {
35
+ font-size: 2em;
36
+ text-align: center;
37
+ color: #333;
38
+ font-family: 'Verdana', sans-serif;
39
+ text-transform: uppercase;
40
+ padding: 1em;
41
+ box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
42
+ }
43
+
44
+ .title span {
45
+ background: -webkit-linear-gradient(45deg, #ff9a9e, #fad0c4, #f6d365);
46
+ -webkit-background-clip: text;
47
+ -webkit-text-fill-color: transparent;
48
+ }
49
+
50
+ .custom-table {
51
+ table-layout: fixed;
52
+ width: 100%;
53
+ border-collapse: collapse;
54
+ margin-top: 2em;
55
+ }
56
+
57
+ .custom-table td {
58
+ width: 50%;
59
+ vertical-align: top;
60
+ padding: 10px;
61
+ box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.15);
62
+ }
63
+
64
+ .custom-image-container {
65
+ position: relative;
66
+ width: 100%;
67
+ margin-bottom: 0em;
68
+ overflow: hidden;
69
+ border-radius: 10px;
70
+ transition: transform .7s;
71
+ /* Smooth transition for the container */
72
+ }
73
+
74
+ .custom-image-container:hover {
75
+ transform: scale(1.05);
76
+ /* Scale the container on hover */
77
+ }
78
+
79
+ .custom-image {
80
+ width: 100%;
81
+ height: auto;
82
+ object-fit: cover;
83
+ border-radius: 10px;
84
+ transition: transform .7s;
85
+ margin-bottom: 0em;
86
+ }
87
+
88
+ .nsfw-filter {
89
+ filter: blur(8px); /* Apply a blur effect */
90
+ transition: filter 0.3s ease; /* Smooth transition for the blur effect */
91
+ }
92
+
93
+ .custom-image-container:hover .nsfw-filter {
94
+ filter: none; /* Remove the blur effect on hover */
95
+ }
96
+ </style>
97
+
98
+
99
+ <h1 class="title">
100
+ <span>Sketch Style XL LoRA</span>
101
+ </h1>
102
+ <table class="custom-table">
103
+ <tr>
104
+ <td>
105
+ <div class="custom-image-container">
106
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/Qk5o11rQao64WgvNeGfaa.png" alt="sample1">
107
+ </div>
108
+ <div class="custom-image-container">
109
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/m-nNVPiO5F4eGSW7O1Qw0.png" alt="sample4">
110
+ </div>
111
+ </td>
112
+ <td>
113
+ <div class="custom-image-container">
114
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/o-rlnIIq7tb2Vm9S1P3ze.png" alt="sample2">
115
+ </div>
116
+ <div class="custom-image-container">
117
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/JZO-cEZDr7ekNtkmV9-VA.png" alt="sample3">
118
+ </td>
119
+ </tr>
120
+ </table>
121
+
122
+ <hr>
123
+
124
+ ## Overview
125
+
126
+ **Sketch Style XL LoRA** stands as an innovative, high-resolution LoRA adapter tailored for Animagine XL 2.0, focusing on sketch-style and monochromatic image generation. This model is adept at transforming text prompts into detailed sketches and grayscale images, capturing the essence of traditional media in digital form.
127
+
128
+ Notable supported tags for this model include _**monochrome, greyscale, sketch, traditional media**_ among others, facilitating a wide range of artistic expressions.
129
+
130
+ <hr>
131
+
132
+ ## Model Details
133
+
134
+ - **Developed by:** [Linaqruf](https://github.com/Linaqruf)
135
+ - **Model type:** LoRA adapter for Stable Diffusion XL
136
+ - **Model Description:** Sketch Style XL LoRA is a specialized adapter designed to enhance Animagine XL 2.0's capability in creating sketch-like, monochromatic images. This model excels in interpreting text prompts to generate images that resemble hand-drawn sketches or traditional grayscale artworks. It is a versatile tool for artists and creators who seek to explore the interplay between text and sketch-style imagery.
137
+ - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
138
+ - **Finetuned from model:** [Animagine XL 2.0](https://huggingface.co/Linaqruf/animagine-xl-2.0)
139
+
140
+ <hr>
141
+
142
+ ## Usage
143
+
144
+ The Sketch Style XL LoRA model effectively interprets and generates images based on the following keywords:
145
+
146
+ - **Monochrome:** Generates images in shades of a single color, typically black and white.
147
+ - **Greyscale:** Produces images using varying shades of grey, simulating the look of classic black and white photography or artwork.
148
+ - **Sketch:** Creates images that resemble hand-drawn sketches, emphasizing outlines and shading without color.
149
+ - **Traditional Media:** Imitates the style of artwork created with traditional physical media like pencils, charcoal, or ink.
150
+
151
+ <hr>
152
+
153
+ ## 🧨 Diffusers Installation
154
+
155
+ Ensure the installation of the latest `diffusers` library, along with other essential packages:
156
+
157
+ ```bash
158
+ pip install diffusers --upgrade
159
+ pip install transformers accelerate safetensors
160
+ ```
161
+
162
+ The following Python script demonstrates how to utilize the Style Enhancer XL LoRA with Animagine XL 2.0. The default scheduler is EulerAncestralDiscreteScheduler, but it can be explicitly defined for clarity.
163
+
164
+ ```py
165
+ import torch
166
+ from diffusers import (
167
+ StableDiffusionXLPipeline,
168
+ EulerAncestralDiscreteScheduler,
169
+ AutoencoderKL
170
+ )
171
+
172
+ # Initialize LoRA model and weights
173
+ lora_model_id = "Linaqruf/sketch-style-xl-lora"
174
+ lora_filename = "sketch-style-xl.safetensors"
175
+
176
+ # Load VAE component
177
+ vae = AutoencoderKL.from_pretrained(
178
+ "madebyollin/sdxl-vae-fp16-fix",
179
+ torch_dtype=torch.float16
180
+ )
181
+
182
+ # Configure the pipeline
183
+ pipe = StableDiffusionXLPipeline.from_pretrained(
184
+ "Linaqruf/animagine-xl-2.0",
185
+ vae=vae,
186
+ torch_dtype=torch.float16,
187
+ use_safetensors=True,
188
+ variant="fp16"
189
+ )
190
+ pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
191
+ pipe.to('cuda')
192
+
193
+ # Load and fuse LoRA weights
194
+ pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
195
+ pipe.fuse_lora(lora_scale=0.6)
196
+
197
+ # Define prompts and generate image
198
+ prompt = "face focus, cute, masterpiece, best quality, 1girl, sketch, monochrome, greyscale, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
199
+ negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"
200
+
201
+ image = pipe(
202
+ prompt,
203
+ negative_prompt=negative_prompt,
204
+ width=1024,
205
+ height=1024,
206
+ guidance_scale=12,
207
+ num_inference_steps=50
208
+ ).images[0]
209
+
210
+ # Unfuse LoRA before saving the image
211
+ pipe.unfuse_lora()
212
+ image.save("anime_girl.png")
213
+
214
+ ```