mfn commited on
Commit
c6e4cfe
·
1 Parent(s): 0b6c50b

Fix build for current Spaces runtime

Browse files
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 💻
4
  colorFrom: yellow
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 5.38.0
8
  app_file: app.py
9
  pinned: false
10
  short_description: Demo for DMOSpeech 2
 
4
  colorFrom: yellow
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 6.30.0
8
  app_file: app.py
9
  pinned: false
10
  short_description: Demo for DMOSpeech 2
app.py CHANGED
@@ -9,10 +9,27 @@ import numpy as np
9
  import spaces
10
  import torch
11
  import torchaudio
 
 
12
  from cached_path import cached_path
13
  from huggingface_hub import hf_hub_download
14
  from transformers import pipeline
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  from infer import DMOInference
17
 
18
  ## CUDA DEVICE ##
 
9
  import spaces
10
  import torch
11
  import torchaudio
12
+ import soundfile as sf
13
+ import librosa
14
  from cached_path import cached_path
15
  from huggingface_hub import hf_hub_download
16
  from transformers import pipeline
17
 
18
+
19
+
20
+ def _load_audio(path, *args, **kwargs):
21
+ # torchaudio>=2.9 routes load() through torchcodec; read files with soundfile/librosa instead
22
+ try:
23
+ data, sr = sf.read(path, dtype="float32", always_2d=True)
24
+ wav = torch.from_numpy(data.T.copy())
25
+ except Exception:
26
+ y, sr = librosa.load(path, sr=None, mono=False)
27
+ wav = torch.from_numpy(np.atleast_2d(y).astype(np.float32))
28
+ return wav, sr
29
+
30
+
31
+ torchaudio.load = _load_audio
32
+
33
  from infer import DMOInference
34
 
35
  ## CUDA DEVICE ##
f5_tts/infer/__pycache__/utils_infer.cpython-310.pyc DELETED
Binary file (12.6 kB)
 
f5_tts/model/__pycache__/__init__.cpython-310.pyc DELETED
Binary file (457 Bytes)
 
f5_tts/model/__pycache__/cfm.cpython-310.pyc DELETED
Binary file (5.57 kB)
 
f5_tts/model/__pycache__/dataset.cpython-310.pyc DELETED
Binary file (10.5 kB)
 
f5_tts/model/__pycache__/grpo_duration_trainer.cpython-310.pyc DELETED
Binary file (16 kB)
 
f5_tts/model/__pycache__/modules.cpython-310.pyc DELETED
Binary file (16.8 kB)
 
f5_tts/model/__pycache__/trainer.cpython-310.pyc DELETED
Binary file (9.71 kB)
 
f5_tts/model/__pycache__/utils.cpython-310.pyc DELETED
Binary file (7.6 kB)
 
f5_tts/model/backbones/__pycache__/dit.cpython-310.pyc DELETED
Binary file (5.39 kB)
 
f5_tts/model/backbones/__pycache__/mmdit.cpython-310.pyc DELETED
Binary file (6.92 kB)
 
f5_tts/model/backbones/__pycache__/unett.cpython-310.pyc DELETED
Binary file (5.25 kB)
 
f5_tts/model_new/__pycache__/__init__.cpython-310.pyc DELETED
Binary file (481 Bytes)
 
f5_tts/model_new/__pycache__/cfm.cpython-310.pyc DELETED
Binary file (5.73 kB)
 
f5_tts/model_new/__pycache__/modules.cpython-310.pyc DELETED
Binary file (19.2 kB)
 
f5_tts/model_new/__pycache__/trainer.cpython-310.pyc DELETED
Binary file (11.6 kB)
 
f5_tts/model_new/__pycache__/utils.cpython-310.pyc DELETED
Binary file (7.25 kB)
 
f5_tts/model_new/backbones/__pycache__/dit.cpython-310.pyc DELETED
Binary file (6.65 kB)
 
