Package: leanai
LeanAIA library that helps with writing ai functions fast.It ships with a fullDocumentationof its API andExamples.Getting StartedPlease make sure you have pytorch installed properly as a first step.pipinstallleanaiThen follow one of theexamplesor check out theapi documentation.Design PrinciplesThe api consists of 3+1 parts: Data, Model, Training and Core:Datais concerned about loading and preprocessing the data for training, evaluation and deployment.Modelis concerned with implementing the model. Everything required for the forward pass of the model is here.Trainingcontains all required for training a model on data. This includes loss, metrics, optimizers and trainers.Corecontains functionality that is shared across model, data and training.Scientific Principlesin your work are encouraged and actively supported by the library.
For scientific working, it is assumed, that your results are documented in a way, that peer reviewers can agree on the correctness of the results achieved.
This includes two parts. Firstly, your results must be reproducible and secondly they need to be documented in a way that proves to reviewers, that you actually achieved these results.
To facilitate this leanai creates a list of artifacts when running an experiment.
The artifacts and their importance can be found in thescientific_artifacts.md.
We argue, that you should store these artifacts even when not using leanai, to ensure reproducibility and proof that you conducted the experiment.Tutorials & ExamplesGetting Started with MNISTExploring Custom Code on MNISTDetection on COCO (TODO update and notebook)Scaling to Multi-GPU (TODO write up)Fashion MNIST Classsification ExampleHere is the simplest mnist example, it is so short it can be part of the main readme.importtorchfromtorch.optimimportSGDfromleanai.core.configimportDictLikefromleanai.core.experimentimportExperiment,set_seedsfromleanai.data.datasetsimportFashionMNISTDatasetfromleanai.training.lossesimportSparseCrossEntropyLossFromLogitsfromleanai.model.configs.simple_classifierimportbuildSimpleClassifierset_seeds()experiment=Experiment(model=buildSimpleClassifier(num_classes=10,logits=True),example_input=torch.zeros((2,28,28,1),dtype=torch.float32),output_path="outputs",)experiment.run_training(load_dataset=DictLike(type=FashionMNISTDataset,data_path="outputs",),build_loss=DictLike(type=SparseCrossEntropyLossFromLogits,),build_optimizer=DictLike(type=SGD,lr=1e-3,),batch_size=32,epochs=10,)ContributingCurrently there are no guidelines on how to contribute, so the best thing you can do is open up an issue and get in contact that way.
In the issue we can discuss how you can implement your new feature or how to fix that nasty bug.To contribute, please fork the repositroy on github, then clone your fork. Make your changes and submit a merge request.Origin of the NameThis library is the child of all previous libraries for deep learning I have created. However, this time I want to have a simple, easy and lean library.
The goal is to encourage lean development, but also more literally, that the library tries to keep your code lean, as less code means less bugs.LicenseThis repository is under MIT License. Please see thefull license here.