(cls, task_name, hparams, overwrite=False, **kwargs)
return model
Create a new instance of this class. Prepares the model directory
        and saves hyperparams. Derived classes should override this function
        to save other dependencies (e.g. vocabs)
Create a new instance of this class. Prepares the model directory
        and saves hyperparams. Derived classes should override this function
        to save other dependencies (e.g. vocabs)
Create a new instance of this class . Prepares the model directory and saves hyperparams . Derived classes should override this function to save other dependencies ( e . g . vocabs )
def create(cls, task_name, hparams, overwrite=False, **kwargs):
        """
        Create a new instance of this class. Prepares the model directory
        and saves hyperparams. Derived classes should override this function
        to save other dependencies (e.g. vocabs)
        """
        logger.info(hparams)
        model_dir = gen_model_dir(task_name, cls)
        model = cls(hparams, **kwargs)
        # Xavier initialization
        model.apply(xavier_uniform_init)

        if torch.cuda.is_available():
            model = model.cuda()

        prepare_model_dir(model_dir, overwrite)

        #Save hyperparams
        torch.save(hparams, os.path.join(model_dir, HYPERPARAMS_FILE))

        return model
def create ( cls , task_name , hparams , overwrite = False , * * kwargs ) : logger . info ( hparams ) model_dir = gen_model_dir ( task_name , cls ) model = cls ( hparams , * * kwargs ) # Xavier initialization model . apply ( xavier_uniform_init ) if torch . cuda . is_available ( ) : model = model . cuda ( ) prepare_model_dir ( model_dir , overwrite ) #Save hyperparams torch . save ( hparams , os . path . join ( model_dir , HYPERPARAMS_FILE ) ) return model