          pypath = os.path.dirname(os.path.realpath(__file__))
          config_file = os.path.join(pypath, "config", ".faceswap")
          with open(config_file, "w") as cnf:
              json.dump(config, cnf)
          self.output.info("Faceswap config written to: {}".format(config_file))
  
  
  class Output():
      """ Format and display output """
      def __init__(self):
 
</s> remove         with open(config_file, "w") as cnf:
 </s> add         with open(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, "w") as cnf:
 </s> add         with open(self._config_file, "w", encoding="utf8") as cnf: </s> remove         requirements = list()
        git_requirements = list()
 </s> add         requirements = []
        git_requirements = [] </s> remove                 with open(self._config_file, "r") as cnf:
 </s> add                 with open(self._config_file, "r", encoding="utf8") as cnf:
        self.output.info(f"Faceswap config written to: {config_file}")

    def set_ld_library_path(self):
        """ Update the LD_LIBRARY_PATH environment variable when activating a conda environment
        and revert it when deactivating.

        Notes
        -----
        From Tensorflow 2.7, installing Cuda Toolkit from conda-forge and tensorflow from pip
        causes tensorflow to not be able to locate shared libs and hence not use the GPU.
        We update the environment variable for all instances using Conda as it shouldn't hurt
        anything and may help avoid conflicts with globally installed Cuda
        """
        if not self.is_conda or not self.enable_cuda:
            return

        if self.os_version[0] == "Windows":
            return

        conda_prefix = os.environ["CONDA_PREFIX"]
        activate_folder = os.path.join(conda_prefix, "etc", "conda", "activate.d")
        deactivate_folder = os.path.join(conda_prefix, "etc", "conda", "deactivate.d")

        os.makedirs(activate_folder, exist_ok=True)
        os.makedirs(deactivate_folder, exist_ok=True)

        activate_script = os.path.join(conda_prefix, activate_folder, f"env_vars.sh")
        deactivate_script = os.path.join(conda_prefix, deactivate_folder, f"env_vars.sh")

        if os.path.isfile(activate_script):
            # Only create file if it does not already exist. There may be instances where people
            # have created their own scripts, but these should be few and far between and those
            # people should already know what they are doing.
            return

        conda_libs = os.path.join(conda_prefix, "lib")
        shebang = "#!/bin/sh\n\n"

        with open(activate_script, "w", encoding="utf8") as afile:
            afile.write(f"{shebang}")
            afile.write("export OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}\n")
            afile.write(f"export LD_LIBRARY_PATH='{conda_libs}':${{LD_LIBRARY_PATH}}\n")

        with open(deactivate_script, "w", encoding="utf8") as afile:
            afile.write(f"{shebang}")
            afile.write("export LD_LIBRARY_PATH=${OLD_LD_LIBRARY_PATH}\n")
            afile.write("unset OLD_LD_LIBRARY_PATH\n")

        self.output.info(f"Cuda search path set to '{conda_libs}'")
          pypath = os.path.dirname(os.path.realpath(__file__))
          config_file = os.path.join(pypath, "config", ".faceswap")
          with open(config_file, "w") as cnf:
              json.dump(config, cnf)
        self.output.info(f"Faceswap config written to: {config_file}")

    def set_ld_library_path(self):
        """ Update the LD_LIBRARY_PATH environment variable when activating a conda environment
        and revert it when deactivating.

        Notes
        -----
        From Tensorflow 2.7, installing Cuda Toolkit from conda-forge and tensorflow from pip
        causes tensorflow to not be able to locate shared libs and hence not use the GPU.
        We update the environment variable for all instances using Conda as it shouldn't hurt
        anything and may help avoid conflicts with globally installed Cuda
        """
        if not self.is_conda or not self.enable_cuda:
            return

        if self.os_version[0] == "Windows":
            return

        conda_prefix = os.environ["CONDA_PREFIX"]
        activate_folder = os.path.join(conda_prefix, "etc", "conda", "activate.d")
        deactivate_folder = os.path.join(conda_prefix, "etc", "conda", "deactivate.d")

        os.makedirs(activate_folder, exist_ok=True)
        os.makedirs(deactivate_folder, exist_ok=True)

        activate_script = os.path.join(conda_prefix, activate_folder, f"env_vars.sh")
        deactivate_script = os.path.join(conda_prefix, deactivate_folder, f"env_vars.sh")

        if os.path.isfile(activate_script):
            # Only create file if it does not already exist. There may be instances where people
            # have created their own scripts, but these should be few and far between and those
            # people should already know what they are doing.
            return

        conda_libs = os.path.join(conda_prefix, "lib")
        shebang = "#!/bin/sh\n\n"

        with open(activate_script, "w", encoding="utf8") as afile:
            afile.write(f"{shebang}")
            afile.write("export OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}\n")
            afile.write(f"export LD_LIBRARY_PATH='{conda_libs}':${{LD_LIBRARY_PATH}}\n")

        with open(deactivate_script, "w", encoding="utf8") as afile:
            afile.write(f"{shebang}")
            afile.write("export LD_LIBRARY_PATH=${OLD_LD_LIBRARY_PATH}\n")
            afile.write("unset OLD_LD_LIBRARY_PATH\n")

        self.output.info(f"Cuda search path set to '{conda_libs}'")
  
  
  class Output():
      """ Format and display output """
      def __init__(self):
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 
setup.py