SefyanKehail
commited on
Commit
·
49bb6e1
1
Parent(s):
80284bf
debugging..
Browse files
app.py
CHANGED
|
@@ -51,30 +51,26 @@ def get_file_size_in_mb(file_path):
|
|
| 51 |
# print(get_file_size_in_mb("hifigan.pt"))
|
| 52 |
|
| 53 |
# Load the models using torch.hub
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
# hubert, acoustic, hifigan = None, None, None
|
| 59 |
|
| 60 |
# Load the state dictionaries from the CPU-saved files
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
#
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
#
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
# # Move models to CPU (if not already on CPU)
|
| 75 |
-
# hubert = hubert.to('cpu')
|
| 76 |
-
# acoustic = acoustic.to('cpu')
|
| 77 |
-
# hifigan = hifigan.to('cpu')
|
| 78 |
|
| 79 |
# Function to initialize models with CUDA
|
| 80 |
# def initialize_models():
|
|
|
|
| 51 |
# print(get_file_size_in_mb("hifigan.pt"))
|
| 52 |
|
| 53 |
# Load the models using torch.hub
|
| 54 |
+
hubert = torch.hub.load("bshall/hubert:main", "hubert_soft", trust_repo=True, pretrained=False)
|
| 55 |
+
acoustic = torch.hub.load("bshall/acoustic-model:main", "hubert_soft", trust_repo=True, pretrained=False)
|
| 56 |
+
hifigan = torch.hub.load("bshall/hifigan:main", "hifigan_hubert_soft", trust_repo=True, pretrained=False)
|
| 57 |
|
| 58 |
# hubert, acoustic, hifigan = None, None, None
|
| 59 |
|
| 60 |
# Load the state dictionaries from the CPU-saved files
|
| 61 |
+
hubert_state_dict = torch.load("hubert.pt", map_location=torch.device('cpu'))
|
| 62 |
+
acoustic_state_dict = torch.load("acoustic.pt", map_location=torch.device('cpu'))
|
| 63 |
+
hifigan_state_dict = torch.load("hifigan.pt", map_location=torch.device('cpu'))
|
| 64 |
+
|
| 65 |
+
# Set the state dictionaries to the models
|
| 66 |
+
hubert.load_state_dict(hubert_state_dict)
|
| 67 |
+
acoustic.load_state_dict(acoustic_state_dict)
|
| 68 |
+
hifigan.load_state_dict(hifigan_state_dict)
|
| 69 |
+
|
| 70 |
+
# Move models to CPU (if not already on CPU)
|
| 71 |
+
hubert = hubert.to('cpu')
|
| 72 |
+
acoustic = acoustic.to('cpu')
|
| 73 |
+
hifigan = hifigan.to('cpu')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
# Function to initialize models with CUDA
|
| 76 |
# def initialize_models():
|