skytnt commited on
Commit
0a4486b
1 Parent(s): cc452ee

support for longer prompt and weighting using custom_pipeline

Browse files

Now we can input prompt without 77 tokens limit and adjust weighting by using custom_pipeline="waifu-research-department/long-prompt-weighting-pipeline".

It requires diffusers>=0.4.0

Check out [waifu-research-department/long-prompt-weighting-pipeline](https://huggingface.co/waifu-research-department/long-prompt-weighting-pipeline) for detial.

Files changed (1) hide show
  1. README.md +11 -10
README.md CHANGED
@@ -44,19 +44,20 @@ This model can be used for entertainment purposes and as a generative art assist
44
  ## Example Code
45
 
46
  ```python
 
47
  import torch
48
- from torch import autocast
49
- from diffusers import StableDiffusionPipeline
50
 
51
- pipe = StableDiffusionPipeline.from_pretrained(
52
  'hakurei/waifu-diffusion',
53
- torch_dtype=torch.float32
54
- ).to('cuda')
55
-
56
- prompt = "1girl, aqua eyes, baseball cap, blonde hair, closed mouth, earrings, green background, hat, hoop earrings, jewelry, looking at viewer, shirt, short hair, simple background, solo, upper body, yellow shirt"
57
- with autocast("cuda"):
58
- image = pipe(prompt, guidance_scale=6)["sample"][0]
59
-
 
 
60
  image.save("test.png")
61
  ```
62
 
44
  ## Example Code
45
 
46
  ```python
47
+ from diffusers import DiffusionPipeline
48
  import torch
 
 
49
 
50
+ pipe = DiffusionPipeline.from_pretrained(
51
  'hakurei/waifu-diffusion',
52
+ custom_pipeline="waifu-research-department/long-prompt-weighting-pipeline",
53
+ revision="fp16",
54
+ torch_dtype=torch.float16
55
+ )
56
+ pipe=pipe.to("cuda")
57
+
58
+ prompt = "best quality, masterpiece, 1girl, aqua eyes, baseball cap, blonde hair, closed mouth, earrings, green background, hat, hoop earrings, jewelry, looking at viewer, shirt, short hair, simple background, solo, upper body, yellow shirt"
59
+ neg_prompt = "lowres, bad anatomy, error body, error hair, error arm, error hands, bad hands, error fingers, bad fingers, missing fingers, error legs, bad legs, multiple legs, missing legs, error lighting, error shadow, error reflection, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"
60
+ image = pipe.text2img(prompt, neg_prompt, guidance_scale=6).images[0]
61
  image.save("test.png")
62
  ```
63