Commit
·
7602eb2
1
Parent(s):
971afa1
fix hubert loading
Browse files
app.py
CHANGED
|
@@ -39,6 +39,7 @@ import math
|
|
| 39 |
from utils import load_audio, CSVutil
|
| 40 |
|
| 41 |
global DoFormant, Quefrency, Timbre
|
|
|
|
| 42 |
|
| 43 |
if not os.path.isdir('csvdb/'):
|
| 44 |
os.makedirs('csvdb')
|
|
@@ -246,8 +247,11 @@ associated_links = {}
|
|
| 246 |
def load_hubert():
|
| 247 |
global hubert_model
|
| 248 |
# Load the model
|
| 249 |
-
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
| 251 |
# Prepare the model
|
| 252 |
hubert_model = hubert_model.to(config.device)
|
| 253 |
if config.is_half:
|
|
|
|
| 39 |
from utils import load_audio, CSVutil
|
| 40 |
|
| 41 |
global DoFormant, Quefrency, Timbre
|
| 42 |
+
from transformers import HubertModel, HubertConfig
|
| 43 |
|
| 44 |
if not os.path.isdir('csvdb/'):
|
| 45 |
os.makedirs('csvdb')
|
|
|
|
| 247 |
def load_hubert():
|
| 248 |
global hubert_model
|
| 249 |
# Load the model
|
| 250 |
+
|
| 251 |
+
configH= HubertConfig()
|
| 252 |
+
configH.output_hidden_states = True
|
| 253 |
+
hubert_model = HubertModel(configH)
|
| 254 |
+
hubert_model.load_state_dict(torch.load('hubert.pth'))
|
| 255 |
# Prepare the model
|
| 256 |
hubert_model = hubert_model.to(config.device)
|
| 257 |
if config.is_half:
|