Holistic Evaluation of Audio Representations (HEAR) 2021 -- Evaluation Kit
Project description
hear-eval-kit
Evaluation kit for the HEAR Benchmark using tasks from hear-preprocess and audio embedding models that follow the HEAR API.
Downstream evaluation on each task involves two steps:
- computing audio embeddings
- learning a shallow fully-connected predictor
The first step's speed depends upon a variety of factors. The second step's speed is relatively similar between models.
If you have any questions or comments:
- File an issue.
- Email us (deep at neuralaudio dot ai).
Requirements
Tested with Python 3.7 and 3.8. Python 3.9 is not officially supported because pip3 installs are very finicky, but it might work.
We officially support Torch 1.9 and Tensorflor 2.6.0, as well as Tensorflow 2.4.2 using the hack described in the Dockerfile README. We use CUDA 11.2. Other versions are possible, please contact us.
We test on 16GB GCP GPUs.
Quickstart
Here is a simple example to evaluate the hearbaseline wav2vec2 audio embedding model on the Mridingam Tonic task, which is a classification task using sounds from a pitched percussion instrument called a Mridingam.
This example shows how to compute embeddings on a pre-processed version of the data, and then learn a shallow prediction model on the embeddings for evaluation.
Installation
There are 3 ways to run heareval
:
- Locally, through pip3 install (or conda)
- Using Docker
- On the cloud
You are welcome to contact us if you have any questions or issues.
Local installation
pip3 install heareval
Docker
We have docker images containing the heareval
environment.
turian/heareval:stable
contains the latest stable image with all
dependencies bundled in.
Cloud GPUs
The easiest way to do evaluation is to launch a Spotty GCP instance. You can easily adapt Spotty also for AWS GPU instances.
Prepare a spotty.yaml
file with the provided template file:
cp spotty.yaml.tmpl spotty.yaml
Change the instance name in the copied file. Specifically, change "USERNAME"
suffix in instances: name
to allow for multiple users in the same project
to make separate gcp instances and volumes to avoid conflicts within the project.
Run spotty:
spotty start
spotty sh
This requires the heareval Docker image, which is pre-built and published on Dockerhub for your convenience.
Please refer to README.spotty
for more details.
Downloading Tasks
We've released pre-processed versions of all HEAR 2021 open and secret tasks on Zenodo, you can access those here: https://doi.org/10.5281/zenodo.5885750
Note on Sample Rate: All the tasks hosted on Zenodo have been pre-processed to 48kHz. If the embedding model that you are using requires a different sample rate, then you will need to resample the audio to that rate before running.
For other sampling rates (16000, 22050, 32000, 44100), please download files (requester pays) from Google Storage gs://hear2021-archive/tasks/
Alternatively, you can generate the pre-processed datasets using hear-preprocess.
Compute embeddings
time python3 -m heareval.embeddings.runner MODULE_NAME --model WEIGHTS_FILE --tasks-dir hear-2021.0.3/tasks/
where MODULE_NAME
is your embedding model name.
This will create directories embeddings/MODULE_NAME/TASK/
with
your embeddings. If you run the above command multiple times, it
will skip tasks it has already performed embedding on. You can
delete directories if you want to recompute embeddings.
There is an advanced option --model-options
whereby you can pass
a JSON string of parameters to the model. This is useful for
experimenting with model hyperparameters. These options appear in
the embeddings output directory name, so you can run several different
model variations at once.
Evaluation over embeddings
You can then run final downstream evaluation on these embeddings as follows:
python3 -m heareval.predictions.runner embeddings/{MODULE_NAME}/*
This will run on a particular module, over all tasks, with determinism
and the default number of grid points. Embeddings will be loaded
into CPU memory, for speed of training.
Logs will be sent to stdout and concise logs will be in logs/
.
If you run this multiple times, it should be deterministic, but will
always start from scratch.
Ignore warnings about Leaking Caffe2 thread-pool after fork
, this
is a known torch bug.
More advanced flags allow different downstream training regimes
Final test scores are logged to stdout and also to
{EMBEDDINGS_DIR}/{MODULE_NAME}/{TASK_NAME}/test.predicted-scores.json
.
Note on Speed
Models with larger embeddings scale sub-linearly in training time (because of GPU optimizations) and linearly in hop-size (for event-based prediction tasks). The main hyperparameters controlling downstream training time are the maximum number of epochs and number of grid points for grid search.
Development
If you are developing this repo, clone repo:
git clone https://github.com/hearbenchmark/hear-eval-kit
cd hear-eval-kit
Install in development mode:
pip3 install -e ".[dev]"
Make sure you have pre-commit hooks installed:
pre-commit install
Running tests:
python3 -m pytest
NOTE : Please make sure the workflows for each of the open task (./gihub/workflows/task-{task_name}.yml
) is using the correct version of preprocessed tasks from the Preprocessed Downsampled HEAR Open
Tasks Repo
for Continuous Integration.
Current hearpropress version used for Continuous Integration - 2021.0.6
Please keep the version in sync with hearpreprocess
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file heareval-2021.1.3.tar.gz
.
File metadata
- Download URL: heareval-2021.1.3.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9f571af8345f2dc33619c5b2cb6d372e651a2ce6e95b81e2a579f9a6cceb905 |
|
MD5 | 78fe6ca1aa3f57a6d32d2ef3fd16fb8f |
|
BLAKE2b-256 | 6a983158f46a4c43c34459b2cdf6b23ea7a6c97d769742427d228b35225da2c4 |
File details
Details for the file heareval-2021.1.3-py3-none-any.whl
.
File metadata
- Download URL: heareval-2021.1.3-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 593ccb8a6d651f0f974992768438f388ba59f16b575d945346c5d7ec63f8082f |
|
MD5 | 6a58829843febec3583151a6ab82bce8 |
|
BLAKE2b-256 | 68ec2126fb821ced812ef393a7533bad6f2b021cfe47dc1b2b42a3ffc92a188e |