aducsdr commited on
Commit
3fb97f7
·
verified ·
1 Parent(s): 0db6124

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -0
app.py CHANGED
@@ -12,6 +12,52 @@
12
  # // See the License for the specific language governing permissions and
13
  # // limitations under the License.
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  import os
16
  import torch
17
  import mediapy
 
12
  # // See the License for the specific language governing permissions and
13
  # // limitations under the License.
14
 
15
+
16
+
17
+ import spaces
18
+ import subprocess
19
+
20
+ import os
21
+ import sys
22
+ import subprocess
23
+ import importlib.util
24
+
25
+ # --- ETAPA 0: Instalação Final do flash-attn ---
26
+
27
+ # Verifica se o flash_attn já está instalado. Se não, instala.
28
+ package_name = 'flash_attn'
29
+ spec = importlib.util.find_spec(package_name)
30
+ if spec is None:
31
+ print(f"Instalando o pacote que faltava: {package_name}. Isso pode levar um minuto...")
32
+ # Usamos o python executável do ambiente atual para instalar o pacote
33
+ python_executable = sys.executable
34
+ subprocess.run(
35
+ [
36
+ python_executable, "-m", "pip", "install",
37
+ "flash_attn==2.5.9.post1",
38
+ "--no-build-isolation"
39
+ ],
40
+ check=True
41
+ )
42
+ print(f"✅ {package_name} instalado com sucesso.")
43
+ else:
44
+ print(f"✅ Pacote {package_name} já está instalado.")
45
+
46
+
47
+ # --- ETAPA 1: Clonar o Repositório e Mudar para o Diretório ---
48
+ repo_name = "SeedVR"
49
+ if not os.path.exists(repo_name):
50
+ print(f"Clonando o repositório {repo_name} do GitHub...")
51
+ subprocess.run(f"git clone https://github.com/ByteDance-Seed/{repo_name}.git", shell=True, check=True)
52
+
53
+ # Garante que estamos no diretório certo
54
+ if not os.getcwd().endswith(repo_name):
55
+ os.chdir(repo_name)
56
+
57
+ sys.path.insert(0, os.path.abspath('.'))
58
+
59
+
60
+
61
  import os
62
  import torch
63
  import mediapy