          print("First time configuration. Please select the required backend")
          while True:
              selection = input("1: AMD, 2: CPU, 3: NVIDIA: ")
              if selection not in ("1", "2", "3"):
                  print("'{}' is not a valid selection. Please try again".format(selection))
                  continue
              break
          fs_backend = self._backends[selection].lower()
          config = {"backend": fs_backend}
          with open(self._config_file, "w") as cnf:
 
</s> remove         with open(self._config_file, "w") as cnf:
 </s> add         with open(self._config_file, "w", encoding="utf8") as cnf: </s> remove         print("Faceswap config written to: {}".format(self._config_file))
 </s> add         print(f"Faceswap config written to: {self._config_file}") </s> remove                 with open(self._config_file, "r") as cnf:
 </s> add                 with open(self._config_file, "r", encoding="utf8") as cnf: </s> remove         with open(config_file, "w") as cnf:
 </s> add         with open(config_file, "w", encoding="utf8") as cnf: </s> remove             method = getattr(self, "_calc_{}".format(selection))
 </s> add             method = getattr(self, f"_calc_{selection}")
                print(f"'{selection}' is not a valid selection. Please try again")
          print("First time configuration. Please select the required backend")
          while True:
              selection = input("1: AMD, 2: CPU, 3: NVIDIA: ")
              if selection not in ("1", "2", "3"):
                print(f"'{selection}' is not a valid selection. Please try again")
                  continue
              break
          fs_backend = self._backends[selection].lower()
          config = {"backend": fs_backend}
          with open(self._config_file, "w") as cnf:
keep keep keep keep replace keep keep keep keep keep
 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 
lib/utils.py