models/Transformer/class_wrapper.py
def load_model(self, pre_trained_model=None, model_directory=None):
        """
        Loading the model from the check point folder with name best_model_forward.pt
        :return:
        """
        if pre_trained_model is None:       # Loading the trained model
            if model_directory is None:
                model_directory = self.ckpt_dir
            # self.model.load_state_dict(torch.load(os.path.join(self.ckpt_dir, 'best_model_state_dict.pt')))
            self.model = torch.load(os.path.join(model_directory, 'best_model_forward.pt'))
            print("You have successfully loaded the model from ", model_directory)
        else:       # Loading the pretrained model from the internet
            print("Loading pre-trained model, if this fails, check that you have the same architecture!")
            self.model = torch.load(os.path.join('pre_trained_models','Transformer',
                                                pre_trained_model, 'best_model_forward.pt'))
            print("You have successfully loaded the pretrained model for ", pre_trained_model)

        Loading the model from the check point folder with name best_model_forward.pt
        :return:
        
Loading the model from the check point folder with name best_model_forward.pt
Loading the model from the check point folder with name best_model_forward . pt
def load_model(self, pre_trained_model=None, model_directory=None):
        if pre_trained_model is None:       
            if model_directory is None:
                model_directory = self.ckpt_dir
            self.model = torch.load(os.path.join(model_directory, 'best_model_forward.pt'))
            print("You have successfully loaded the model from ", model_directory)
        else:       
            print("Loading pre-trained model, if this fails, check that you have the same architecture!")
            self.model = torch.load(os.path.join('pre_trained_models','Transformer',
                                                pre_trained_model, 'best_model_forward.pt'))
            print("You have successfully loaded the pretrained model for ", pre_trained_model)
def load_model ( self , pre_trained_model = None , model_directory = None ) : if pre_trained_model is None : if model_directory is None : model_directory = self . ckpt_dir self . model = torch . load ( os . path . join ( model_directory , 'best_model_forward.pt' ) ) print ( "You have successfully loaded the model from " , model_directory ) else : print ( "Loading pre-trained model, if this fails, check that you have the same architecture!" ) self . model = torch . load ( os . path . join ( 'pre_trained_models' , 'Transformer' , pre_trained_model , 'best_model_forward.pt' ) ) print ( "You have successfully loaded the pretrained model for " , pre_trained_model )
Loading the model from the check point folder with name best_model_forward.pt
Loading the model from the check point folder with name best_model_forward . pt
"""
        Loading the model from the check point folder with name best_model_forward.pt
        :return:
        """ # Loading the trained model
 # self.model.load_state_dict(torch.load(os.path.join(self.ckpt_dir, 'best_model_state_dict.pt')))
 # Loading the pretrained model from the internet

None
self
pre_trained_model
model_directory