Socold commited on
Commit
22a3d52
·
verified ·
1 Parent(s): f251b99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -19
app.py CHANGED
@@ -9,14 +9,12 @@ if not os.path.exists("VV_Clone_1"):
9
  # Ajouter au path
10
  sys.path.insert(0, "VV_Clone_1")
11
 
12
- # Installer les dépendances
13
- #subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-r", "VV_Clone_1/requirements.txt"])
14
- # Au lieu de chercher requirements.txt, installer directement les dépendances
15
  subprocess.run([sys.executable, "-m", "pip", "install", "-q",
16
  "torch", "transformers>=4.40.0", "accelerate", "gradio>=4.0.0",
17
  "soundfile", "librosa", "scipy", "numpy", "ffmpeg-python"])
18
 
19
- # Installer le projet VV_Clone_1
20
  subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"])
21
 
22
  import torch
@@ -24,23 +22,22 @@ import gradio as gr
24
  from demo.gradio_demo import VibeVoiceDemo
25
 
26
  # Configuration pour le modèle LARGE
27
- # MODEL_PATH = "microsoft/VibeVoice-1.5B" # Commencez avec celui-ci
28
- MODEL_PATH = "aoi-ot/VibeVoice-Large" # Le modèle Large directement
29
 
30
- USERNAME = "socold01"
31
- PASSWORD = "V#ztdUeS4Zp$0Z4ZB^y3DWhJ"
32
 
33
  print(f"GPU disponible: {torch.cuda.is_available()}")
34
  if torch.cuda.is_available():
35
  print(f"GPU: {torch.cuda.get_device_name(0)}")
36
  print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB")
37
 
38
- # Créer et lancer l'app
39
  try:
40
  demo = VibeVoiceDemo(
41
  model_path=MODEL_PATH,
42
- device="cuda" if torch.cuda.is_available() else "cpu",
43
- torch_dtype=torch.float16 # Optimisation mémoire
44
  )
45
 
46
  interface = demo.create_interface()
@@ -51,13 +48,10 @@ try:
51
  )
52
  except Exception as e:
53
  print(f"Erreur: {e}")
 
 
 
54
  # Interface de fallback
55
  def error_fn(text):
56
- return f"Erreur de chargement: {e}\nVérifiez les logs"
57
-
58
- gr.Interface(
59
- fn=error_fn,
60
- inputs="text",
61
- outputs="text",
62
- title="VibeVoice - Erreur de chargement"
63
- ).launch()
 
9
  # Ajouter au path
10
  sys.path.insert(0, "VV_Clone_1")
11
 
12
+ # Installer les dépendances directement
 
 
13
  subprocess.run([sys.executable, "-m", "pip", "install", "-q",
14
  "torch", "transformers>=4.40.0", "accelerate", "gradio>=4.0.0",
15
  "soundfile", "librosa", "scipy", "numpy", "ffmpeg-python"])
16
 
17
+ # Installer le projet
18
  subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"])
19
 
20
  import torch
 
22
  from demo.gradio_demo import VibeVoiceDemo
23
 
24
  # Configuration pour le modèle LARGE
25
+ MODEL_PATH = "aoi-ot/VibeVoice-Large"
 
26
 
27
+ USERNAME = "socold01"
28
+ PASSWORD = "V#ztdUeS4Zp$0Z4ZB^y3DWhJ"
29
 
30
  print(f"GPU disponible: {torch.cuda.is_available()}")
31
  if torch.cuda.is_available():
32
  print(f"GPU: {torch.cuda.get_device_name(0)}")
33
  print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB")
34
 
35
+ # Créer et lancer l'app - SANS torch_dtype
36
  try:
37
  demo = VibeVoiceDemo(
38
  model_path=MODEL_PATH,
39
+ device="cuda" if torch.cuda.is_available() else "cpu"
40
+ # Enlever torch_dtype d'ici
41
  )
42
 
43
  interface = demo.create_interface()
 
48
  )
49
  except Exception as e:
50
  print(f"Erreur: {e}")
51
+ import traceback
52
+ traceback.print_exc()
53
+
54
  # Interface de fallback
55
  def error_fn(text):
56
+ return f"Erreur: {e}"
57
+ gr.Interface(fn=error_fn, inputs="text", outputs="text", title="VibeVoice - Erreur").launch()