Package: adjutant-discord
AdjutantAdjutant is a package for managing ML experiments over Discord in conjunction with WandB.Adjutant allows users to run a Discord bot that provides updates on training jobs that have synced with WandB, and allows them to initiate new runs with different hyperparameters by posting in the Discord chat. Once the adjutant client is connected to Discord, users can start and get updates on training runs over Discord, from anywhere; no need to VPN andsshinto your office's servers, no need to open up your computer and try to remember where and in which files you need to set your hyperparameters. Just open up Discord and tell adjutant to start an experiment (or two, or three).Installationpipinstalladjutant-discordDiscord bot creationTo allow adjutant to post to Discord as a bot, first followthese instructionsfor creating a Discord bot and adding it to your Server. You then create anAdjutantobject with your bot token.Note: Be careful not to share your bot's token. Consider storing it in an environment variable or file that is not checked in to version control.WandB setupAdjutant is designed to work with WandB for ML experiment tracking. Create a WandB account atwandb.ai.Wherever you plan to run Adjutant, make sure you are either logged in to your WandB account, or have an API key populated in theWANDB_API_KEYenvironment variable. More information is available inthe WandB docs.Adjutant commandsOnce Adjutant is running and has connected to Discord (seethe Basic Adjutant example belowto get started), you can send it the following commands by posting in the chat.CommandEffectExample$helloGet a response from the bot$hello$experiment {hyperparams}Launch a new experiment with the given hyperparameters (must providerun_experiment_scriptin constructor)$experiment {"epochs": 10, "batch_size": 32}QuickstartFor more advanced examples, please seeexamples, starting withthe MNIST example.Basic AdjutantThe most basic formulation of Adjutant provides updates on WandB experiments under the given project name. Your WandB entity name is your account name, and the project title is the name of the project you have created (or will create) to store experiments.fromadjutantimportAdjutantclient=Adjutant('my-wandb-entity','my-wandb-project-title')client.run('my-discord-token')When you run the script, you will see your bot post to your Discord chat with information on the WandB runs it found for the project.Adjutant with experiment launchingBy providing arun_experiment_scriptconstructor argument, Adjutant will be able to respond to user requests on Discord to run a new experiment. Adjutant will executerun_experiment_scriptin a subprocess so that it can still respond to new requests.run_experiment_scriptmay also request another entity, e.g. Kubernetes, to initiate the experiment on its behalf rather than actually running the experiment itself.First, here are the contents ofrun_experiment.sh, which takes a JSON-formatted string as its command line argument. Adjutant will pass this script the hyperparameters with which to run the experiment. In this script,train_model.pytrains a new model with the supplied hyperparameters. For an example of what the training script might look like, seethe MNIST example.#!/bin/bashpythontrain_model.py"$1"Now we can create a client that referencesrun_experiment.sh.fromadjutantimportAdjutantclient=Adjutant('my-wandb-entity','my-wandb-project-title',run_experiment_script='./run_experiment.sh')client.run('my-discord-token')And we can run an experiment by posting in Discord with the$experimentcommand. Adjutant will start the experiment usingrun_experiment.shand post back on Discord when the run finishes.