Run some automatic tests with GitHub Actions (#68)

This commit is contained in:
Guillaume Klein
2023-03-22 20:50:03 +01:00
committed by GitHub
parent 52264f2277
commit 66efd02bd0
9 changed files with 143 additions and 2 deletions

31
tests/conftest.py Normal file
View File

@@ -0,0 +1,31 @@
import os
import ctranslate2
import pytest
@pytest.fixture
def data_dir():
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
@pytest.fixture
def jfk_path(data_dir):
return os.path.join(data_dir, "jfk.flac")
@pytest.fixture(scope="session")
def tiny_model_dir(tmp_path_factory):
model_path = str(tmp_path_factory.mktemp("data") / "model")
convert_model("tiny", model_path)
return model_path
def convert_model(size, output_dir):
name = "openai/whisper-%s" % size
ctranslate2.converters.TransformersConverter(
name,
copy_files=["tokenizer.json"],
load_as_float16=True,
).convert(output_dir, quantization="float16")