kreem22 commited on
Commit
81f1ef0
β€’
1 Parent(s): 7604449

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -1,10 +1,26 @@
1
- from transformers import AutoTokenizer, AutoModelForCausalLM
 
2
 
3
- tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
4
- model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
 
5
 
6
- text = "Tell a story"
 
7
 
8
- encoded_input = tokenizer(text, return_tensors='pt')
 
9
 
10
- output = model(**encoded_input)
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from diffusers import StableDiffusionPipeline, AutoencoderKL
3
 
4
+ repo = "IDKiro/sdxs-512-0.9"
5
+ seed = 42
6
+ weight_type = torch.float32 # or float16
7
 
8
+ # Load model.
9
+ pipe = StableDiffusionPipeline.from_pretrained(repo, torch_dtype=weight_type)
10
 
11
+ # use original VAE
12
+ # pipe.vae = AutoencoderKL.from_pretrained("IDKiro/sdxs-512-0.9/vae_large")
13
 
14
+ pipe.to("cuda")
15
+
16
+ prompt = "portrait photo of a girl, photograph, highly detailed face, depth of field, moody light, golden hour"
17
+
18
+ # Ensure using 1 inference step and CFG set to 0.
19
+ image = pipe(
20
+ prompt,
21
+ num_inference_steps=1,
22
+ guidance_scale=0,
23
+ generator=torch.Generator(device="cuda").manual_seed(seed)
24
+ ).images[0]
25
+
26
+ image.save("output.png")