Update README.md
Browse files
README.md
CHANGED
@@ -246,6 +246,88 @@ If you want to avoid too realistic faces, try this!
|
|
246 |
</details>
|
247 |
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
## License
|
250 |
PVC v3 is released under the Fair AI Public License 1.0-SD (https://freedevproject.org/faipl-1.0-sd/). If any derivative of this model is made, please share your changes accordingly. Special thanks to ronsor/undeleted (https://undeleted.ronsor.com/) for help with the license.
|
251 |
|
|
|
246 |
</details>
|
247 |
|
248 |
|
249 |
+
## 🧨 Diffusers
|
250 |
+
|
251 |
+
Using the [🤗's Diffusers library](https://github.com/huggingface/diffusers) to run Stable Diffusion 2 in a simple and efficient manner.
|
252 |
+
|
253 |
+
```bash
|
254 |
+
pip install diffusers transformers accelerate scipy safetensors
|
255 |
+
pip install --pre xformers
|
256 |
+
```
|
257 |
+
|
258 |
+
Using StableDiffusionPipeline:
|
259 |
+
|
260 |
+
```py
|
261 |
+
import torch
|
262 |
+
from diffusers import StableDiffusionPipeline
|
263 |
+
|
264 |
+
model_id = "p1atdev/pvc-v3"
|
265 |
+
revision = "fp16" # "main" or "fp16"
|
266 |
+
|
267 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
268 |
+
model_id,
|
269 |
+
revision=revision,
|
270 |
+
torch_dtype=torch.float16,
|
271 |
+
)
|
272 |
+
pipe = pipe.to("cuda")
|
273 |
+
pipe.enable_attention_slicing()
|
274 |
+
pipe.enable_xformers_memory_efficient_attention() # required
|
275 |
+
|
276 |
+
prompt = "pvc, masterpiece, best quality, exceptional, 1girl, cat ears, red hair, long hair, hairpin, swept bangs, yellow eyes, black jacket, white shirt, blue tie, white gloves, hand up, upper body, looking at viewer, buildings"
|
277 |
+
negative_prompt = "nsfw, nude, worst quality, low quality, oldest, bad anatomy"
|
278 |
+
image = pipe(
|
279 |
+
prompt,
|
280 |
+
negative_prompt=negative_prompt,
|
281 |
+
guidance_scale=7.0,
|
282 |
+
num_inference_steps=20
|
283 |
+
).images[0]
|
284 |
+
|
285 |
+
# save image
|
286 |
+
image.save("pvc_figure.png")
|
287 |
+
|
288 |
+
# or just display it
|
289 |
+
# display(image)
|
290 |
+
```
|
291 |
+
|
292 |
+
Using StableDiffusionLongPromptWeightingPipeline:
|
293 |
+
|
294 |
+
```py
|
295 |
+
import torch
|
296 |
+
from diffusers import DiffusionPipeline
|
297 |
+
|
298 |
+
model_id = "p1atdev/pvc-v3"
|
299 |
+
revision = "fp16" # "main" or "fp16"
|
300 |
+
|
301 |
+
pipe = DiffusionPipeline.from_pretrained(
|
302 |
+
model_id,
|
303 |
+
revision=revision,
|
304 |
+
torch_dtype=torch.float16,
|
305 |
+
custom_pipeline="lpw_stable_diffusion"
|
306 |
+
)
|
307 |
+
pipe = pipe.to("cuda")
|
308 |
+
pipe.enable_attention_slicing()
|
309 |
+
pipe.enable_xformers_memory_efficient_attention() # required
|
310 |
+
|
311 |
+
prompt = """
|
312 |
+
pvc, anime, masterpiece, best quality, exceptional,
|
313 |
+
1girl, bangs, bare shoulders, beret, black hair, black shorts, blue hair, bracelet, breasts, buttons,
|
314 |
+
colored inner hair, double-breasted, eyewear removed, green headwear, green jacket, grey eyes, grey sky,
|
315 |
+
hat, jacket, jewelry, long hair, looking at viewer, multicolored hair, neck ring, o-ring, off shoulder, rain,
|
316 |
+
round eyewear, shorts, sidelocks, small breasts, solo, sunglasses, wavy hair, wet, zipper
|
317 |
+
""" # long prompt
|
318 |
+
|
319 |
+
negative_prompt = "nsfw, nude, worst quality, low quality, oldest, bad anatomy"
|
320 |
+
image = pipe(
|
321 |
+
prompt,
|
322 |
+
negative_prompt=negative_prompt,
|
323 |
+
guidance_scale=7.0,
|
324 |
+
num_inference_steps=20
|
325 |
+
).images[0]
|
326 |
+
|
327 |
+
display(image)
|
328 |
+
```
|
329 |
+
|
330 |
+
|
331 |
## License
|
332 |
PVC v3 is released under the Fair AI Public License 1.0-SD (https://freedevproject.org/faipl-1.0-sd/). If any derivative of this model is made, please share your changes accordingly. Special thanks to ronsor/undeleted (https://undeleted.ronsor.com/) for help with the license.
|
333 |
|