Skip to main content

Python library for bigcodec.

Project description

BigCodec

Python library for bigcodec. This is something that the author of bigcodec didn't do, so I'm doing it for him.

Setup

pip install bigcodec

Usage

import torch.accelerator
from bigcodec import BigCodec
import torchaudio

codec = BigCodec.from_pretrained("intexcp/bigcodec")

wav = torchaudio.load("enc.wav")[0]
wav = wav.unsqueeze(0)
device = torch.accelerator.current_accelerator().type if torch.accelerator.is_available() else "cpu"
codec = codec.to(device)
wav = wav.to(device)
with torch.no_grad():
    enc = codec.encode(wav)
    dec = codec.decode(enc)
print(enc)
torchaudio.save("dec.wav", dec.squeeze(0).cpu(), 16000, encoding="PCM_F")

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

bigcodec-0.0.3.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

bigcodec-0.0.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file bigcodec-0.0.3.tar.gz.

File metadata

  • Download URL: bigcodec-0.0.3.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for bigcodec-0.0.3.tar.gz
Algorithm Hash digest
SHA256 21a871937b8036522dfa550bd5937bd0e658869d4c4f76bf4312160ab15a0a75
MD5 4efb2cb4e7b59d2d51f8fc474ea31b5a
BLAKE2b-256 87ee10863bc3fe57027ca6e5c929de3e4a3e5c1d70127b1d77040c47d83d5a79

See more details on using hashes here.

File details

Details for the file bigcodec-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: bigcodec-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for bigcodec-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a18fa586ed01fc9fabcfb8311667778ae8e7959880e9dd583e8d782127fb69a6
MD5 7018a6eade28f8d0544dfd6334ed7ef9
BLAKE2b-256 9480569c677c7402eebaf6b84099049fc3ba5e09cd4944d40166993ccbc96bd3

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