graphinvent/Workflow.py
def testing_phase(self) -> None:
        """
        Evaluates model using test set data.
        """
        self.test_dataloader = self.get_dataloader(self.test_h5_path,
                                                   "test set")
        self.load_training_set_properties()
        self.restart_epoch = util.get_restart_epoch()

        print(f"* Loading model from previous saved state (Epoch "
              f"{self.restart_epoch}).", flush=True)
        model_path = (f"{self.constants.job_dir}"
                      f"model_restart_{self.restart_epoch}.pth")
        self.model = self.create_model()
        self.model = util.load_saved_model(model=self.model, path=model_path)

        self.model.eval()
        with torch.no_grad():
            self.generate_graphs(n_samples=self.constants.n_samples)

            print("* Evaluating model.", flush=True)
            self.analyzer.model = self.model
            self.analyzer.evaluate_model(
                likelihood_per_action=self.likelihood_per_action
            )

        self.print_time_elapsed()

        Evaluates model using test set data.
        
Evaluates model using test set data.
Evaluates model using test set data .
def testing_phase(self) -> None:
        self.test_dataloader = self.get_dataloader(self.test_h5_path,
                                                   "test set")
        self.load_training_set_properties()
        self.restart_epoch = util.get_restart_epoch()
        print(f"* Loading model from previous saved state (Epoch "
              f"{self.restart_epoch}).", flush=True)
        model_path = (f"{self.constants.job_dir}"
                      f"model_restart_{self.restart_epoch}.pth")
        self.model = self.create_model()
        self.model = util.load_saved_model(model=self.model, path=model_path)
        self.model.eval()
        with torch.no_grad():
            self.generate_graphs(n_samples=self.constants.n_samples)
            print("* Evaluating model.", flush=True)
            self.analyzer.model = self.model
            self.analyzer.evaluate_model(
                likelihood_per_action=self.likelihood_per_action
            )
        self.print_time_elapsed()
def testing_phase ( self ) -> None : self . test_dataloader = self . get_dataloader ( self . test_h5_path , "test set" ) self . load_training_set_properties ( ) self . restart_epoch = util . get_restart_epoch ( ) print ( f"* Loading model from previous saved state (Epoch " f"{self.restart_epoch})." , flush = True ) model_path = ( f"{self.constants.job_dir}" f"model_restart_{self.restart_epoch}.pth" ) self . model = self . create_model ( ) self . model = util . load_saved_model ( model = self . model , path = model_path ) self . model . eval ( ) with torch . no_grad ( ) : self . generate_graphs ( n_samples = self . constants . n_samples ) print ( "* Evaluating model." , flush = True ) self . analyzer . model = self . model self . analyzer . evaluate_model ( likelihood_per_action = self . likelihood_per_action ) self . print_time_elapsed ( )
Evaluates model using test set data.
Evaluates model using test set data .
"""
        Evaluates model using test set data.
        """
self