Update README.md
Browse files
README.md
CHANGED
@@ -6,7 +6,7 @@ datasets:
|
|
6 |
- recastai/LAION-art-EN-improved-captions
|
7 |
tags:
|
8 |
- bksdm
|
9 |
-
- bksdm-
|
10 |
- stable-diffusion
|
11 |
- stable-diffusion-diffusers
|
12 |
- text-to-image
|
@@ -31,10 +31,32 @@ You can use the pipeline like so:
|
|
31 |
from diffusers import DiffusionPipeline
|
32 |
import torch
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
```
|
39 |
|
40 |
## Training info
|
|
|
6 |
- recastai/LAION-art-EN-improved-captions
|
7 |
tags:
|
8 |
- bksdm
|
9 |
+
- bksdm-tiny
|
10 |
- stable-diffusion
|
11 |
- stable-diffusion-diffusers
|
12 |
- text-to-image
|
|
|
31 |
from diffusers import DiffusionPipeline
|
32 |
import torch
|
33 |
|
34 |
+
import torch
|
35 |
+
from diffusers import DiffusionPipeline
|
36 |
+
from diffusers import DPMSolverMultistepScheduler
|
37 |
+
from torch import Generator
|
38 |
+
|
39 |
+
|
40 |
+
path = 'segmind/portrait-finetuned' # Path to the appropriate model-type
|
41 |
+
# Insert your prompt below.
|
42 |
+
prompt = "Faceshot Portrait of pretty young (18-year-old) Caucasian wearing a high neck sweater, (masterpiece, extremely detailed skin, photorealistic, heavy shadow, dramatic and cinematic lighting, key light, fill light), sharp focus, BREAK epicrealism"
|
43 |
+
# Insert negative prompt below. We recommend using this negative prompt for best results.
|
44 |
+
negative_prompt = "(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck"
|
45 |
+
|
46 |
+
torch.set_grad_enabled(False)
|
47 |
+
torch.backends.cudnn.benchmark = True
|
48 |
+
|
49 |
+
# Below code will run on gpu, please pass cpu everywhere as the device and set 'dtype' to torch.float32 for cpu inference.
|
50 |
+
with torch.inference_mode():
|
51 |
+
gen = Generator("cuda")
|
52 |
+
gen.manual_seed(1674753452)
|
53 |
+
pipe = DiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16, safety_checker=None, requires_safety_checker=False)
|
54 |
+
pipe.to('cuda')
|
55 |
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
56 |
+
pipe.unet.to(device='cuda', dtype=torch.float16, memory_format=torch.channels_last)
|
57 |
+
|
58 |
+
img = pipe(prompt=prompt,negative_prompt=negative_prompt, width=512, height=512, num_inference_steps=25, guidance_scale = 7, num_images_per_prompt=1, generator = gen).images[0]
|
59 |
+
img.save("image.png")
|
60 |
```
|
61 |
|
62 |
## Training info
|