Skip to main content

Wrapper package for librilight-abx.

Project description

LibriLight ABX

This is a wrapper module around the abx implementation found in libri-light/eval. This module only adds a wrapper function to directly call abx evaluation and a dataclass object annotating all arguments as well as a setup.py to allow installation as a module.

Installation

You can install this module from pip directly using the following command : pip install zerospeech-libriabx

Or you can install from source by cloning this repository and running : pip install .

Usage

From command line

A command line is created to allow running abx evaluations.

usage: libri-abx [-h] [--path_checkpoint PATH_CHECKPOINT] [--file_extension {.pt,.npy,.wav,.flac,.mp3}] [--feature_size FEATURE_SIZE] [--cuda] [--mode {all,within,across}]
                 [--distance_mode {euclidian,cosine,kl,kl_symmetric}] [--max_size_group MAX_SIZE_GROUP] [--max_x_across MAX_X_ACROSS] [--out OUT]
                 path_data path_item_file

ABX metric

positional arguments:
  path_data             Path to directory containing the data
  path_item_file        Path to the .item file

optional arguments:
  -h, --help            show this help message and exit
  --path_checkpoint PATH_CHECKPOINT
                        Path to a CPC checkpoint. If set, the apply the model to the input data to compute the features
  --file_extension {.pt,.npy,.wav,.flac,.mp3}
  --feature_size FEATURE_SIZE
                        Size (in s) of one feature
  --cuda                Use the GPU to compute distances
  --mode {all,within,across}
                        Choose the mode of the ABX score to compute
  --distance_mode {euclidian,cosine,kl,kl_symmetric}
                        Choose the kind of distance to use to compute the ABX score.
  --max_size_group MAX_SIZE_GROUP
                        Max size of a group while computing theABX score. A small value will make the code faster but less precise.
  --max_x_across MAX_X_ACROSS
                        When computing the ABX across score, maximumnumber of speaker X to sample per couple A,B. A small value will make the code faster but less precise.
  --out OUT             Path where the results should be saved

From python API

To call the abx evaluation from python code you can use the following example :

from pathlib import Path
import libriabx

args = libriabx.AbxArguments(
    path_data=Path("/location/to/scores/")
    path_item_file=Path("/location/to/file.item")
    **other_options
)
result = libriabx.abx_eval(args)

For all possible options see the AbxArguments class definition.

Result is a dictionary containing Dict{mode -> score} where mode is defined as (across, within)

Building & Upload

For security & compatibility reasons binary builds require a special environment to be build. We need to use the manylinux docker container so that correct flags are used.

To do this run :

> docker pull quay.io/pypa/manylinux2014_x86_64
> docker run --rm -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 bash /io/build_wheel.sh

To check for pyversions available docker run --rm quay.io/pypa/manylinux2014_x86_64 ls /opt/python

This allows to populate with compiled versions of libriabx for python3.8, python3.9, python3.10, python3.11 in the dist folder. For more information see ManyLinux Implementation

Once binaries have been build we can upload them to pypi using : twine upload dist/*

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

zerospeech-libriabx-1.0.5.tar.gz (139.2 kB view details)

Uploaded Source

Built Distributions

zerospeech_libriabx-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (440.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

zerospeech_libriabx-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (419.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

zerospeech_libriabx-1.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (557.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

zerospeech_libriabx-1.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (559.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file zerospeech-libriabx-1.0.5.tar.gz.

File metadata

  • Download URL: zerospeech-libriabx-1.0.5.tar.gz
  • Upload date:
  • Size: 139.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for zerospeech-libriabx-1.0.5.tar.gz
Algorithm Hash digest
SHA256 b4445070dbecbe7559775961f508c468c161f9292f165fcbeed20ca2d7e5042c
MD5 a721ce741b038f2ab900749d6a6e31f5
BLAKE2b-256 59e2c7e693c53f31e7a176724ce7d981ba673d45862305084ac270d42c4af547

See more details on using hashes here.

File details

Details for the file zerospeech_libriabx-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for zerospeech_libriabx-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 70130d92e10235da435c26de1a1dff060487284e0a6ad2c99a87ac840e132c3d
MD5 58a0f03cc577d59663757ba7df0c8cbf
BLAKE2b-256 73270793ee2369d456872d1cf0f328648e052935dc51dcdc676536e91dccc157

See more details on using hashes here.

File details

Details for the file zerospeech_libriabx-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for zerospeech_libriabx-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adfe3a42518490d260c251d008665594d823f0b135a6badfd35ab0ed9d01659b
MD5 005c1ed6c18afc6b4eda2262a829559e
BLAKE2b-256 83a2840a59da235dd8780a02cdb47632adf5341ac025ff75b6b0434153abf007

See more details on using hashes here.

File details

Details for the file zerospeech_libriabx-1.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for zerospeech_libriabx-1.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e23de560d92f68378cf44b78f991dfb54d819f89f970be3e6515c84ff542fedd
MD5 8e3389356227424883580efbfb2bebf8
BLAKE2b-256 b73a54ea519f1279742f481cfa40feb812be36c921e7c012e05ecdc3bd38c747

See more details on using hashes here.

File details

Details for the file zerospeech_libriabx-1.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for zerospeech_libriabx-1.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04dcf589d27449251f233a407de539bbb789388648e24ebfbd57bb07fe99ec86
MD5 c4addbb768561531e91ea162a18201c8
BLAKE2b-256 2190518f81973cf7ec5cdbb8e00d7f039793ffedca67094ebdb056657bf64bf3

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