Package: classy-core
A PyTorch-based library for fast prototyping and sharing of deep neural network models.Quick Links↗️ Website📓 Documentation💻 Template🔦 Examples✋ Contributing Guidelines🌙 Nightly ReleasesIn this README🚀 Getting Started⚡ Installation⌨ Running Classyclassy trainclassy predictclassy evaluateclassy serveclassy democlassy describeclassy uploadclassy downloadEnableclassyshell completion🤔 Issues❤️ ContributionsGetting Started using classyIf this is your first time meetingclassy, don't worry! We have plenty of resources to help you learn how it works and what it can do for you.For starters, have a look at ouramazing websiteandour documentation!If you want to get your hands dirty right away, have a look at ourbase classy template.
Also, we havea few examplesthat you can look at to get to knowclassy!InstallationFor a more in-depth installation guide (covering also installing from source and through docker), please visit ourinstallation page.If you are using one of ourtemplates, there is a handysetup.shscript you can use that will execute the commands to create the environment and installclassyfor you.Installing via pipSetting up a virtual environmentWe strongly recommend usingCondaas the environment manager when dealing with deep learning / data science / machine learning. It's also recommended that you install the PyTorch ecosystembeforeinstallingclassyby following the instructions onpytorch.orgIf you already have a Python 3 environment you want to use, you can skip to theInstalling the library and dependenciessection.Download and install Conda.Create a Conda environment with Python 3.8+:conda create -n classy python=3.8Activate the Conda environment:conda activate classyInstalling the library and dependenciesSimply executepip install classy-coreand voilà! You're all set.Looking for some adventures? Install nightly releases directly frompypi! You willnotregret it :)RunningclassyOnce it is installed,classyis available as a command line tool. It offers a wide variety of subcommands, all listed below. Detailed guides and references for each command is availablein the documentation.
Every one ofclassy's subcommands have a-h|--helpflag available which details the various arguments & options you can use (e.g.,classy train -h).classy trainIn its simplest form,classy trainlets you train a transformer-based neural network for one of the tasks supported byclassy(seethe documentation).classy train sentence-pair path/to/dataset/folder-or-file -n my-modelThe command above will train a model to predict a label given a pair of sentences as input (e.g., Natural Language Inference or NLI) and save it underexperiments/my-model. This same model can be further used by all otherclassycommands which require aclassymodel (predict,evaluate,serve,demo,upload).classy predictclassy predictactually has two subcommands:interactiveandfile.The first loads the model in memory and lets you try it out through the shell directly, so that you can test the model you trained and see what it predicts given some input. It is particularly useful when your machine cannot open a port forclassy demo.The second, instead, works on a file and produces an output where, for each input, it associates the corresponding predicted label. It is very useful when doing pre-processing or when you need to evaluate your model (although we offerclassy evaluatefor that).classy evaluateclassy evaluatelets you evaluate your model on standard metrics for the task your model was trained upon. Simply runclassy evaluate my-model path/to/file -o path/to/output/fileand it will dump the evaluation atpath/to/output/fileclassy serveclassy serve <model>loads the model in memory and spawns a REST API you can use to query your model with any REST client.classy democlassy demo <model>spawns aStreamlitinterface which lets you quickly show and query your model.classy describeclassy describe <task> --dataset path/to/datasetruns some common metrics on a file formatted for the specific task. Great tool to runbeforetraining your model!classy uploadclassy upload <model>lets you upload yourclassy-trained model on theHuggingFace Huband lets other users download / use it. (NOTE: you need a HuggingFace Hub account in order to upload to their hub)Models uploaded viaclassy uploadwill be available for download by other classy users by simply executingclassy download username@model.classy downloadclassy download <model>downloads a previously uploadedclassy-trained model from theHuggingFace Huband stores it on your machine so that it is usable with any otherclassycommand which requires a trained model (predict,evaluate,serve,demo,upload).Models uploaded viaclassy uploadare available by doingclassy download username@model.Enabling Shell CompletionTo install shell completion,activate your conda environmentand then executeclassy --install-autocompleteFrom now on, whenever you activate your conda environment withclassyinstalled, you are going to have autocompletion when pressing[TAB]!IssuesYou are more than welcome to file issues with either feature requests, bug reports, or general questions. If you already found a solution to your problem, don't hesitate to share it. Suggestions for new best practices and tricks are always welcome!ContributionsWe warmly welcome contributions from the community. If it is your first time as a contributor, we recommend you start by reading our CONTRIBUTING.md guide.Small contributions can be made directly in a pull request. For contributing major features, we recommend you first create a issue proposing a design, so that it can be discussed before you risk wasting time.Pull requests (PRs) must have one approving review and no requested changes before they are merged.
Asclassyis primarily driven by SunglassesAI, we reserve the right to reject or revert contributions that we don't think are good additions or might not fit into our roadmap.