      # Check for CUDA and cuDNN
          if self.env.enable_cuda and self.env.is_conda:
              self.output.info("Skipping Cuda/cuDNN checks for Conda install")
          elif self.env.enable_cuda and self.env.os_version[0] in ("Linux", "Windows"):
              self.cuda_check()
              self.cudnn_check()
          elif self.env.enable_cuda and self.env.os_version[0] not in ("Linux", "Windows"):
              self.tips.macos()
              self.output.warning("Cannot find CUDA on macOS")
              self.env.cuda_version = input("Manually specify CUDA version: ")
  
 
</s> remove             version = re.search(r".*release (?P<cuda>\d+\.\d+)", stdout.decode(self.env.encoding))
            self.env.cuda_version = version.groupdict().get("cuda", None)
            if self.env.cuda_version:
                self.output.info("CUDA version: " + self.env.cuda_version)
                return
        # Failed to load nvcc
        if self.env.os_version[0] == "Linux":
            self.cuda_check_linux()
        elif self.env.os_version[0] == "Windows":
            self.cuda_check_windows()

    def cuda_check_linux(self):
        """ Check Linux CUDA Version """
 </s> add             version = re.search(r".*release (?P<cuda>\d+\.\d+)",
                                stdout.decode(locale.getpreferredencoding()))
            self.cuda_version = version.groupdict().get("cuda", None)
            locate = "where" if self._os == "windows" else "which"
            path = os.popen(f"{locate} nvcc").read()
            if path:
                path = path.split("\n")[0]  # Split multiple entries and take first found
                while True:  # Get Cuda root folder
                    path, split = os.path.split(path)
                    if split == "bin":
                        break
                self.cuda_path = path
            return

        # Failed to load nvcc, manual check
        getattr(self, f"_cuda_check_{self._os}")()

    def _cuda_check_linux(self):
        """ For Linux check the dynamic link loader for libcudart. If not found with ldconfig then
        attempt to find it in LD_LIBRARY_PATH. """ </s> remove     def cuda_check(self):
        """ Check Cuda for Linux or Windows """
 </s> add class CudaCheck():  # pylint:disable=too-few-public-methods
    """ Find the location of system installed Cuda and cuDNN on Windows and Linux. """

    def __init__(self):
        self.cuda_path = None
        self.cuda_version = None
        self.cudnn_version = None

        self._os = platform.system().lower()
        self._cuda_keys = [key for key in os.environ if key.lower().startswith("cuda_path_v")]
        self._cudnn_header_files = ["cudnn_version.h", "cudnn.h"]

        if self._os in ("windows", "linux"):
            self._cuda_check()
            self._cudnn_check()

    def _cuda_check(self):
        """ Obtain the location and version of Cuda and populate :attr:`cuda_version` and
        :attr:`cuda_path`

        Initially just calls `nvcc -V` to get the installed version of Cuda currently in use.
        If this fails, drills down to more OS specific checking methods.
        """ </s> remove         self.env.cuda_version = cuda_keys[0].lower().replace("cuda_path_v", "").replace("_", ".")
        self.env.cuda_path = os.environ[cuda_keys[0]]
        self.output.info("CUDA version: " + self.env.cuda_version)

    def cudnn_check(self):
        """ Check Linux or Windows cuDNN Version from cudnn.h """
        if self.env.os_version[0] == "Linux":
            cudnn_checkfiles = self.cudnn_checkfiles_linux()
        elif self.env.os_version[0] == "Windows":
            if not self.env.cuda_path and not self.cuda_keys_windows:
                self.output.error(
                    "CUDA not found. See "
                    "https://github.com/deepfakes/faceswap/blob/master/INSTALL.md#cuda "
                    "for instructions")
                return
            if not self.env.cuda_path:
                self.env.cuda_path = os.environ[self.cuda_keys_windows[0]]
            cudnn_checkfiles = self.cudnn_checkfiles_windows()

        cudnn_checkfile = None
        for checkfile in cudnn_checkfiles:
            if os.path.isfile(checkfile):
                cudnn_checkfile = checkfile
                break
 </s> add     def _cudnn_check(self):
        """ Check Linux or Windows cuDNN Version from cudnn.h and add to :attr:`cudnn_version`. """
        cudnn_checkfiles = getattr(self, f"_get_checkfiles_{self._os}")()
        cudnn_checkfile = next((hdr for hdr in cudnn_checkfiles if os.path.isfile(hdr)), None) </s> remove         if self._is_linux:
            cudnn_checkfiles = self._cudnn_checkfiles_linux()
        elif self._is_windows:
            cudnn_checkfiles = self._cudnn_checkfiles_windows()
        else:
            retval = "Unsupported OS"
            if self._is_conda:
                retval += ". Check Conda packages for Conda cuDNN"
            return retval

        cudnn_checkfile = None
        for checkfile in cudnn_checkfiles:
            if os.path.isfile(checkfile):
                cudnn_checkfile = checkfile
                break

        if not cudnn_checkfile:
            retval = "No global version found"
            if self._is_conda:
                retval += ". Check Conda packages for Conda cuDNN"
            return retval

        found = 0
        with open(cudnn_checkfile, "r") as ofile:
            for line in ofile:
                if line.lower().startswith("#define cudnn_major"):
                    major = line[line.rfind(" ") + 1:].strip()
                    found += 1
                elif line.lower().startswith("#define cudnn_minor"):
                    minor = line[line.rfind(" ") + 1:].strip()
                    found += 1
                elif line.lower().startswith("#define cudnn_patchlevel"):
                    patchlevel = line[line.rfind(" ") + 1:].strip()
                    found += 1
                if found == 3:
                    break
        if found != 3:
 </s> add         retval = self._cuda_check.cudnn_version
        if not retval: </s> remove         if self.env.ld_library_path and not chk:
            paths = self.env.ld_library_path.split(":")
            for path in paths:
                chk = os.popen("ls {} | grep -P -o \"libcudart.so.\\d+.\\d+\" | "
                               "head -n 1".format(path)).read()
 </s> add         if not chk and os.environ.get("LD_LIBRARY_PATH"):
            for path in os.environ["LD_LIBRARY_PATH"].split(":"):
                chk = os.popen(f"ls {path} | grep -P -o \"libcudart.so.\\d+.\\d+\" | "
                               "head -n 1").read()
            check = CudaCheck()
            if check.cuda_version:
                self.env.cuda_version = check.cuda_version
                self.output.info("CUDA version: " + self.env.cuda_version)
            else:
                self.output.error("CUDA not found. Install and try again.\n"
                                  "Recommended version:      CUDA 10.1     cuDNN 7.6\n"
                                  "CUDA: https://developer.nvidia.com/cuda-downloads\n"
                                  "cuDNN: https://developer.nvidia.com/rdp/cudnn-download")
                return

            if check.cudnn_version:
                self.env.cudnn_version = ".".join(check.cudnn_version.split(".")[:2])
                self.output.info(f"cuDNN version: {self.env.cudnn_version}")
            else:
                self.output.error("cuDNN not found. See "
                                  "https://github.com/deepfakes/faceswap/blob/master/INSTALL.md#"
                                  "cudnn for instructions")
                return
      # Check for CUDA and cuDNN
          if self.env.enable_cuda and self.env.is_conda:
              self.output.info("Skipping Cuda/cuDNN checks for Conda install")
          elif self.env.enable_cuda and self.env.os_version[0] in ("Linux", "Windows"):
            check = CudaCheck()
            if check.cuda_version:
                self.env.cuda_version = check.cuda_version
                self.output.info("CUDA version: " + self.env.cuda_version)
            else:
                self.output.error("CUDA not found. Install and try again.\n"
                                  "Recommended version:      CUDA 10.1     cuDNN 7.6\n"
                                  "CUDA: https://developer.nvidia.com/cuda-downloads\n"
                                  "cuDNN: https://developer.nvidia.com/rdp/cudnn-download")
                return

            if check.cudnn_version:
                self.env.cudnn_version = ".".join(check.cudnn_version.split(".")[:2])
                self.output.info(f"cuDNN version: {self.env.cudnn_version}")
            else:
                self.output.error("cuDNN not found. See "
                                  "https://github.com/deepfakes/faceswap/blob/master/INSTALL.md#"
                                  "cudnn for instructions")
                return
            check = CudaCheck()
            if check.cuda_version:
                self.env.cuda_version = check.cuda_version
                self.output.info("CUDA version: " + self.env.cuda_version)
            else:
                self.output.error("CUDA not found. Install and try again.\n"
                                  "Recommended version:      CUDA 10.1     cuDNN 7.6\n"
                                  "CUDA: https://developer.nvidia.com/cuda-downloads\n"
                                  "cuDNN: https://developer.nvidia.com/rdp/cudnn-download")
                return

            if check.cudnn_version:
                self.env.cudnn_version = ".".join(check.cudnn_version.split(".")[:2])
                self.output.info(f"cuDNN version: {self.env.cudnn_version}")
            else:
                self.output.error("cuDNN not found. See "
                                  "https://github.com/deepfakes/faceswap/blob/master/INSTALL.md#"
                                  "cudnn for instructions")
                return
          elif self.env.enable_cuda and self.env.os_version[0] not in ("Linux", "Windows"):
              self.tips.macos()
              self.output.warning("Cannot find CUDA on macOS")
              self.env.cuda_version = input("Manually specify CUDA version: ")
  
keep keep keep keep replace replace keep keep keep keep keep
 sysinfo/setup - Standardize cuda/cudnn checks 
setup.py