2023-09-28 23:45:04 +00:00
|
|
|
from os import path
|
2023-09-26 02:57:25 +00:00
|
|
|
from typing import List
|
2023-09-28 23:45:04 +00:00
|
|
|
from unittest import skipUnless
|
2023-09-26 02:57:25 +00:00
|
|
|
|
2023-09-28 23:45:04 +00:00
|
|
|
from onnx_web.params import DeviceParams
|
2023-09-26 02:57:25 +00:00
|
|
|
|
|
|
|
|
2023-09-28 23:45:04 +00:00
|
|
|
def test_needs_models(models: List[str]):
|
2023-11-20 05:18:57 +00:00
|
|
|
return skipUnless(
|
|
|
|
all([path.exists(model) for model in models]), "model does not exist"
|
|
|
|
)
|
2023-09-28 23:45:04 +00:00
|
|
|
|
|
|
|
|
2023-11-23 17:19:58 +00:00
|
|
|
def test_needs_onnx_models(models: List[str]):
|
|
|
|
return skipUnless(
|
|
|
|
all([path.exists(f"{model}.onnx") for model in models]), "model does not exist"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-09-28 23:45:04 +00:00
|
|
|
def test_device() -> DeviceParams:
|
2023-11-20 05:18:57 +00:00
|
|
|
return DeviceParams("cpu", "CPUExecutionProvider")
|
2023-09-28 23:45:04 +00:00
|
|
|
|
|
|
|
|
2023-11-22 01:11:04 +00:00
|
|
|
TEST_MODEL_CORRECTION_CODEFORMER = "../models/.cache/correction-codeformer.pth"
|
2023-10-07 00:04:48 +00:00
|
|
|
TEST_MODEL_DIFFUSION_SD15 = "../models/stable-diffusion-onnx-v1-5"
|
|
|
|
TEST_MODEL_UPSCALING_SWINIR = "../models/.cache/upscaling-swinir.pth"
|