alexnasa commited on
Commit
c008d9c
·
verified ·
1 Parent(s): 0fe064a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -10,9 +10,25 @@ from PIL import Image
10
 
11
  import torch
12
 
13
-
14
  print(f'torch version:{torch.__version__}')
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  import torch.utils.checkpoint
17
  from pytorch_lightning import seed_everything
18
  from diffusers import AutoencoderKL, DDPMScheduler
 
10
 
11
  import torch
12
 
 
13
  print(f'torch version:{torch.__version__}')
14
 
15
+ import subprocess
16
+ import importlib, site, sys
17
+
18
+ # Re-discover all .pth/.egg-link files
19
+ for sitedir in site.getsitepackages():
20
+ site.addsitedir(sitedir)
21
+
22
+ # Clear caches so importlib will pick up new modules
23
+ importlib.invalidate_caches()
24
+
25
+ def sh(cmd): subprocess.check_call(cmd, shell=True)
26
+
27
+ sh("pip install -U xformers --index-url https://download.pytorch.org/whl/cu126")
28
+
29
+ # tell Python to re-scan site-packages now that the egg-link exists
30
+ import importlib, site; site.addsitedir(site.getsitepackages()[0]); importlib.invalidate_caches()
31
+
32
  import torch.utils.checkpoint
33
  from pytorch_lightning import seed_everything
34
  from diffusers import AutoencoderKL, DDPMScheduler