fix bug
Browse files- preprocess.py +1 -1
- script.py +25 -25
preprocess.py
CHANGED
|
@@ -34,7 +34,7 @@ def preprocess(audio_file):
|
|
| 34 |
win_len = int(3*sr)
|
| 35 |
last_sample = len(y) - win_len
|
| 36 |
# start_sample_list = np.linspace(0, max(0, last_sample), num=num_eval)
|
| 37 |
-
start_sample_list = [random.randint(0, last_sample) for _ in range(num_eval)]
|
| 38 |
|
| 39 |
frames = []
|
| 40 |
for start_sample in start_sample_list:
|
|
|
|
| 34 |
win_len = int(3*sr)
|
| 35 |
last_sample = len(y) - win_len
|
| 36 |
# start_sample_list = np.linspace(0, max(0, last_sample), num=num_eval)
|
| 37 |
+
start_sample_list = [random.randint(0, max(0, last_sample)) for _ in range(num_eval)]
|
| 38 |
|
| 39 |
frames = []
|
| 40 |
for start_sample in start_sample_list:
|
script.py
CHANGED
|
@@ -51,32 +51,32 @@ print('Define Model')
|
|
| 51 |
# model_path = './checkpoints/RAWNET_ASVSPOOF_FOR_INTHEWILD_PURDUE.pth'
|
| 52 |
# model.load_state_dict(torch.load(model_path, map_location=device))
|
| 53 |
|
| 54 |
-
#
|
| 55 |
-
|
| 56 |
-
#
|
| 57 |
-
#
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
| 61 |
-
# MOE MODEL
|
| 62 |
-
expert_1 = LCNN(return_emb=True).to(device)
|
| 63 |
-
expert_2 = LCNN(return_emb=True).to(device)
|
| 64 |
-
expert_3 = LCNN(return_emb=True).to(device)
|
| 65 |
-
expert_4 = LCNN(return_emb=True).to(device)
|
| 66 |
-
expert_5 = LCNN(return_emb=True).to(device)
|
| 67 |
-
expert_6 = LCNN(return_emb=True).to(device)
|
| 68 |
-
|
| 69 |
-
# # model = UltimateMOE(experts=[expert_1, expert_2, expert_3, expert_4])
|
| 70 |
-
# # model_path = './checkpoints/MOE_ULTIMATE.pth'
|
| 71 |
-
|
| 72 |
-
# model = MOE_attention(experts=[expert_1, expert_2, expert_3, expert_4, expert_5, expert_6], device=device)
|
| 73 |
-
# # model_path = './checkpoints/MOE_ATTENTION.pth'
|
| 74 |
-
# model_path = './checkpoints/MOE_TRANSF.pth'
|
| 75 |
-
|
| 76 |
-
expert_7 = LCNN(return_emb=True).to(device)
|
| 77 |
-
model = MOE_attention(experts=[expert_1, expert_2, expert_3, expert_4, expert_5, expert_6, expert_7], device=device, freezing=True)
|
| 78 |
-
# model_path = './checkpoints/MOE_TRANSF_7EXP.pth'
|
| 79 |
-
model_path = './checkpoints/MOE_TRANSF_7EXP_AUG.pth'
|
| 80 |
|
| 81 |
|
| 82 |
model = (model).to(device)
|
|
|
|
| 51 |
# model_path = './checkpoints/RAWNET_ASVSPOOF_FOR_INTHEWILD_PURDUE.pth'
|
| 52 |
# model.load_state_dict(torch.load(model_path, map_location=device))
|
| 53 |
|
| 54 |
+
# LCNN MODEL
|
| 55 |
+
model = LCNN(return_emb=False).to(device)
|
| 56 |
+
# model_path = './checkpoints/LCNN_ASVSPOOF_FOR_INTHEWILD_PURDUE.pth'
|
| 57 |
+
# model_path = './checkpoints/LCNN_ALL_DATA.pth'
|
| 58 |
+
model_path = './checkpoints/LCNN_ALL_DATA_AUG.pth'
|
| 59 |
+
model.load_state_dict(torch.load(model_path, map_location=device))
|
| 60 |
|
| 61 |
+
# # MOE MODEL
|
| 62 |
+
# expert_1 = LCNN(return_emb=True).to(device)
|
| 63 |
+
# expert_2 = LCNN(return_emb=True).to(device)
|
| 64 |
+
# expert_3 = LCNN(return_emb=True).to(device)
|
| 65 |
+
# expert_4 = LCNN(return_emb=True).to(device)
|
| 66 |
+
# expert_5 = LCNN(return_emb=True).to(device)
|
| 67 |
+
# expert_6 = LCNN(return_emb=True).to(device)
|
| 68 |
+
#
|
| 69 |
+
# # # model = UltimateMOE(experts=[expert_1, expert_2, expert_3, expert_4])
|
| 70 |
+
# # # model_path = './checkpoints/MOE_ULTIMATE.pth'
|
| 71 |
+
#
|
| 72 |
+
# # model = MOE_attention(experts=[expert_1, expert_2, expert_3, expert_4, expert_5, expert_6], device=device)
|
| 73 |
+
# # # model_path = './checkpoints/MOE_ATTENTION.pth'
|
| 74 |
+
# # model_path = './checkpoints/MOE_TRANSF.pth'
|
| 75 |
+
#
|
| 76 |
+
# expert_7 = LCNN(return_emb=True).to(device)
|
| 77 |
+
# model = MOE_attention(experts=[expert_1, expert_2, expert_3, expert_4, expert_5, expert_6, expert_7], device=device, freezing=True)
|
| 78 |
+
# # model_path = './checkpoints/MOE_TRANSF_7EXP.pth'
|
| 79 |
+
# model_path = './checkpoints/MOE_TRANSF_7EXP_AUG.pth'
|
| 80 |
|
| 81 |
|
| 82 |
model = (model).to(device)
|