Package: torch-kerosene
KeroseneKerosene is a high-level deep Learning framework for fast and clean research development with Pytorch -see the doc for more details.. Kerosene let you focus on your model and data by providing clean and readable code for training, visualizing and debugging your achitecture without forcing you to implement rigid interface for your model.Out of The Box FeaturesBasic training logic and user defined trainersFine grained event system with multiple handlersMultiple metrics and criterions supportAutomatic configuration parsing and model instantiationAutomatic support of mixed precision withApexand dataparallel trainingAutomatic Visdom loggingIntegratedIgnitemetrics andPytorchcriterionsMNIST ExampleHere is a simple example that shows how easy and clean it is to train a simple network. In very few lines of code, the model is trained using mixed precision and you got Visdom + Console logging automatically. See full example there:MNIST-Keroseneif__name__=="__main__":logging.basicConfig(level=logging.INFO)CONFIG_FILE_PATH="config.yml"model_trainer_config,training_config=YamlConfigurationParser.parse(CONFIG_FILE_PATH)train_loader=DataLoader(torchvision.datasets.MNIST('./files/',train=True,download=True,transform=Compose([ToTensor(),Normalize((0.1307,),(0.3081,))])),batch_size=training_config.batch_size_train,shuffle=True)test_loader=DataLoader(torchvision.datasets.MNIST('./files/',train=False,download=True,transform=Compose([ToTensor(),Normalize((0.1307,),(0.3081,))])),batch_size=training_config.batch_size_valid,shuffle=True)visdom_logger=VisdomLogger(VisdomConfiguration.from_yml(CONFIG_FILE_PATH))# Initialize the model trainersmodel_trainer=ModelTrainerFactory(model=SimpleNet()).create(model_trainer_config)# Train with the training strategySimpleTrainer("MNIST Trainer",train_loader,test_loader,None,model_trainer,RunConfiguration(use_amp=False))\.with_event_handler(PlotMonitors(every=500,visdom_logger=visdom_logger),Event.ON_BATCH_END)\.with_event_handler(PlotAvgGradientPerLayer(every=500,visdom_logger=visdom_logger),Event.ON_TRAIN_BATCH_END)\.with_event_handler(PrintTrainingStatus(every=100),Event.ON_BATCH_END)\.train(training_config.nb_epochs)EventsEventDescriptionON_TRAINING_BEGINAt the beginning of the training phaseON_TRAINING_ENDAt the end of the training phaseON_VALID_BEGINAt the beginning of the validation phaseON_VALID_ENDAt the end of the validation phaseON_TEST_BEGINAt the beginning of the test phaseON_TEST_ENDAt the end of the test phaseON_EPOCH_BEGINAt the beginning of each epoch (training, validation, test)ON_EPOCH_ENDAt the end of each epoch (training, validation, test)ON_TRAIN_EPOCH_BEGINAt the beginning of each training epochON_TRAIN_EPOCH_ENDAt the end of each training epochON_VALID_EPOCH_BEGINAt the beginning of each validation epochON_VALID_EPOCH_ENDAt the end of each validation epochON_TEST_EPOCH_BEGINAt the beginning of each test epochON_TEST_EPOCH_ENDAt the end of each test epochON_BATCH_BEGINAt the beginning of each batch (training, validation, test)ON_BATCH_ENDAt the end of each batch (training, validation, test)ON_TRAIN_BATCH_BEGINAt the beginning of each train batchON_TRAIN_BATCH_ENDAt the end of each train batchON_VALID_BATCH_BEGINAt the beginning of each validation batchON_VALID_BATCH_ENDAt the end of each validation batchON_TEST_BATCH_BEGINAt the beginning of each test batchON_TEST_BATCH_ENDAt the end of each test batchON_FINALIZEBefore the end of the processHandlersPrintTrainingStatus (Console)PrintMonitors (Console)PlotMonitors (Visdom)PlotLosses (Visdom)PlotMetrics (Visdom)PlotCustomVariables (Visdom)PlotLR (Visdom)PlotAvgGradientPerLayer (Visdom)CheckpointEarlyStoppingContributingHow to contribute ?Create a branch by feature and/or bug fixGet the codeCommit and pushCreate a pull requestBranch namingFeature branchfeature/ [Short feature description] [Issue number]Bug branchfix/ [Short fix description] [Issue number]Commits syntax:Adding code:+ Added [Short Description] [Issue Number]Deleting code:- Deleted [Short Description] [Issue Number]Modifying code:* Changed [Short Description] [Issue Number]Merging code:Y Merged [Short Description] [Issue Number]Icons made byFreepikfromwww.flaticon.comis licensed byCC 3.0 BY