ford442 commited on
Commit
757fa77
·
verified ·
1 Parent(s): eadfc05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -32,7 +32,7 @@ os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-nvcc')
32
  os.system(f'{conda_bin}/conda install pytorch::pytorch-cuda')
33
  #os.system(f'{conda_bin}/conda install rcdr_py37::tensorrt')
34
  #subprocess.run(['sh', './hidet.sh'])
35
- #import hidet
36
  #print(dir(hidet))
37
 
38
  import random
@@ -41,7 +41,6 @@ import gradio as gr
41
  import numpy as np
42
  from PIL import Image
43
 
44
-
45
  import diffusers
46
  from diffusers import AutoencoderKL, StableDiffusionXLPipeline
47
  from diffusers import EulerAncestralDiscreteScheduler
@@ -195,12 +194,12 @@ def load_and_prepare_model():
195
 
196
  #pipe.unet.to(memory_format=torch.channels_last)
197
  #pipe.enable_vae_tiling()
198
- #pipe.unet = torch.compile(pipe.unet, backend="hidet")
199
- pipe.unet = torch.compile(pipe.unet, backend="cudagraphs", dynamic=False)
200
  pipe.to(device=device, dtype=torch.bfloat16)
201
 
202
  return pipe
203
- '''
204
  hidet.option.parallel_build(True)
205
  hidet.option.parallel_tune(2,2.0)
206
  torch._dynamo.config.suppress_errors = True
@@ -217,7 +216,7 @@ hidet.option.cache_dir("local_cache")
217
  # use tensorcore
218
  hidet.torch.dynamo_config.use_tensor_core()
219
  hidet.torch.dynamo_config.steal_weights(False)
220
- '''
221
  # Preload and compile both models
222
 
223
  pipe = load_and_prepare_model()
 
32
  os.system(f'{conda_bin}/conda install pytorch::pytorch-cuda')
33
  #os.system(f'{conda_bin}/conda install rcdr_py37::tensorrt')
34
  #subprocess.run(['sh', './hidet.sh'])
35
+ import hidet
36
  #print(dir(hidet))
37
 
38
  import random
 
41
  import numpy as np
42
  from PIL import Image
43
 
 
44
  import diffusers
45
  from diffusers import AutoencoderKL, StableDiffusionXLPipeline
46
  from diffusers import EulerAncestralDiscreteScheduler
 
194
 
195
  #pipe.unet.to(memory_format=torch.channels_last)
196
  #pipe.enable_vae_tiling()
197
+ pipe.unet = torch.compile(pipe.unet, backend="hidet")
198
+ #pipe.unet = torch.compile(pipe.unet, backend="cudagraphs", dynamic=False)
199
  pipe.to(device=device, dtype=torch.bfloat16)
200
 
201
  return pipe
202
+
203
  hidet.option.parallel_build(True)
204
  hidet.option.parallel_tune(2,2.0)
205
  torch._dynamo.config.suppress_errors = True
 
216
  # use tensorcore
217
  hidet.torch.dynamo_config.use_tensor_core()
218
  hidet.torch.dynamo_config.steal_weights(False)
219
+
220
  # Preload and compile both models
221
 
222
  pipe = load_and_prepare_model()