16khz; bug fix - last step processing
Browse files- README.md +2 -41
- model.py +4 -0
- save_model.ipynb +23 -16
- test_DAC.ipynb +6 -6
README.md
CHANGED
@@ -9,7 +9,7 @@ tags:
|
|
9 |
# Descript Audio Codec (DAC)
|
10 |
DAC is the state-of-the-art audio tokenizer with improvement upon the previous tokenizers like SoundStream and EnCodec.
|
11 |
|
12 |
-
This model card provides an easy-to-use API for a *pretrained DAC* [1] for
|
13 |
|
14 |
|
15 |
|
@@ -47,7 +47,7 @@ from transformers import AutoModel
|
|
47 |
device = 'cpu' # or 'cuda:0'
|
48 |
|
49 |
# load
|
50 |
-
model = AutoModel.from_pretrained('hance-ai/descript-audio-codec-
|
51 |
model.to(device)
|
52 |
```
|
53 |
|
@@ -86,45 +86,6 @@ loaded_s = model.load_tensor('tokens.pt')
|
|
86 |
|
87 |
|
88 |
|
89 |
-
# Runtime
|
90 |
-
|
91 |
-
To give you a brief idea, the following table reports average runtime on CPU and GPU to encode and decode 10s audio. The runtime is measured in second. The used CPU is Intel Core i9 11900K and GPU is RTX3060.
|
92 |
-
```
|
93 |
-
| Task | CPU | GPU |
|
94 |
-
|-----------------|---------|---------|
|
95 |
-
| Encoding | 6.71 | 0.19 |
|
96 |
-
| Decoding | 15.4 | 0.31 |
|
97 |
-
```
|
98 |
-
The decoding process takes a longer simply because the decoder is larger than the encoder.
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
# Technical Discussion
|
109 |
-
|
110 |
-
### Chunk-based Processing
|
111 |
-
It's introduced for memory-efficient processing for both encoding and decoding.
|
112 |
-
For encoding, we simply chunk an audio into N chunks and process them iteratively.
|
113 |
-
Similarly, for decoding, we chunk a token set into M chunks of token subsets and process them iteratively.
|
114 |
-
However, the decoding process with naive chunking causes an artifact in the decoded audio.
|
115 |
-
That is because the decoder reconstructs audio given multiple neighboring tokens (i.e., multiple neighboring tokens for a segment of audio) rather than a single token for a segment of audio.
|
116 |
-
|
117 |
-
To tackle the problem, we introduce overlap between the chunks in the decoding, parameterized by `decoding_overlap_rate` in the model. By default, we introduce 10% of overlap between the chunks. Then, two subsequent chunks reuslt in two segments of audio with 10% overlap, and the overlap is averaged out for smoothing.
|
118 |
-
|
119 |
-
The following figure compares reconstructed audio with and without the overlapping.
|
120 |
-
<p align="center">
|
121 |
-
<img src=".fig/artifact-dac-decoding without overlap.png" alt="" width=50%>
|
122 |
-
</p>
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
|
129 |
|
130 |
# References
|
|
|
9 |
# Descript Audio Codec (DAC)
|
10 |
DAC is the state-of-the-art audio tokenizer with improvement upon the previous tokenizers like SoundStream and EnCodec.
|
11 |
|
12 |
+
This model card provides an easy-to-use API for a *pretrained DAC* [1] for 16khz audio whose backbone and pretrained weights are from [its original reposotiry](https://github.com/descriptinc/descript-audio-codec). With this API, you can encode and decode by a single line of code either using CPU or GPU. Furhtermore, it supports chunk-based processing for memory-efficient processing, especially important for GPU processing.
|
13 |
|
14 |
|
15 |
|
|
|
47 |
device = 'cpu' # or 'cuda:0'
|
48 |
|
49 |
# load
|
50 |
+
model = AutoModel.from_pretrained('hance-ai/descript-audio-codec-16khz', trust_remote_code=True)
|
51 |
model.to(device)
|
52 |
```
|
53 |
|
|
|
86 |
|
87 |
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
|
91 |
# References
|
model.py
CHANGED
@@ -177,6 +177,10 @@ class DAC(PreTrainedModel):
|
|
177 |
chunk = zq[:,:, start:end] # (b, d, chunk_size)
|
178 |
waveform = self.dac.decode(chunk.to(self.device)) # (b, 1, chunk_size*self.downsampling_rate)
|
179 |
waveform = waveform.cpu()
|
|
|
|
|
|
|
|
|
180 |
|
181 |
if isinstance(waveform_concat, type(None)):
|
182 |
waveform_concat = waveform.clone()
|
|
|
177 |
chunk = zq[:,:, start:end] # (b, d, chunk_size)
|
178 |
waveform = self.dac.decode(chunk.to(self.device)) # (b, 1, chunk_size*self.downsampling_rate)
|
179 |
waveform = waveform.cpu()
|
180 |
+
|
181 |
+
waveform_len = waveform.shape[-1]
|
182 |
+
if waveform_len < overlap_size_in_data_space:
|
183 |
+
overlap_size_in_data_space = waveform_len
|
184 |
|
185 |
if isinstance(waveform_concat, type(None)):
|
186 |
waveform_concat = waveform.clone()
|
save_model.ipynb
CHANGED
@@ -47,32 +47,32 @@
|
|
47 |
],
|
48 |
"source": [
|
49 |
"# create instances\n",
|
50 |
-
"config = DACConfig(model_type_by_sampling_freq='
|
51 |
"model = DAC(config)"
|
52 |
]
|
53 |
},
|
54 |
{
|
55 |
"cell_type": "code",
|
56 |
-
"execution_count":
|
57 |
"metadata": {},
|
58 |
"outputs": [
|
59 |
{
|
60 |
"name": "stderr",
|
61 |
"output_type": "stream",
|
62 |
"text": [
|
63 |
-
"c:\\Users\\dslee\\anaconda3\\envs\\sound_effect_variation_generation\\lib\\site-packages\\huggingface_hub\\file_download.py:159: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\dslee\\.cache\\huggingface\\hub\\models--hance-ai--descript-audio-codec-
|
64 |
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
|
65 |
" warnings.warn(message)\n",
|
66 |
-
"model.safetensors: 100%|ββββββββββ|
|
67 |
]
|
68 |
},
|
69 |
{
|
70 |
"data": {
|
71 |
"text/plain": [
|
72 |
-
"CommitInfo(commit_url='https://huggingface.co/hance-ai/descript-audio-codec-
|
73 |
]
|
74 |
},
|
75 |
-
"execution_count":
|
76 |
"metadata": {},
|
77 |
"output_type": "execute_result"
|
78 |
}
|
@@ -82,7 +82,7 @@
|
|
82 |
"with open('token.txt', 'r') as file:\n",
|
83 |
" token = file.read().strip()\n",
|
84 |
"\n",
|
85 |
-
"model.push_to_hub('hance-ai/descript-audio-codec-
|
86 |
]
|
87 |
},
|
88 |
{
|
@@ -110,10 +110,10 @@
|
|
110 |
"text": [
|
111 |
"C:\\Users\\dslee\\AppData\\Roaming\\Python\\Python38\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
112 |
" from .autonotebook import tqdm as notebook_tqdm\n",
|
113 |
-
"c:\\Users\\dslee\\anaconda3\\envs\\sound_effect_variation_generation\\lib\\site-packages\\huggingface_hub\\file_download.py:159: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\dslee\\.cache\\huggingface\\hub\\models--hance-ai--descript-audio-codec-
|
114 |
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
|
115 |
" warnings.warn(message)\n",
|
116 |
-
"A new version of the following files was downloaded from https://huggingface.co/hance-ai/descript-audio-codec-
|
117 |
"- model.py\n",
|
118 |
". Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.\n",
|
119 |
"C:\\Users\\dslee\\AppData\\Roaming\\Python\\Python38\\site-packages\\audiotools\\ml\\layers\\base.py:172: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.\n",
|
@@ -126,7 +126,7 @@
|
|
126 |
"source": [
|
127 |
"# load the uploaded model\n",
|
128 |
"from transformers import AutoModel\n",
|
129 |
-
"model = AutoModel.from_pretrained('hance-ai/descript-audio-codec-
|
130 |
"model.to('cpu');"
|
131 |
]
|
132 |
},
|
@@ -139,8 +139,8 @@
|
|
139 |
"name": "stdout",
|
140 |
"output_type": "stream",
|
141 |
"text": [
|
142 |
-
"zq.shape: torch.Size([1, 1024,
|
143 |
-
"s.shape: torch.Size([1,
|
144 |
]
|
145 |
}
|
146 |
],
|
@@ -161,10 +161,17 @@
|
|
161 |
"metadata": {},
|
162 |
"outputs": [
|
163 |
{
|
164 |
-
"
|
165 |
-
"
|
166 |
-
"
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
]
|
169 |
}
|
170 |
],
|
|
|
47 |
],
|
48 |
"source": [
|
49 |
"# create instances\n",
|
50 |
+
"config = DACConfig(model_type_by_sampling_freq='16khz')\n",
|
51 |
"model = DAC(config)"
|
52 |
]
|
53 |
},
|
54 |
{
|
55 |
"cell_type": "code",
|
56 |
+
"execution_count": 4,
|
57 |
"metadata": {},
|
58 |
"outputs": [
|
59 |
{
|
60 |
"name": "stderr",
|
61 |
"output_type": "stream",
|
62 |
"text": [
|
63 |
+
"c:\\Users\\dslee\\anaconda3\\envs\\sound_effect_variation_generation\\lib\\site-packages\\huggingface_hub\\file_download.py:159: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\dslee\\.cache\\huggingface\\hub\\models--hance-ai--descript-audio-codec-16khz. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n",
|
64 |
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
|
65 |
" warnings.warn(message)\n",
|
66 |
+
"model.safetensors: 100%|ββββββββββ| 297M/297M [00:11<00:00, 26.9MB/s] \n"
|
67 |
]
|
68 |
},
|
69 |
{
|
70 |
"data": {
|
71 |
"text/plain": [
|
72 |
+
"CommitInfo(commit_url='https://huggingface.co/hance-ai/descript-audio-codec-16khz/commit/67523817a195ced323d12ce4c439590547d8e9c7', commit_message='Upload DAC', commit_description='', oid='67523817a195ced323d12ce4c439590547d8e9c7', pr_url=None, pr_revision=None, pr_num=None)"
|
73 |
]
|
74 |
},
|
75 |
+
"execution_count": 4,
|
76 |
"metadata": {},
|
77 |
"output_type": "execute_result"
|
78 |
}
|
|
|
82 |
"with open('token.txt', 'r') as file:\n",
|
83 |
" token = file.read().strip()\n",
|
84 |
"\n",
|
85 |
+
"model.push_to_hub('hance-ai/descript-audio-codec-16khz', token=token) # put your token"
|
86 |
]
|
87 |
},
|
88 |
{
|
|
|
110 |
"text": [
|
111 |
"C:\\Users\\dslee\\AppData\\Roaming\\Python\\Python38\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
112 |
" from .autonotebook import tqdm as notebook_tqdm\n",
|
113 |
+
"c:\\Users\\dslee\\anaconda3\\envs\\sound_effect_variation_generation\\lib\\site-packages\\huggingface_hub\\file_download.py:159: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\dslee\\.cache\\huggingface\\hub\\models--hance-ai--descript-audio-codec-16khz. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n",
|
114 |
"To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
|
115 |
" warnings.warn(message)\n",
|
116 |
+
"A new version of the following files was downloaded from https://huggingface.co/hance-ai/descript-audio-codec-16khz:\n",
|
117 |
"- model.py\n",
|
118 |
". Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.\n",
|
119 |
"C:\\Users\\dslee\\AppData\\Roaming\\Python\\Python38\\site-packages\\audiotools\\ml\\layers\\base.py:172: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.\n",
|
|
|
126 |
"source": [
|
127 |
"# load the uploaded model\n",
|
128 |
"from transformers import AutoModel\n",
|
129 |
+
"model = AutoModel.from_pretrained('hance-ai/descript-audio-codec-16khz', trust_remote_code=True)\n",
|
130 |
"model.to('cpu');"
|
131 |
]
|
132 |
},
|
|
|
139 |
"name": "stdout",
|
140 |
"output_type": "stream",
|
141 |
"text": [
|
142 |
+
"zq.shape: torch.Size([1, 1024, 500])\n",
|
143 |
+
"s.shape: torch.Size([1, 12, 500])\n"
|
144 |
]
|
145 |
}
|
146 |
],
|
|
|
161 |
"metadata": {},
|
162 |
"outputs": [
|
163 |
{
|
164 |
+
"ename": "RuntimeError",
|
165 |
+
"evalue": "The size of tensor a (1600) must match the size of tensor b (1592) at non-singleton dimension 2",
|
166 |
+
"output_type": "error",
|
167 |
+
"traceback": [
|
168 |
+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
169 |
+
"\u001b[1;31mRuntimeError\u001b[0m Traceback (most recent call last)",
|
170 |
+
"Cell \u001b[1;32mIn[3], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# decoding (from zq -- discrete latent vectors)\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m waveform \u001b[38;5;241m=\u001b[39m \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecode\u001b[49m\u001b[43m(\u001b[49m\u001b[43mzq\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mzq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwaveform.shape:\u001b[39m\u001b[38;5;124m'\u001b[39m, waveform\u001b[38;5;241m.\u001b[39mshape)\n",
|
171 |
+
"File \u001b[1;32mc:\\Users\\dslee\\anaconda3\\envs\\sound_effect_variation_generation\\lib\\site-packages\\torch\\utils\\_contextlib.py:116\u001b[0m, in \u001b[0;36mcontext_decorator.<locals>.decorate_context\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 113\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(func)\n\u001b[0;32m 114\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdecorate_context\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m 115\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m ctx_factory():\n\u001b[1;32m--> 116\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
172 |
+
"File \u001b[1;32m~\\.cache\\huggingface\\modules\\transformers_modules\\hance-ai\\descript-audio-codec-16khz\\67523817a195ced323d12ce4c439590547d8e9c7\\model.py:159\u001b[0m, in \u001b[0;36mDAC.decode\u001b[1;34m(self, zq, s)\u001b[0m\n\u001b[0;32m 156\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39meval()\n\u001b[0;32m 158\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(zq,\u001b[38;5;28mtype\u001b[39m(\u001b[38;5;28;01mNone\u001b[39;00m)):\n\u001b[1;32m--> 159\u001b[0m waveform \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_chunk_decoding\u001b[49m\u001b[43m(\u001b[49m\u001b[43mzq\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# (b, 1, length); output always has a mono-channel.\u001b[39;00m\n\u001b[0;32m 160\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(s,\u001b[38;5;28mtype\u001b[39m(\u001b[38;5;28;01mNone\u001b[39;00m)):\n\u001b[0;32m 161\u001b[0m zq \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcode_to_zq(s)\n",
|
173 |
+
"File \u001b[1;32m~\\.cache\\huggingface\\modules\\transformers_modules\\hance-ai\\descript-audio-codec-16khz\\67523817a195ced323d12ce4c439590547d8e9c7\\model.py:189\u001b[0m, in \u001b[0;36mDAC._chunk_decoding\u001b[1;34m(self, zq)\u001b[0m\n\u001b[0;32m 187\u001b[0m overlap_x_from_prev_x \u001b[38;5;241m=\u001b[39m waveform_concat[:,:,\u001b[38;5;241m-\u001b[39moverlap_size_in_data_space:] \u001b[38;5;66;03m# (b, 1, overlap_size_in_data_space)\u001b[39;00m\n\u001b[0;32m 188\u001b[0m overlap_x_from_new_x \u001b[38;5;241m=\u001b[39m waveform[:,:,:overlap_size_in_data_space] \u001b[38;5;66;03m# (b, 1, overlap_size_in_data_space)\u001b[39;00m\n\u001b[1;32m--> 189\u001b[0m overlap \u001b[38;5;241m=\u001b[39m (\u001b[43moverlap_x_from_prev_x\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[43moverlap_x_from_new_x\u001b[49m) \u001b[38;5;241m/\u001b[39m \u001b[38;5;241m2\u001b[39m \u001b[38;5;66;03m# take mean; maybe there's a better strategy but it seems to work fine.\u001b[39;00m\n\u001b[0;32m 190\u001b[0m waveform_concat \u001b[38;5;241m=\u001b[39m torch\u001b[38;5;241m.\u001b[39mcat((prev_x, overlap, rest_of_new_x), dim\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m) \u001b[38;5;66;03m# (b, 1, ..)\u001b[39;00m\n\u001b[0;32m 191\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
|
174 |
+
"\u001b[1;31mRuntimeError\u001b[0m: The size of tensor a (1600) must match the size of tensor b (1592) at non-singleton dimension 2"
|
175 |
]
|
176 |
}
|
177 |
],
|
test_DAC.ipynb
CHANGED
@@ -37,7 +37,7 @@
|
|
37 |
"# settings\n",
|
38 |
"fname = str(Path(os.getcwd()).joinpath('.sample_sound', 'jazz_swing.wav'))\n",
|
39 |
"device = 'cpu'\n",
|
40 |
-
"model_type_by_sampling_freq = '
|
41 |
]
|
42 |
},
|
43 |
{
|
@@ -71,8 +71,8 @@
|
|
71 |
"name": "stdout",
|
72 |
"output_type": "stream",
|
73 |
"text": [
|
74 |
-
"zq.shape: torch.Size([1, 1024,
|
75 |
-
"s.shape: torch.Size([1,
|
76 |
]
|
77 |
}
|
78 |
],
|
@@ -92,7 +92,7 @@
|
|
92 |
"name": "stdout",
|
93 |
"output_type": "stream",
|
94 |
"text": [
|
95 |
-
"waveform.shape: torch.Size([1, 1,
|
96 |
]
|
97 |
}
|
98 |
],
|
@@ -111,7 +111,7 @@
|
|
111 |
"name": "stdout",
|
112 |
"output_type": "stream",
|
113 |
"text": [
|
114 |
-
"waveform.shape: torch.Size([1, 1,
|
115 |
]
|
116 |
}
|
117 |
],
|
@@ -140,7 +140,7 @@
|
|
140 |
"name": "stderr",
|
141 |
"output_type": "stream",
|
142 |
"text": [
|
143 |
-
"d:\\projects\\descript-audio-codec-
|
144 |
" return torch.load(fname)\n"
|
145 |
]
|
146 |
}
|
|
|
37 |
"# settings\n",
|
38 |
"fname = str(Path(os.getcwd()).joinpath('.sample_sound', 'jazz_swing.wav'))\n",
|
39 |
"device = 'cpu'\n",
|
40 |
+
"model_type_by_sampling_freq = '16khz'"
|
41 |
]
|
42 |
},
|
43 |
{
|
|
|
71 |
"name": "stdout",
|
72 |
"output_type": "stream",
|
73 |
"text": [
|
74 |
+
"zq.shape: torch.Size([1, 1024, 500])\n",
|
75 |
+
"s.shape: torch.Size([1, 12, 500])\n"
|
76 |
]
|
77 |
}
|
78 |
],
|
|
|
92 |
"name": "stdout",
|
93 |
"output_type": "stream",
|
94 |
"text": [
|
95 |
+
"waveform.shape: torch.Size([1, 1, 159912])\n"
|
96 |
]
|
97 |
}
|
98 |
],
|
|
|
111 |
"name": "stdout",
|
112 |
"output_type": "stream",
|
113 |
"text": [
|
114 |
+
"waveform.shape: torch.Size([1, 1, 159912])\n"
|
115 |
]
|
116 |
}
|
117 |
],
|
|
|
140 |
"name": "stderr",
|
141 |
"output_type": "stream",
|
142 |
"text": [
|
143 |
+
"d:\\projects\\descript-audio-codec-16khz\\model.py:213: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.\n",
|
144 |
" return torch.load(fname)\n"
|
145 |
]
|
146 |
}
|