def load(self, fname: Optional[str] = None, *args, **kwargs) -> None:
        """Load model from `fname` (if `fname` is not given, use `self.load_path`) to `self.model` along with
            the optimizer `self.optimizer`.
            If `fname` (if `fname` is not given, use `self.load_path`) does not exist, initialize model from scratch.

        Args:
            fname: string path to checkpoint
            *args:
            **kwargs:

        Returns:
            None
        """
        if fname is not None:
            self.load_path = fname

        if self.load_path:
            log.debug(f"Load path {self.load_path} is given.")
            if isinstance(self.load_path, Path) and not self.load_path.parent.is_dir():
                raise ConfigError("Provided load path is incorrect!")

            weights_path = Path(self.load_path.resolve())
            weights_path = weights_path.with_suffix(f".pth.tar")
            if weights_path.exists():
                log.debug(f"Load path {weights_path} exists.")
                log.debug(f"Initializing `{self.__class__.__name__}` from saved.")

                # now load the weights, optimizer from saved
                log.debug(f"Loading weights from {weights_path}.")
                checkpoint = torch.load(weights_path, map_location=self.device)
                model_state = checkpoint["model_state_dict"]
                optimizer_state = checkpoint["optimizer_state_dict"]
                # load a multi-gpu model on a single device
                if all([key.startswith("module.") for key in list(model_state.keys())]):
                    model_state = {key.replace("module.", "", 1): val for key, val in model_state.items()}

                if self.is_data_parallel:
                    self.model.module.load_state_dict(model_state)
                else:
                    self.model.load_state_dict(model_state)
                try:  # TODO: remove this try-except after hf models deep update
                    self.optimizer.load_state_dict(optimizer_state)
                except ValueError as e:
                    log.error(f'Failed to load optimizer state due to {repr(e)}')
                self.epochs_done = checkpoint.get("epochs_done", 0)
            else:
                log.warning(f"Init from scratch. Load path {weights_path} does not exist.")
        else:
            log.warning(f"Init from scratch. Load path {self.load_path} is not provided.")
        self.model.to(self.device)
Load model from `fname` (if `fname` is not given, use `self.load_path`) to `self.model` along with
            the optimizer `self.optimizer`.
            If `fname` (if `fname` is not given, use `self.load_path`) does not exist, initialize model from scratch.

        Args:
            fname: string path to checkpoint
            *args:
            **kwargs:

        Returns:
            None
        
deeppavlov/core/models/torch_model.py