Skip to main content

Torch VGGish

A PyTorch port of VGGish1, a feature embedding frontend for audio classification models. The weights are ported directly from the tensorflow model, so embeddings created using torchvggish will be identical.

Quick start

There are two options: you can install the last stable version from pypi, or clone this repo and install.

# optional: create virtual env
cd torchvggish && python3 -m venv .env
source activate .env/bin/activate

pip install -i https://test.pypi.org/simple/ torchvggish==0.1

# OR get the latest version
git clone git@github.com:harritaylor/torchvggish.git
pip install -r requirements.txt

Usage

Barebones example of creating embeddings from an example wav file:

from torchvggish import vggish, vggish_input

# Initialise model and download weights
embedding_model = vggish()
embedding_model.eval()

example = vggish_input.wavfile_to_examples("example.wav")
embeddings = embedding_model.forward(example)

1. S. Hershey et al., ‘CNN Architectures for Large-Scale Audio Classification’,\ in International Conference on Acoustics, Speech and Signal Processing (ICASSP),2017\ Available: https://arxiv.org/abs/1609.09430, https://ai.google/research/pubs/pub45611

Release files for torchvggish 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torchvggish 0.2
File Size Uploaded
torchvggish-0.2.tar.gz 9.7 kB Details

Release files / torchvggish-0.2.tar.gz

Download URL torchvggish-0.2.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fc4d7cc17db557867bf793625f8897f0fc0c6877be737df26ee7d9df6e4ce35f
BLAKE2b-256 checksum
How to use checksums
1ac8162f65a3d6498d06bfae86839448e99ffa2fa9343f51dabfc8174e999942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page