Skip to main content

Holistic Evaluation of Audio Representations (HEAR) 2021 -- Evaluation Kit

Project description

HEAR2021

hear-eval-kit

Evaluation kit for HEAR 2021 NeurIPS competition, using tasks from hear-preprocess.

hear-eval-kit

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:

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 quickstart to evaluate hearbaseline using random projections and a tiny subset of the open tasks. More detailed instructions are below.

Open In Colab

Installation

There are 3 ways to run heareval:

  1. Locally, through pip3 install (or conda)
  2. Using Docker
  3. 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.

Download Open Tasks

If you are on GCP cloud, you can freely download open tasks as follows:

gsutil -m cp gs://hear2021/open-tasks/hear-2021.0.3-*-{SAMPLE_RATE}.gz . && for f in hear-*.gz; do tar zxf "$f"; done

where SAMPLE_RATE in {16000, 20050, 32000, 44100, 48000} is the sample rate your model desires.

If you are downloading from HTTPS, please only download open tasks once and mirror them internally, because cloud downloads are expensive for us. We are looking for longer-term hosting options.

Download:

https://storage.googleapis.com/hear2021/open-tasks/hear-2021.0.3-{TASK}-{SAMPLE_RATE}.tar.gz

for the following tasks:

    dcase2016_task2-hear2021-full
    nsynth_pitch-v2.2.3-5h
    nsynth_pitch-v2.2.3-50h
    speech_commands-v0.0.2-5h
    speech_commands-v0.0.2-full

where SAMPLE_RATE in {16000, 20050, 32000, 44100, 48000} is the sample rate your model desires.

Untar all the files.

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/neuralaudio/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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heareval-2021.0.5.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

heareval-2021.0.5-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file heareval-2021.0.5.tar.gz.

File metadata

  • Download URL: heareval-2021.0.5.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.7

File hashes

Hashes for heareval-2021.0.5.tar.gz
Algorithm Hash digest
SHA256 a7eed4afffac25c0da277cc0b88ff6c1098c60bd44ab7c91ec6d0490524ed104
MD5 d54f4c076078ee5e2ffaec471450a5a8
BLAKE2b-256 95fcce905ddac50bd523dd15e50b042dfc2dbaddfeb63446bc5a37a52dd9095a

See more details on using hashes here.

File details

Details for the file heareval-2021.0.5-py3-none-any.whl.

File metadata

  • Download URL: heareval-2021.0.5-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.7

File hashes

Hashes for heareval-2021.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c377381e03df343b7b24a1f7086117c309220635eb16b8f570d76ed52bec53a3
MD5 674c3d94b3df8475e792558778649959
BLAKE2b-256 9043210e1b7a3c7acd510c1a4916cfbbbd3e246fb6d689221f193a7ffff8265c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page