              try:
                  downloaded_size = self._url_partial_size
                  req = urllib.request.Request(self._url_download)
                  if downloaded_size != 0:
                      req.add_header("Range", "bytes={}-".format(downloaded_size))
                  response = urllib.request.urlopen(req, timeout=10)
                  self.logger.debug("header info: {%s}", response.info())
                  self.logger.debug("Return Code: %s", response.getcode())
                  self._write_zipfile(response, downloaded_size)
                  break
              except (socket_error, socket_timeout,
                      urllib.error.HTTPError, urllib.error.URLError) as err:
                  if attempt + 1 < self._retries:
                      self.logger.warning("Error downloading model (%s). Retrying %s of %s...",
 
</s> remove             zip_file = zipfile.ZipFile(self._model_zip_path, "r")
            self._write_model(zip_file)
 </s> add             with zipfile.ZipFile(self._model_zip_path, "r") as zip_file:
                self._write_model(zip_file) </s> remove         dropped_files = list()
 </s> add         dropped_files = [] </s> remove                 with open(self._config_file, "r") as cnf:
 </s> add                 with open(self._config_file, "r", encoding="utf8") as cnf: </s> remove                     data[event.step] = self._process_event(event, data.get(event.step, dict()))
 </s> add                     data[event.step] = self._process_event(event, data.get(event.step, {}))
                    req.add_header("Range", f"bytes={downloaded_size}-")
                with urllib.request.urlopen(req, timeout=10) as response:
                    self.logger.debug("header info: {%s}", response.info())
                    self.logger.debug("Return Code: %s", response.getcode())
                    self._write_zipfile(response, downloaded_size)
              try:
                  downloaded_size = self._url_partial_size
                  req = urllib.request.Request(self._url_download)
                  if downloaded_size != 0:
                    req.add_header("Range", f"bytes={downloaded_size}-")
                with urllib.request.urlopen(req, timeout=10) as response:
                    self.logger.debug("header info: {%s}", response.info())
                    self.logger.debug("Return Code: %s", response.getcode())
                    self._write_zipfile(response, downloaded_size)
                    req.add_header("Range", f"bytes={downloaded_size}-")
                with urllib.request.urlopen(req, timeout=10) as response:
                    self.logger.debug("header info: {%s}", response.info())
                    self.logger.debug("Return Code: %s", response.getcode())
                    self._write_zipfile(response, downloaded_size)
                    req.add_header("Range", f"bytes={downloaded_size}-")
                with urllib.request.urlopen(req, timeout=10) as response:
                    self.logger.debug("header info: {%s}", response.info())
                    self.logger.debug("Return Code: %s", response.getcode())
                    self._write_zipfile(response, downloaded_size)
                    req.add_header("Range", f"bytes={downloaded_size}-")
                with urllib.request.urlopen(req, timeout=10) as response:
                    self.logger.debug("header info: {%s}", response.info())
                    self.logger.debug("Return Code: %s", response.getcode())
                    self._write_zipfile(response, downloaded_size)
                    req.add_header("Range", f"bytes={downloaded_size}-")
                with urllib.request.urlopen(req, timeout=10) as response:
                    self.logger.debug("header info: {%s}", response.info())
                    self.logger.debug("Return Code: %s", response.getcode())
                    self._write_zipfile(response, downloaded_size)
                  break
              except (socket_error, socket_timeout,
                      urllib.error.HTTPError, urllib.error.URLError) as err:
                  if attempt + 1 < self._retries:
                      self.logger.warning("Error downloading model (%s). Retrying %s of %s...",
keep keep keep keep replace replace replace replace 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