1
0
Fork 0
mirror of https://github.com/deepfakes/faceswap synced 2025-06-09 04:36:50 -04:00
faceswap/tests/startup_test.py
torzdf c1512fd41d
Update code to support Tensorflow versions up to 2.8 (#1213)
* Update maximum tf version in setup + requirements

* - bump max version of tf version in launcher
- standardise tf version check

* update keras get_custom_objects  for tf>2.6

* bugfix: force black text in GUI file dialogs (linux)

* dssim loss - Move to stock tf.ssim function

* Update optimizer imports for compatibility

* fix logging for tf2.8

* Fix GUI graphing for TF2.8

* update tests

* bump requirements.txt versions

* Remove limit on nvidia-ml-py

* Graphing bugfixes
  - Prevent live graph from displaying if data not yet available

* bugfix: Live graph. Collect loss labels correctly

* fix: live graph - swallow inconsistent loss errors

* Bugfix: Prevent live graph from clearing during training

* Fix graphing for AMD
2022-05-02 14:30:43 +01:00

30 lines
1.1 KiB
Python

#!/usr/bin/env python3
""" Sanity checks for Faceswap. """
import inspect
import pytest
import keras
from keras import backend as K
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 == "cpu" and lib == "tensorflow") or (_BACKEND == "amd" and lib == "plaidml")
@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 and standard
keras for AMD. """
assert ((_BACKEND == "cpu" and keras.__version__ in ("2.3.0-tf", "2.4.0",
"2.6.0", "2.7.0", "2.8.0")) or
(_BACKEND == "amd" and keras.__version__ == "2.2.4"))