Skip to main content

CLD: language detection heads for ASR models

Project description

jaxcld

jaxcld is a lightweight language-detection module for multilingual ASR models (Whisper / MMS). It provides an ASRModel wrapper plus pluggable language detection heads you can attach at inference time.

Install

pip install jaxcld

If you are developing from source:

pip install -e .

Using the package (minimal inference example)

import numpy as np

from jaxcld import ASRModel, CVXNNLangDetectHead, NNLangDetectHead, SVMLangDetectHead

# 1) Load the base ASR model
languages = ["en", "hi", "id", "ms", "zh"]
asr = ASRModel.from_pretrained("openai/whisper-small", config={"languages": languages})

# 2) Load a language detection head artifact (choose ONE)
# head = CVXNNLangDetectHead.load("path/to/whisper-small_trained_cvx_mlp.pkl", asr)
# head = NNLangDetectHead.load("path/to/openai_whisper-small_nn_head.pkl", asr)
# head = SVMLangDetectHead.load("path/to/openai_whisper-small_linear_svm.pkl", asr)

# 3) Attach head and run inference
asr.set_lang_detect_head(head)

audio_16k_mono: np.ndarray = ...  # shape (T,), sampling rate 16kHz
pred_langs, pred_texts = asr.predict(audio_16k_mono)
print(pred_langs[0], pred_texts[0])

Notes

  • Head artifacts (*.pkl) are produced by training scripts in the source repository; this pip README intentionally focuses only on package usage.

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

jaxcld-0.1.0.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxcld-0.1.0-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

Details for the file jaxcld-0.1.0.tar.gz.

File metadata

  • Download URL: jaxcld-0.1.0.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jaxcld-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4b155b154d4164ac27b6dfcc15a0f22406c476b761c81b4d5427d983d2af9052
MD5 a1074ca498e3c92eb219603e27f9a1cb
BLAKE2b-256 c3bd0f182df093302173a000f81dbf0ca1e18f1422cc57fda379b5fb65caf058

See more details on using hashes here.

File details

Details for the file jaxcld-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jaxcld-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 61.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for jaxcld-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7050f8907731261f07b3ae493289711f9b37a28aad5834b857bddb262bdcfe5a
MD5 e8d36881fb373a7469cd2b33578b96df
BLAKE2b-256 59bad1c9e58f169fe645e18f2fafce1ac3d8c563a82b395cf4344a0281fbdf87

See more details on using hashes here.

Supported by

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