aducsdr commited on
Commit
9ac3aff
·
verified ·
1 Parent(s): f70185d

Rename app (11).py to app.py

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