1
0
Fork 0
mirror of https://github.com/deepfakes/faceswap synced 2025-06-07 10:43:27 -04:00
faceswap/tests/startup_test.py
torzdf 03f5c671bc
Remove plaidML support (#1325)
* Remove PlaidML reference from readme files

* Remove AMD option from installers

* remove amd requirements and update setup.py

* remove plaidml test from CI workflow

* gpustats: remove plaidml backend

* plaid removals:
  - faceswap.py - python version check
  - setup.cfg - plaidml typing ignore
  - lib.keras_utils - All plaid code
  - lib.launcher.py - All plaidml checks and configuration

* remove tf2.2 specific code from GUI event reader

* lib.model - remove all plaidml implementations

* plugins.extract - remove plaidml code

* plugins.train remove plaidml code

* lib.convert - remove plaidml code

* tools.model: remove plaidml code

* Remove plaidML tests from unit tests

* remove plaidml_utils and docsting cleanups

* Remove plaidML refs from configs

* fix keras imports
2023-06-21 12:57:33 +01:00

28 lines
1 KiB
Python

#!/usr/bin/env python3
""" Sanity checks for Faceswap. """
import inspect
import pytest
# Ignore linting errors from Tensorflow's thoroughly broken import system
from tensorflow import keras
from tensorflow.keras import backend as K # pylint:disable=import-error
from lib.utils import get_backend
_BACKEND = get_backend()
@pytest.mark.parametrize('dummy', [None], ids=[get_backend().upper()])
def test_backend(dummy): # pylint:disable=unused-argument
""" Sanity check to ensure that Keras backend is returning the correct object type. """
test_var = K.variable((1, 1, 4, 4))
lib = inspect.getmodule(test_var).__name__.split(".")[0]
assert _BACKEND in ("cpu", "directml") and lib == "tensorflow"
@pytest.mark.parametrize('dummy', [None], ids=[get_backend().upper()])
def test_keras(dummy): # pylint:disable=unused-argument
""" Sanity check to ensure that tensorflow keras is being used for CPU """
assert (_BACKEND in ("cpu", "directml")
and keras.__version__ in ("2.7.0", "2.8.0", "2.9.0", "2.10.0"))