Here is a diagram of the automatic training system we've been devloping for the dynamic foraging task (those blue arrows on top of our existing foraging behavior pipeline)
This repo is the red circle in the diagram. It will be running on Code Ocean and do the following things (very similar to mTrack):
- Define the training curriculum (mTrack's "Regimen")
- Retrieve data for each mouse from the behavioral master table (
df_behavior
on S3 that stores session-wise metrics) - Evaluate daily performance based on the curriculum and make decisions of the next training stage (stored in
df_manager
) - Push the decisions back to S3 by uploading
df_manager
, from which our python GUI can access and automatically set the training parameters on the next day.
- Task schema defines schema for training parameters
- Curriculum schema defines schema for the curriculum, especially the
evaluate_transitions
method - Auto train manager fetches data from
df_behavior
and updatesdf_manager
(or "tables" on any other database) - Curriculum manager manages all available pre-generated curriculums (on any S3 bucket).
- Design the curriculum, i.e., all training stages and transition rules.
- Here is an example curriculum for the dynamic foraging task.
- Here is automatically generated json file
- Here are automatically rendered diagrams for stage transitions rules and parameters (click the images to try the hover feature 😊)
rules | parameters |
---|---|
-
Create
AutoTrainManager
and connect it to the behavior databasedf_behavior
. -
Feed all necessary metrics to
Auto train manager
and let it run. -
To add other tasks, users should add their own task and curriculum schemas.
- Demo notebook for the curriculum schema.
- Demo notebook for a full automation workflow (auto train manager)
- Demo notebook for the curriculum manager
System upgrade checklist
- Upgrade all training rigs
- Upgrade CO capsule (terminate all running workers and start a new one)
- Upgrade streamlit app
See this thread
Since graphviz
in Code Ocean has some unsolved bug, it is recommended to install the library locally in a conda environment to create new curriculums.
- Clone this repo to your local computer
- Create conda environment by
conda create -n autotrain python=3.8 conda activate autotrain
- Install the library in editable mode
pip install -e .
- Install
graphviz
via conda (which installs necessarydot
.bin files for you)conda install python-graphviz
- Set up AWS credential. (ask Han for this step)
- Test the installation by running demo script
code\aind_auto_train\curriculums\dummy_task.py
- Create you own curriculum based on existing curriculums in
code\aind_auto_train\curriculums\
- Run your new .py file and check the generated diagrams under the default folder
{your windows user folder}/capsule/scratch/saved_curriculums/
- Run the script
code\aind_auto_train\curriculum_manager.py
to upload new curriculum files to AWS S3 buckets3://aind-behavior-data/foraging_auto_training/saved_curriculums/
- Check the new curriculum on the Streamlit app.