(model_path: str)
return model
Load the model from a file.
        @param model_path (str): path to model
Load the model from a file.
Load the model from a file .
def load(model_path: str):
        """ Load the model from a file.
        @param model_path (str): path to model
        """
        params = torch.load(model_path, map_location=lambda storage, loc: storage)
        args = params['args']
        model = NMT(vocab=params['vocab'], **args)
        model.load_state_dict(params['state_dict'])

        return model
def load ( model_path : str ) : params = torch . load ( model_path , map_location = lambda storage , loc : storage ) args = params [ 'args' ] model = NMT ( vocab = params [ 'vocab' ] , * * args ) model . load_state_dict ( params [ 'state_dict' ] ) return model