f5_tts/model_new/backbones/__pycache__/mmdit.cpython-310.pyc DELETED
Binary file (5.5 kB)
 
f5_tts/model_new/backbones/__pycache__/unett.cpython-310.pyc DELETED
Binary file (6.45 kB)
 
infer.py CHANGED
@@ -112,7 +112,7 @@ class DMOInference:
112
  )
113
 
114
  # Load student checkpoint
115
- checkpoint = torch.load(student_checkpoint_path, map_location="cpu")
116
  self.model.load_state_dict(checkpoint["model_state_dict"], strict=False)
117
 
118
  # Setup generator and teacher
@@ -158,7 +158,7 @@ class DMOInference:
158
 
159
  self.SLP.eval()
160
  self.SLP.load_state_dict(
161
- torch.load(checkpoint_path, map_location="cpu")["model_state_dict"]
162
  )
163
 
164
  def predict_duration(
 
112
  )
113
 
114
  # Load student checkpoint
115
+ checkpoint = torch.load(student_checkpoint_path, map_location="cpu", weights_only=False)
116
  self.model.load_state_dict(checkpoint["model_state_dict"], strict=False)
117
 
118
  # Setup generator and teacher
 
158
 
159
  self.SLP.eval()
160
  self.SLP.load_state_dict(
161
+ torch.load(checkpoint_path, map_location="cpu", weights_only=False)["model_state_dict"]
162
  )
163
 
164
  def predict_duration(
requirements.txt CHANGED
@@ -1,41 +1,40 @@
1
- # Main dependencies
2
- accelerate>=0.33.0
3
- # Note: bitsandbytes has platform restrictions - not for arm64 or Darwin (macOS)
4
- bitsandbytes>0.37.0
5
- cached_path
6
- click
7
- datasets
8
- ema_pytorch>=0.5.2
9
- gradio>=3.45.2
10
- hydra-core>=1.3.0
11
- jieba
12
- librosa
13
- matplotlib
14
- numpy<=1.26.4
15
- pydantic<=2.10.6
16
- pydub
17
- pypinyin
18
- safetensors
19
- soundfile
20
- tomli
21
- torch>=2.0.0
22
- torchaudio>=2.0.0
23
- torchdiffeq
24
- tqdm>=4.65.0
25
- transformers
26
- transformers_stream_generator
27
- unidecode
28
- vocos
29
- wandb
30
- x_transformers>=1.31.14
31
-
32
- # Optional dependencies for evaluation
33
- # Uncomment if you need eval features:
34
- # faster_whisper==0.10.1
35
- # funasr
36
- # jiwer
37
- # modelscope
38
- # zhconv
39
- # zhon
40
-
41
  cached_path
 
1
+ # Main dependencies
2
+ accelerate>=0.33.0
3
+ # Note: bitsandbytes has platform restrictions - not for arm64 or Darwin (macOS)
4
+ bitsandbytes>0.37.0
5
+ cached_path
6
+ click
7
+ datasets
8
+ ema_pytorch>=0.5.2
9
+ gradio>=3.45.2
10
+ hydra-core>=1.3.0
11
+ jieba
12
+ librosa
13
+ matplotlib
14
+ numpy<=1.26.4
15
+ pydub
16
+ pypinyin
17
+ safetensors
18
+ soundfile
19
+ tomli
20
+ torch==2.11.0
21
+ torchaudio==2.11.0
22
+ torchdiffeq
23
+ tqdm>=4.65.0
24
+ transformers>=5.0
25
+ transformers_stream_generator
26
+ unidecode
27
+ vocos
28
+ wandb
29
+ x_transformers>=1.31.14
30
+
31
+ # Optional dependencies for evaluation
32
+ # Uncomment if you need eval features:
33
+ # faster_whisper==0.10.1
34
+ # funasr
35
+ # jiwer
36
+ # modelscope
37
+ # zhconv
38
+ # zhon
39
+
 
40
  cached_path