def pytest_addoption(parser):
parser.addoption("--device", action="store", default="cpu")
def pytest_generate_tests(metafunc):
option_value = metafunc.config.option.device
if "device" in metafunc.fixturenames and option_value is not None:
metafunc.parametrize("device", [option_value])
collect_ignore = ["setup.py"]
try:
import numba
except ModuleNotFoundError:
collect_ignore.append("speechbrain/nnet/loss/transducer_loss.py")
try:
import fairseq
except ModuleNotFoundError:
collect_ignore.append("speechbrain/lobes/models/fairseq_wav2vec.py")
try:
from transformers import Wav2Vec2Model
except ModuleNotFoundError:
collect_ignore.append("speechbrain/lobes/models/huggingface_wav2vec.py")
try:
from transformers import WhisperModel
except ModuleNotFoundError:
collect_ignore.append("speechbrain/lobes/models/huggingface_whisper.py")
try:
import sacrebleu
except ModuleNotFoundError:
collect_ignore.append("speechbrain/utils/bleu.py")