Andyrasika commited on
Commit
1da54c6
1 Parent(s): 2e5f6ad

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -16,4 +16,32 @@ First, the base model is used to generate latents of the desired output size.
16
  In the second step, we use a specialized high-resolution model and apply a technique called SDEdit (https://arxiv.org/abs/2108.01073, also known as "img2img")
17
  to the latents generated in the first step, using the same prompt. This technique is slightly slower than the first one, as it requires more function evaluations.
18
 
19
- Source code is available at https://github.com/Stability-AI/generative-models .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  In the second step, we use a specialized high-resolution model and apply a technique called SDEdit (https://arxiv.org/abs/2108.01073, also known as "img2img")
17
  to the latents generated in the first step, using the same prompt. This technique is slightly slower than the first one, as it requires more function evaluations.
18
 
19
+ Source code is available at https://github.com/Stability-AI/generative-models .
20
+ ```
21
+ import torch
22
+ from diffusers import StableDiffusionXLPipeline, AutoencoderKL
23
+ import gc,cv2,os
24
+ from PIL import Image
25
+ import requests
26
+ from io import BytesIO
27
+ from IPython.display import display
28
+ import matplotlib.pyplot as plt
29
+
30
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
31
+
32
+ pipe = StableDiffusionXLPipeline.from_pretrained(
33
+ "Andyrasika/protvisionXL", torch_dtype=torch.float16, variant="fp16",vae=vae
34
+ )
35
+ pipe.enable_xformers_memory_efficient_attention()
36
+ pipe.to("cuda")
37
+ prompt = '8k intricate, highly detailed, digital photography, best quality, masterpiece, a (full body "shot) photo of A warrior man that lived with dragons his whole life is now leading them to battle. torn clothes exposing parts of her body, scratch marks, epic, hyperrealistic, hyperrealism, 8k, cinematic lighting, greg rutkowski, wlop'
38
+ negative_prompt='(deformed iris, deformed pupils), text, 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, camera'
39
+
40
+ image = pipe(prompt=prompt,
41
+ negative_prompt=negative_prompt,
42
+ guidance_scale=9.0,
43
+ num_inference_steps=50).images[0]
44
+
45
+ gc.collect()
46
+ torch.cuda.empty_cache()
47
+ ```