intexcp commited on
Commit
43f2182
·
verified ·
1 Parent(s): 7ee1956

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -4
README.md CHANGED
@@ -3,9 +3,37 @@ license: mit
3
  tags:
4
  - model_hub_mixin
5
  - pytorch_model_hub_mixin
 
 
6
  ---
7
 
8
- This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
9
- - Code: [More Information Needed]
10
- - Paper: [More Information Needed]
11
- - Docs: [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  tags:
4
  - model_hub_mixin
5
  - pytorch_model_hub_mixin
6
+ base_model:
7
+ - Alethia/BigCodec
8
  ---
9
 
10
+ # BigCodec
11
+
12
+ Python library for bigcodec. This is something that the author of bigcodec didn't do, so I'm doing it for him.
13
+
14
+ ## Setup
15
+
16
+ ```
17
+ pip install bigcodec
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ import torch.accelerator
24
+ from bigcodec import BigCodec
25
+ import torchaudio
26
+
27
+ codec = BigCodec.from_pretrained("intexcp/bigcodec")
28
+
29
+ wav = torchaudio.load("enc.wav")[0]
30
+ wav = wav.unsqueeze(0)
31
+ device = torch.accelerator.current_accelerator().type if torch.accelerator.is_available() else "cpu"
32
+ codec = codec.to(device)
33
+ wav = wav.to(device)
34
+ with torch.no_grad():
35
+ enc = codec.encode(wav)
36
+ dec = codec.decode(enc)
37
+ print(enc)
38
+ torchaudio.save("dec.wav", dec.squeeze(0).cpu(), 16000, encoding="PCM_F")
39
+ ```