Package: deeptrain
DeepTrainFull knowledge and control of the train state.FeaturesDeepTrain is founded oncontrolandintrospection: full knowledge and manipulation of the train state.Train LoopResumability: interrupt-protection, can pause mid-trainingTracking & reproducibility: save & load model, train state, random seeds, and hyperparameter infoData PipelineFlexible batch_size: can differ from that of loaded files, will split/combine (ex)Faster SSD loading: load larger batches to maximize read speed utilityStateful timeseries: splits up a batch into windows, andreset_states()(RNNs) at end (ex)Introspection & UtilitiesModel: auto descriptive naming (ex); gradients, weights, activations visuals (ex)Train state: image log of key attributes for easy reference (ex); batches marked w/ "set nums" - know what's being fit and whenAlgorithms, preprocesing, calibration: tools for inspecting & manipulating data and modelsComplete listWhen is DeepTrain suitable (and not)?Trainingfewmodelsthoroughly: closely tracking model and train attributes to debug performance and inform next steps.DeepTrain isnotfor models that take under an hour to train, or for training hundreds of models at once.What does DeepTrain do?Abstract away boilerplate train loop and data loading code,withoutmaking it into a black box. Code is written intuitively and fully documented.
Everything about the train state can be seen viadedicated attributes; which batch is being fit and when, how long until an epoch ends, intermediate metrics, etc.DeepTrain isnota "wrapper" around TF; while currently only supporting TF, fitting and data logic is framework-agnostic.How it worksWe definetg = TrainGenerator(**configs),calltg.train().get_data()is called, returning data & labels,fed tomodel.fit(), returningmetrics,which are then printed, recorded.The loop repeats, orvalidate()is called.Oncevalidate()finishes, training may checkpoint, andtrain()is called again. Internally, data loads withDataGenerator.load_data()(using e.g.np.load).That's the high-level overview; detailshere. Callbacks & other behavior can be configured for every stage of training.ExamplesMNIST AutoEncoderTimeseries ClassificationHealth MonitoringTracking WeightsReproducibilityFlexible batch_sizeInstallationpip install deeptrain(without data; seehow to run examples), or clone repositoryQuickstartTo run, DeepTrain requires (1) a compiled model; (2) data directories (train & val). Below is a minimalistic example.Checkpointing, visualizing, callbacks & more can be accomplished via additional arguments; seeBasicandAdvancedexamples.
Also seeRecommended Usage.fromtensorflow.keras.layersimportInput,Densefromtensorflow.keras.modelsimportModelfromdeeptrainimportTrainGenerator,DataGeneratoript=Input((16,))out=Dense(10,'softmax')(ipt)model=Model(ipt,out)model.compile('adam','categorical_crossentropy')dg=DataGenerator(data_path="data/train",labels_path="data/train/labels.npy")vdg=DataGenerator(data_path="data/val",labels_path="data/val/labels.npy")tg=TrainGenerator(model,dg,vdg,epochs=3,logs_dir="logs/")tg.train()In future releasesMetaTrainer: direct support for dynamic model recompiling with changing hyperparameters, and optimizing thereofPyTorch support