alexnasa commited on
Commit
8cf1fac
·
verified ·
1 Parent(s): f710d72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -13,6 +13,26 @@ import uuid
13
  import shutil
14
 
15
  import importlib, site, sys
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  import torch
18
 
@@ -45,7 +65,7 @@ from transformers import Wav2Vec2FeatureExtractor
45
  import torchvision.transforms as transforms
46
  import torch.nn.functional as F
47
  from OmniAvatar.utils.audio_preprocess import add_silence_to_audio_ffmpeg
48
- from huggingface_hub import hf_hub_download, snapshot_download
49
 
50
  os.environ["PROCESSED_RESULTS"] = f"{os.getcwd()}/proprocess_results"
51
 
 
13
  import shutil
14
 
15
  import importlib, site, sys
16
+ from huggingface_hub import hf_hub_download, snapshot_download
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
+ flash_attention_wheel = hf_hub_download(
28
+ repo_id="alexnasa/flash-attn-3",
29
+ filename="flash_attn_3-3.0.0b1-cp39-abi3-linux_x86_64.whl",
30
+ )
31
+
32
+ sh(f"pip install {flash_attention_wheel}")
33
+
34
+ # tell Python to re-scan site-packages now that the egg-link exists
35
+ import importlib, site; site.addsitedir(site.getsitepackages()[0]); importlib.invalidate_caches()
36
 
37
  import torch
38
 
 
65
  import torchvision.transforms as transforms
66
  import torch.nn.functional as F
67
  from OmniAvatar.utils.audio_preprocess import add_silence_to_audio_ffmpeg
68
+
69
 
70
  os.environ["PROCESSED_RESULTS"] = f"{os.getcwd()}/proprocess_results"
71