-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Test torch.hub basic functionalities.""" | ||
|
||
from hubconf import utmos22_strong | ||
from speechmos.utmos22.strong.model import UTMOS22Strong | ||
|
||
|
||
def test_utmos22_strong_init(): | ||
"""Test `utmos22_strong` instantiation without weight load.""" | ||
|
||
# Test - progress=True | ||
model = utmos22_strong(progress=True, pretrained=False) | ||
assert isinstance(model, UTMOS22Strong), "UTMOS22Strong not properly instantiated." | ||
|
||
# Test - progress=False | ||
model = utmos22_strong(progress=False, pretrained=False) | ||
assert isinstance(model, UTMOS22Strong), "UTMOS22Strong not properly instantiated." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""Test the utmos22-strong model.""" | ||
|
||
import torch | ||
|
||
from .model import UTMOS22Strong | ||
|
||
|
||
def test_model_init(): | ||
"""Test the `UTMOS22Strong` instantiation.""" | ||
|
||
# Preparation | ||
UTMOS22Strong() | ||
|
||
# Test | ||
assert True, "UTMOS22Strong is not properly instantiated." | ||
|
||
|
||
def test_model_forward(): | ||
"""Test the `UTMOS22Strong` forward run.""" | ||
|
||
# Preparation | ||
model = UTMOS22Strong() | ||
sr = 16000 | ||
ipt = torch.tensor([1. for _ in range(int(sr * 0.5))]).unsqueeze(0) | ||
|
||
# Prerequesite Test | ||
assert ipt.size() == (1, 8000), "Prerequesites are not satisfied." | ||
|
||
# Test | ||
model(ipt, sr) | ||
assert True, "UTMOS22Strong is not properly forwarded." | ||
|
||
|
||
def test_model_output_shape(): | ||
"""Test the `UTMOS22Strong` forward output shape.""" | ||
|
||
# Preparation | ||
model = UTMOS22Strong() | ||
sr = 16000 | ||
ipt = torch.tensor([1. for _ in range(int(sr * 0.5))]).unsqueeze(0) | ||
|
||
# Prerequesite Test | ||
assert ipt.size() == (1, 8000), "Prerequesites are not satisfied." | ||
|
||
# Test | ||
opt = model(ipt, sr) | ||
assert opt.size() == (1,), "UTMOS22Strong is not properly forwarded." |