aducsdr commited on
Commit
80cf231
·
verified ·
1 Parent(s): 82be5f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -26
app.py CHANGED
@@ -32,40 +32,30 @@ print(f"Diretório atual adicionado ao sys.path.")
32
  # --- ETAPA 3: Instalar Dependências Corretamente ---
33
  python_executable = sys.executable
34
 
35
- # CORREÇÃO FINAL: Atualiza o pip para garantir que a flag --no-pep517 seja reconhecida
36
- print("Atualizando o pip...")
37
- subprocess.run([python_executable, "-m", "pip", "install", "--upgrade", "pip"], check=True)
38
-
39
  # Instalar flash-attn
40
  print("Instalando flash-attn...")
41
  subprocess.run(
42
- [
43
- python_executable,
44
- "-m",
45
- "pip",
46
- "install",
47
- "flash-attn",
48
- "--no-build-isolation"
49
- ],
50
  check=True
51
  )
52
  print("✅ Configuração do flash-attn concluída.")
53
 
54
 
55
- # Instalar Apex, forçando o uso do setup.py para compilar as extensões CUDA
56
- print("Instalando Apex a partir do código-fonte...")
57
- subprocess.run(
58
- [
59
- python_executable,
60
- "-m",
61
- "pip",
62
- "install",
63
- "--no-build-isolation",
64
- "--no-pep517", # Esta flag requer um pip atualizado
65
- "git+https://github.com/NVIDIA/apex.git"
66
- ],
67
- check=True
68
- )
 
69
  print("✅ Configuração do Apex concluída.")
70
 
71
 
 
32
  # --- ETAPA 3: Instalar Dependências Corretamente ---
33
  python_executable = sys.executable
34
 
 
 
 
 
35
  # Instalar flash-attn
36
  print("Instalando flash-attn...")
37
  subprocess.run(
38
+ [python_executable, "-m", "pip", "install", "flash-attn", "--no-build-isolation"],
 
 
 
 
 
 
 
39
  check=True
40
  )
41
  print("✅ Configuração do flash-attn concluída.")
42
 
43
 
44
+ # CORREÇÃO FINAL: Usar um método de instalação robusto para o Apex que força a compilação das extensões CUDA.
45
+ print("Clonando o repositório Apex para compilação manual...")
46
+ subprocess.run("git clone https://github.com/NVIDIA/apex.git", shell=True, check=True)
47
+
48
+ print("Instalando Apex a partir do código-fonte clonado com flags de compilação explícitas...")
49
+ # Nota: --global-option é obsoleto, mas necessário para o setup.py do Apex.
50
+ apex_install_command = [
51
+ python_executable, "-m", "pip", "install",
52
+ "--no-build-isolation",
53
+ "--no-cache-dir",
54
+ "--global-option=--cpp_ext",
55
+ "--global-option=--cuda_ext",
56
+ "./apex"
57
+ ]
58
+ subprocess.run(apex_install_command, check=True)
59
  print("✅ Configuração do Apex concluída.")
60
 
61