graphinvent/Workflow.py
def training_phase(self) -> None:
        """
        Trains model and generates graphs.
        """
        print("* Setting up training job.", flush=True)
        self.train_dataloader = self.get_dataloader(hdf_path=self.train_h5_path,
                                                    data_description="training set")
        self.valid_dataloader = self.get_dataloader(hdf_path=self.valid_h5_path,
                                                    data_description="validation set")

        self.load_training_set_properties()
        self.create_output_files()
        self.analyzer = Analyzer(valid_dataloader=self.valid_dataloader,
                                          train_dataloader=self.train_dataloader,
                                          start_time=self.start_time)

        start_epoch, end_epoch = self.define_model_and_optimizer()

        print("* Beginning training.", flush=True)
        for epoch in range(start_epoch, end_epoch):

            self.current_epoch = epoch
            avg_train_loss = self.train_epoch()
            avg_valid_loss = self.validation_epoch()

            util.write_training_status(epoch=self.current_epoch,
                                       lr=self.optimizer.param_groups[0]["lr"],
                                       training_loss=avg_train_loss,
                                       validation_loss=avg_valid_loss)

            _ = self.evaluate_model(model_to_evaluate=self.model)

        self.print_time_elapsed()

        Trains model and generates graphs.
        
Trains model and generates graphs.
Trains model and generates graphs .
def training_phase(self) -> None:
        print("* Setting up training job.", flush=True)
        self.train_dataloader = self.get_dataloader(hdf_path=self.train_h5_path,
                                                    data_description="training set")
        self.valid_dataloader = self.get_dataloader(hdf_path=self.valid_h5_path,
                                                    data_description="validation set")
        self.load_training_set_properties()
        self.create_output_files()
        self.analyzer = Analyzer(valid_dataloader=self.valid_dataloader,
                                          train_dataloader=self.train_dataloader,
                                          start_time=self.start_time)
        start_epoch, end_epoch = self.define_model_and_optimizer()
        print("* Beginning training.", flush=True)
        for epoch in range(start_epoch, end_epoch):
            self.current_epoch = epoch
            avg_train_loss = self.train_epoch()
            avg_valid_loss = self.validation_epoch()
            util.write_training_status(epoch=self.current_epoch,
                                       lr=self.optimizer.param_groups[0]["lr"],
                                       training_loss=avg_train_loss,
                                       validation_loss=avg_valid_loss)
            _ = self.evaluate_model(model_to_evaluate=self.model)
        self.print_time_elapsed()
def training_phase ( self ) -> None : print ( "* Setting up training job." , flush = True ) self . train_dataloader = self . get_dataloader ( hdf_path = self . train_h5_path , data_description = "training set" ) self . valid_dataloader = self . get_dataloader ( hdf_path = self . valid_h5_path , data_description = "validation set" ) self . load_training_set_properties ( ) self . create_output_files ( ) self . analyzer = Analyzer ( valid_dataloader = self . valid_dataloader , train_dataloader = self . train_dataloader , start_time = self . start_time ) start_epoch , end_epoch = self . define_model_and_optimizer ( ) print ( "* Beginning training." , flush = True ) for epoch in range ( start_epoch , end_epoch ) : self . current_epoch = epoch avg_train_loss = self . train_epoch ( ) avg_valid_loss = self . validation_epoch ( ) util . write_training_status ( epoch = self . current_epoch , lr = self . optimizer . param_groups [ 0 ] [ "lr" ] , training_loss = avg_train_loss , validation_loss = avg_valid_loss ) _ = self . evaluate_model ( model_to_evaluate = self . model ) self . print_time_elapsed ( )
Trains model and generates graphs.
Trains model and generates graphs .
"""
        Trains model and generates graphs.
        """
self