hubertsiuzdak commited on
Commit
873ebef
1 Parent(s): 8f01a00

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -2
README.md CHANGED
@@ -37,7 +37,7 @@ Install it using:
37
  ```bash
38
  pip install snac
39
  ```
40
- To encode (and reconstruct) audio with SNAC in Python, use the following code:
41
 
42
  ```python
43
  import torch
@@ -47,7 +47,15 @@ model = SNAC.from_pretrained("hubertsiuzdak/snac_44khz").eval().cuda()
47
  audio = torch.randn(1, 1, 44100).cuda() # B, 1, T
48
 
49
  with torch.inference_mode():
50
- audio_hat, _, codes, _, _ = model(audio)
 
 
 
 
 
 
 
 
51
  ```
52
 
53
  ⚠️ Note that `codes` is a list of token sequences of variable lengths, each corresponding to a different temporal
 
37
  ```bash
38
  pip install snac
39
  ```
40
+ To encode (and decode) audio with SNAC in Python, use the following code:
41
 
42
  ```python
43
  import torch
 
47
  audio = torch.randn(1, 1, 44100).cuda() # B, 1, T
48
 
49
  with torch.inference_mode():
50
+ codes = model.encode(audio)
51
+ audio_hat = model.decode(codes)
52
+ ```
53
+
54
+ You can also encode and reconstruct in a single call:
55
+
56
+ ```python
57
+ with torch.inference_mode():
58
+ audio_hat, codes = model(audio)
59
  ```
60
 
61
  ⚠️ Note that `codes` is a list of token sequences of variable lengths, each corresponding to a different temporal