nigeljw commited on
Commit
81a141c
1 Parent(s): 45a989c

Added safe tensors and memory efficient attention

Browse files
Files changed (2) hide show
  1. app.py +3 -2
  2. requirements.txt +3 -1
app.py CHANGED
@@ -7,6 +7,7 @@ model_id = "dream-textures/texture-diffusion"
7
  if torch.cuda.is_available():
8
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
  pipe = pipe.to("cuda")
 
10
  else:
11
  pipe = StableDiffusionPipeline.from_pretrained(model_id)
12
 
@@ -18,6 +19,6 @@ with streamlit.form(key="Interpolation"):
18
  numSteps = streamlit.slider(label="Number of Inference steps", value=50, min_value=1, max_value=1000)
19
  numImages = streamlit.slider(label="Number of Generated Images", value=1, min_value=1, max_value=10)
20
  guidanceScale = streamlit.slider(label="Guidance Scale", value=7.5, min_value=0.0, max_value=100.0)
21
- image = pipe(prompt, num_inference_steps=numSteps, num_images_per_prompt=numImages, guidance_scale=guidanceScale).images[0]
22
  streamlit.form_submit_button("Interpolate")
23
- synthesizedImage = streamlit.image(image)
 
7
  if torch.cuda.is_available():
8
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
  pipe = pipe.to("cuda")
10
+ pipe.enable_xformers_memory_efficient_attention()
11
  else:
12
  pipe = StableDiffusionPipeline.from_pretrained(model_id)
13
 
 
19
  numSteps = streamlit.slider(label="Number of Inference steps", value=50, min_value=1, max_value=1000)
20
  numImages = streamlit.slider(label="Number of Generated Images", value=1, min_value=1, max_value=10)
21
  guidanceScale = streamlit.slider(label="Guidance Scale", value=7.5, min_value=0.0, max_value=100.0)
22
+ images = pipe(prompt=prompt, num_inference_steps=numSteps, num_images_per_prompt=numImages, guidance_scale=guidanceScale).images
23
  streamlit.form_submit_button("Interpolate")
24
+ synthesizedImage = streamlit.image(images)
requirements.txt CHANGED
@@ -1,4 +1,6 @@
1
  torch
 
2
  transformers
3
  diffusers
4
- streamlit
 
 
1
  torch
2
+ accelerate
3
  transformers
4
  diffusers
5
+ streamlit
6
+ safetensors