File size: 814 Bytes
7ee1956 43f2182 d8d5cc3 7ee1956 43f2182 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
---
license: mit
tags:
- model_hub_mixin
- pytorch_model_hub_mixin
base_model:
- Alethia/BigCodec
pipeline_tag: feature-extraction
---
# 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")
``` |