Feature Extraction
Transformers.js
ONNX
English
embedding_gemma2
audio
music
music-information-retrieval
text-to-audio-retrieval
embeddings
Instructions to use jaisawhney/SonicEmbed-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use jaisawhney/SonicEmbed-ONNX with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'jaisawhney/SonicEmbed-ONNX');
Initial release
Browse files- .gitattributes +37 -35
- LICENSE +202 -0
- README.md +141 -0
- chat_template.jinja +1 -0
- config.json +130 -0
- config_sentence_transformers.json +32 -0
- onnx/audio_encoder.onnx +3 -0
- onnx/audio_encoder.onnx_data +3 -0
- onnx/audio_encoder_fp16.onnx +3 -0
- onnx/audio_encoder_fp16.onnx_data +3 -0
- onnx/audio_encoder_q4.onnx +3 -0
- onnx/audio_encoder_q4.onnx_data +3 -0
- onnx/audio_encoder_quantized.onnx +3 -0
- onnx/audio_encoder_quantized.onnx_data +3 -0
- onnx/model.onnx +3 -0
- onnx/model.onnx_data +3 -0
- onnx/model_fp16.onnx +3 -0
- onnx/model_fp16.onnx_data +3 -0
- onnx/model_q4.onnx +3 -0
- onnx/model_q4.onnx_data +3 -0
- onnx/model_quantized.onnx +3 -0
- onnx/model_quantized.onnx_data +3 -0
- preprocessor_config.json +22 -0
- processor_config.json +78 -0
- scripts/pyproject.toml +17 -0
- scripts/song_describer.py +127 -0
- scripts/uv.lock +0 -0
- tokenizer.json +3 -0
- tokenizer_config.json +57 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,37 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.onnx_data filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers.js
|
| 6 |
+
pipeline_tag: feature-extraction
|
| 7 |
+
base_model: jaisawhney/SonicEmbed
|
| 8 |
+
tags:
|
| 9 |
+
- onnx
|
| 10 |
+
- audio
|
| 11 |
+
- music
|
| 12 |
+
- music-information-retrieval
|
| 13 |
+
- text-to-audio-retrieval
|
| 14 |
+
- embeddings
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# SonicEmbed ONNX
|
| 18 |
+
|
| 19 |
+
ONNX builds of [SonicEmbed](https://huggingface.co/jaisawhney/SonicEmbed) for ONNX Runtime and Transformers.js. Its model card covers the full results and training.
|
| 20 |
+
|
| 21 |
+
| Build | Files | Size | R@10, three clips | R@10, one clip | R@1, three clips | Median rank, three clips |
|
| 22 |
+
| --------------------- | ------------------- | -------- | ----------------- | -------------- | ---------------- | ------------------------ |
|
| 23 |
+
| `fp32` | no suffix | 2,257 MB | 40.7 | 36.7 | 9.4 | 16.5 |
|
| 24 |
+
| `fp16` | `_fp16` | 1,128 MB | 40.7 | 36.8 | 9.5 | 16.5 |
|
| 25 |
+
| `q8` | `_quantized` | 654 MB | 40.6 | 36.6 | 9.6 | 16 |
|
| 26 |
+
| `q8` audio, `q4` text | `_quantized`, `_q4` | 514 MB | 40.4 | 35.9 | 9.3 | 17 |
|
| 27 |
+
| `q4` | `_q4` | 363 MB | 37.8 | 34.5 | 7.8 | 19 |
|
| 28 |
+
| PyTorch | [SonicEmbed](https://huggingface.co/jaisawhney/SonicEmbed) | 2,307 MB | 40.4 | 36.7 | 9.5 | 16 |
|
| 29 |
+
|
| 30 |
+
Scores are text-to-music search on Song Describer.
|
| 31 |
+
|
| 32 |
+
- **Audio must already be 16 kHz mono:** resample first.
|
| 33 |
+
- **Only the first 30 s of audio is used:** anything longer is truncated. To cover a whole track, average clips, as shown on SonicEmbed's card.
|
| 34 |
+
- **Prompts:** start text you search with `task: search result | query:`, and text you search through with `title: none | text:`. Audio takes no prompt.
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
### Transformers.js
|
| 39 |
+
|
| 40 |
+
```js
|
| 41 |
+
import { AutoModel, AutoProcessor } from "@huggingface/transformers";
|
| 42 |
+
|
| 43 |
+
const id = "jaisawhney/SonicEmbed-ONNX";
|
| 44 |
+
const processor = await AutoProcessor.from_pretrained(id);
|
| 45 |
+
const model = await AutoModel.from_pretrained(id, { dtype: "fp16" });
|
| 46 |
+
|
| 47 |
+
const queryInputs = await processor("task: search result | query: calm piano");
|
| 48 |
+
const queryOutputs = await model(queryInputs);
|
| 49 |
+
const query = queryOutputs.sentence_embedding;
|
| 50 |
+
|
| 51 |
+
// audio is a mono 16 kHz Float32Array.
|
| 52 |
+
const trackInputs = await processor(null, null, audio);
|
| 53 |
+
const trackOutputs = await model(trackInputs);
|
| 54 |
+
const track = trackOutputs.sentence_embedding;
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### ONNX Runtime
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
pip install onnxruntime transformers huggingface_hub librosa
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
import librosa
|
| 65 |
+
import numpy as np
|
| 66 |
+
import onnxruntime as ort
|
| 67 |
+
from huggingface_hub import snapshot_download
|
| 68 |
+
from transformers import AutoFeatureExtractor, AutoTokenizer
|
| 69 |
+
|
| 70 |
+
BUILD = "_fp16"
|
| 71 |
+
NO_FEATURES = np.zeros((0, 512), "float32")
|
| 72 |
+
|
| 73 |
+
folder = snapshot_download(
|
| 74 |
+
"jaisawhney/SonicEmbed-ONNX",
|
| 75 |
+
allow_patterns=[f"onnx/*{BUILD}.onnx*", "*.json"],
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
tokenizer = AutoTokenizer.from_pretrained(folder)
|
| 79 |
+
extractor = AutoFeatureExtractor.from_pretrained(folder)
|
| 80 |
+
audio_encoder = ort.InferenceSession(f"{folder}/onnx/audio_encoder{BUILD}.onnx")
|
| 81 |
+
text_model = ort.InferenceSession(f"{folder}/onnx/model{BUILD}.onnx")
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def embed(input_ids, audio_features):
|
| 85 |
+
outputs = text_model.run(
|
| 86 |
+
["sentence_embedding"],
|
| 87 |
+
{
|
| 88 |
+
"input_ids": input_ids,
|
| 89 |
+
"attention_mask": np.ones_like(input_ids),
|
| 90 |
+
"image_features": NO_FEATURES,
|
| 91 |
+
"video_features": NO_FEATURES,
|
| 92 |
+
"audio_features": audio_features,
|
| 93 |
+
},
|
| 94 |
+
)
|
| 95 |
+
embedding = outputs[0][0]
|
| 96 |
+
return embedding / np.linalg.norm(embedding)
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
def embed_text(text):
|
| 100 |
+
input_ids = tokenizer(text, return_tensors="np")["input_ids"]
|
| 101 |
+
return embed(input_ids, NO_FEATURES)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def embed_audio(wave):
|
| 105 |
+
inputs = extractor([wave], sampling_rate=16000, return_tensors="np")
|
| 106 |
+
outputs = audio_encoder.run(
|
| 107 |
+
None,
|
| 108 |
+
{
|
| 109 |
+
"input_features": inputs["input_features"],
|
| 110 |
+
"input_features_mask": inputs["input_features_mask"],
|
| 111 |
+
},
|
| 112 |
+
)
|
| 113 |
+
audio_features = outputs[0]
|
| 114 |
+
|
| 115 |
+
audio_start, audio_token, audio_end = tokenizer.convert_tokens_to_ids(
|
| 116 |
+
["<|audio>", "<|audio|>", "<audio|>"]
|
| 117 |
+
)
|
| 118 |
+
tokens = [tokenizer.bos_token_id, audio_start]
|
| 119 |
+
tokens += [audio_token] * len(audio_features)
|
| 120 |
+
tokens += [audio_end, tokenizer.eos_token_id]
|
| 121 |
+
return embed(np.array([tokens]), audio_features)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
wave, _ = librosa.load("song.flac", sr=16000, mono=True)
|
| 125 |
+
track = embed_audio(wave)
|
| 126 |
+
query = embed_text("task: search result | query: calm piano")
|
| 127 |
+
print(query @ track)
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Reproducing the numbers
|
| 131 |
+
|
| 132 |
+
`scripts/` scores the builds on Song Describer, which downloads 3.3 GB on the first run. You only need [uv](https://docs.astral.sh/uv/getting-started/installation/).
|
| 133 |
+
|
| 134 |
+
```bash
|
| 135 |
+
uv sync
|
| 136 |
+
uv run song_describer.py fp32 fp16 q8 q8:q4 q4
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
## License and credits
|
| 140 |
+
|
| 141 |
+
Apache-2.0. The graphs come from [onnx-community/embeddinggemma-2-ONNX](https://huggingface.co/onnx-community/embeddinggemma-2-ONNX).
|
chat_template.jinja
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{%- for msg in messages if msg.get('role') == 'system' -%}{%- if msg.get('content') is string -%}{{ msg['content'] }}{%- else -%}{%- for item in msg['content'] if item.get('type') == 'text' -%}{{ item['text'] }}{%- endfor -%}{%- endif -%}{%- endfor -%}{%- for msg in messages if msg.get('role') != 'system' -%}{%- if msg.get('content') is string -%}{{ msg['content'] }}{%- else -%}{%- set existing_text = msg['content'] | selectattr('type', 'equalto', 'text') | map(attribute='text') | join -%}{%- set has_manual_placeholders = ('<|image|>' in existing_text) or ('<|video|>' in existing_text) or ('<|audio|>' in existing_text) -%}{%- for item in msg['content'] -%}{%- if item.get('type') == 'text' -%}{{ item['text'] }}{%- elif not has_manual_placeholders and item.get('type') == 'image' -%}<|image|>{%- elif not has_manual_placeholders and item.get('type') == 'video' -%}<|video|>{%- elif not has_manual_placeholders and item.get('type') == 'audio' -%}<|audio|>{%- endif -%}{%- endfor -%}{%- endif -%}{%- endfor -%}
|
config.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"EmbeddingGemma2Model"
|
| 4 |
+
],
|
| 5 |
+
"audio_config": {
|
| 6 |
+
"attention_chunk_size": 12,
|
| 7 |
+
"attention_context_left": 13,
|
| 8 |
+
"attention_context_right": 0,
|
| 9 |
+
"attention_invalid_logits_value": -1000000000.0,
|
| 10 |
+
"attention_logit_cap": 50.0,
|
| 11 |
+
"conv_kernel_size": 5,
|
| 12 |
+
"dtype": "float32",
|
| 13 |
+
"gradient_clipping": 10000000000.0,
|
| 14 |
+
"hidden_act": "silu",
|
| 15 |
+
"hidden_size": 1024,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"model_type": "gemma4_audio",
|
| 18 |
+
"num_attention_heads": 8,
|
| 19 |
+
"num_hidden_layers": 12,
|
| 20 |
+
"output_proj_dims": 1536,
|
| 21 |
+
"residual_weight": 0.5,
|
| 22 |
+
"rms_norm_eps": 1e-06,
|
| 23 |
+
"subsampling_conv_channels": [
|
| 24 |
+
128,
|
| 25 |
+
32
|
| 26 |
+
],
|
| 27 |
+
"use_clipped_linears": true
|
| 28 |
+
},
|
| 29 |
+
"audio_token_id": 258881,
|
| 30 |
+
"boa_token_id": 256000,
|
| 31 |
+
"boi_token_id": 255999,
|
| 32 |
+
"dtype": "float32",
|
| 33 |
+
"eoa_token_index": 258883,
|
| 34 |
+
"eoi_token_id": 258882,
|
| 35 |
+
"image_token_id": 258880,
|
| 36 |
+
"initializer_range": 0.02,
|
| 37 |
+
"model_type": "embedding_gemma2",
|
| 38 |
+
"text_config": {
|
| 39 |
+
"attention_bias": false,
|
| 40 |
+
"attention_dropout": 0.0,
|
| 41 |
+
"bos_token_id": 2,
|
| 42 |
+
"dtype": "float32",
|
| 43 |
+
"embedding_dim": 768,
|
| 44 |
+
"eos_token_id": 1,
|
| 45 |
+
"head_dim": 256,
|
| 46 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 47 |
+
"hidden_size": 512,
|
| 48 |
+
"hidden_size_per_layer_input": 512,
|
| 49 |
+
"initializer_range": 0.02,
|
| 50 |
+
"intermediate_size": 2048,
|
| 51 |
+
"layer_types": [
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"sliding_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"full_attention",
|
| 58 |
+
"sliding_attention",
|
| 59 |
+
"sliding_attention",
|
| 60 |
+
"sliding_attention",
|
| 61 |
+
"sliding_attention",
|
| 62 |
+
"sliding_attention",
|
| 63 |
+
"full_attention",
|
| 64 |
+
"sliding_attention",
|
| 65 |
+
"sliding_attention",
|
| 66 |
+
"sliding_attention",
|
| 67 |
+
"sliding_attention",
|
| 68 |
+
"sliding_attention",
|
| 69 |
+
"full_attention",
|
| 70 |
+
"sliding_attention",
|
| 71 |
+
"sliding_attention",
|
| 72 |
+
"sliding_attention",
|
| 73 |
+
"sliding_attention",
|
| 74 |
+
"sliding_attention",
|
| 75 |
+
"full_attention"
|
| 76 |
+
],
|
| 77 |
+
"max_position_embeddings": 262144,
|
| 78 |
+
"model_type": "embedding_gemma2_text",
|
| 79 |
+
"num_attention_heads": 4,
|
| 80 |
+
"num_hidden_layers": 24,
|
| 81 |
+
"num_key_value_heads": 2,
|
| 82 |
+
"pad_token_id": 0,
|
| 83 |
+
"per_layer_config": {
|
| 84 |
+
"05": {
|
| 85 |
+
"head_dim": 512,
|
| 86 |
+
"num_key_value_heads": 1
|
| 87 |
+
},
|
| 88 |
+
"11": {
|
| 89 |
+
"head_dim": 512,
|
| 90 |
+
"num_key_value_heads": 1
|
| 91 |
+
},
|
| 92 |
+
"17": {
|
| 93 |
+
"head_dim": 512,
|
| 94 |
+
"num_key_value_heads": 1
|
| 95 |
+
},
|
| 96 |
+
"23": {
|
| 97 |
+
"head_dim": 512,
|
| 98 |
+
"num_key_value_heads": 1
|
| 99 |
+
}
|
| 100 |
+
},
|
| 101 |
+
"rms_norm_eps": 1e-06,
|
| 102 |
+
"rope_parameters": {
|
| 103 |
+
"full_attention": {
|
| 104 |
+
"rope_theta": 1000000.0,
|
| 105 |
+
"rope_type": "default"
|
| 106 |
+
},
|
| 107 |
+
"sliding_attention": {
|
| 108 |
+
"rope_theta": 10000.0,
|
| 109 |
+
"rope_type": "default"
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"sliding_window": 512,
|
| 113 |
+
"vocab_size": 262144
|
| 114 |
+
},
|
| 115 |
+
"transformers_version": "5.20.2",
|
| 116 |
+
"video_token_id": 258884,
|
| 117 |
+
"vision_soft_tokens_per_image": 280,
|
| 118 |
+
"transformers.js_config": {
|
| 119 |
+
"use_external_data_format": {
|
| 120 |
+
"audio_encoder.onnx": 1,
|
| 121 |
+
"model.onnx": 1,
|
| 122 |
+
"audio_encoder_fp16.onnx": 1,
|
| 123 |
+
"model_fp16.onnx": 1,
|
| 124 |
+
"audio_encoder_quantized.onnx": 1,
|
| 125 |
+
"model_quantized.onnx": 1,
|
| 126 |
+
"audio_encoder_q4.onnx": 1,
|
| 127 |
+
"model_q4.onnx": 1
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"pytorch": "2.11.0+cu128",
|
| 4 |
+
"sentence_transformers": "6.1.0",
|
| 5 |
+
"transformers": "5.20.2"
|
| 6 |
+
},
|
| 7 |
+
"default_prompt_name": null,
|
| 8 |
+
"model_type": "SentenceTransformer",
|
| 9 |
+
"prompts": {
|
| 10 |
+
"BitextMining": "task: search result | query: ",
|
| 11 |
+
"Classification": "task: classification | query: ",
|
| 12 |
+
"Clustering": "task: clustering | query: ",
|
| 13 |
+
"CodeRetrieval": "task: code retrieval | query: ",
|
| 14 |
+
"Document": "title: none | text: ",
|
| 15 |
+
"FactChecking": "task: fact checking | query: ",
|
| 16 |
+
"InstructionRetrieval": "task: code retrieval | query: ",
|
| 17 |
+
"MultilabelClassification": "task: classification | query: ",
|
| 18 |
+
"PairClassification": "task: sentence similarity | query: ",
|
| 19 |
+
"QuestionAnswering": "task: question answering | query: ",
|
| 20 |
+
"Reranking": "task: search result | query: ",
|
| 21 |
+
"Retrieval": "task: search result | query: ",
|
| 22 |
+
"Retrieval-document": "title: none | text: ",
|
| 23 |
+
"Retrieval-query": "task: search result | query: ",
|
| 24 |
+
"STS": "task: sentence similarity | query: ",
|
| 25 |
+
"SearchQuery": "task: search result | query: ",
|
| 26 |
+
"SentenceSimilarity": "task: sentence similarity | query: ",
|
| 27 |
+
"Summarization": "task: sentence similarity | query: ",
|
| 28 |
+
"document": "title: none | text: ",
|
| 29 |
+
"query": "task: search result | query: "
|
| 30 |
+
},
|
| 31 |
+
"similarity_fn_name": "cosine"
|
| 32 |
+
}
|
onnx/audio_encoder.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1c2cd75556bd606e591c370c8b5edd3c708b0f6d6fc3a11c8a7c415df0181989
|
| 3 |
+
size 204551
|
onnx/audio_encoder.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f7871094ac28b10567a2e6f8cf5e826a0196d46ad9ef034b395c4f6ed87699c6
|
| 3 |
+
size 1172750848
|
onnx/audio_encoder_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:644e2709393d15620eb6f62c032632479d48ab7431163d0335fba10b172178c6
|
| 3 |
+
size 201983
|
onnx/audio_encoder_fp16.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abcf6d2943303c29bdb2ecce22e731246100c5dabb5035ed7389f51c84785ea2
|
| 3 |
+
size 586375424
|
onnx/audio_encoder_q4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abf0d00ab23205026fdd4010e36b39b7c9ee17a480d601cd95a81379d35fd047
|
| 3 |
+
size 246624
|
onnx/audio_encoder_q4.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c240c8f930c12b07a514dc18709692969216e5a6805040669ba35bf6a165c41
|
| 3 |
+
size 189075968
|
onnx/audio_encoder_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a3d4b59dc4ca20fdaaed962f572bf22b00e2a23f9376a661553abde9b7066b44
|
| 3 |
+
size 250411
|
onnx/audio_encoder_quantized.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1066a923825875ce7457bd0a7253cac86ccd01d2419070e4d1729ac64e87263f
|
| 3 |
+
size 340058624
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc47de15f81208a5c99e5ab10f746d5e33b51ea228b7dc0bef9c133a94f1c1c3
|
| 3 |
+
size 421421
|
onnx/model.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a5c3dd3fc284af962104f19dff276fce49ace5b5a052c791c69b09068fda419
|
| 3 |
+
size 1084170240
|
onnx/model_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:578e3e3b68dd394cfab8268b914b6c3ccd2b9748e214c1ebe048e73716a51c7f
|
| 3 |
+
size 425780
|
onnx/model_fp16.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b6db39f86c7a0d811a524222cbfd7f5144f0d26588269927528f6be845d7438a
|
| 3 |
+
size 542085120
|
onnx/model_q4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc27af510b44b555f1909bd108ddfabac9a5877ca679b83bead8c9eb46787733
|
| 3 |
+
size 492114
|
onnx/model_q4.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b63420bfe7c8f82ba412572b5ee4a50b5060c7033df5fe08987320d374d7d7aa
|
| 3 |
+
size 174028800
|
onnx/model_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61cc82205da352f94ae362e092254b1d5c00e44f422e2a94ece5121d06a5f211
|
| 3 |
+
size 496200
|
onnx/model_quantized.onnx_data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:139048d4e312feeda8824cde9b9ba2469d25f633b659adbd2c8f1587a5cc75b4
|
| 3 |
+
size 313724928
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"dither": 0.0,
|
| 3 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 4 |
+
"feature_size": 128,
|
| 5 |
+
"fft_length": 512,
|
| 6 |
+
"fft_overdrive": false,
|
| 7 |
+
"frame_length": 320,
|
| 8 |
+
"hop_length": 160,
|
| 9 |
+
"input_scale_factor": 1.0,
|
| 10 |
+
"max_frequency": 8000.0,
|
| 11 |
+
"mel_floor": 0.001,
|
| 12 |
+
"min_frequency": 0.0,
|
| 13 |
+
"padding_side": "right",
|
| 14 |
+
"padding_value": 0.0,
|
| 15 |
+
"per_bin_mean": null,
|
| 16 |
+
"per_bin_stddev": null,
|
| 17 |
+
"preemphasis": 0.0,
|
| 18 |
+
"preemphasis_htk_flavor": true,
|
| 19 |
+
"return_attention_mask": true,
|
| 20 |
+
"sampling_rate": 16000,
|
| 21 |
+
"processor_class": "EmbeddingGemma2Processor"
|
| 22 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_ms_per_token": 40,
|
| 3 |
+
"audio_seq_length": 280,
|
| 4 |
+
"feature_extractor": {
|
| 5 |
+
"dither": 0.0,
|
| 6 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 7 |
+
"feature_size": 128,
|
| 8 |
+
"fft_length": 512,
|
| 9 |
+
"fft_overdrive": false,
|
| 10 |
+
"frame_length": 320,
|
| 11 |
+
"hop_length": 160,
|
| 12 |
+
"input_scale_factor": 1.0,
|
| 13 |
+
"max_frequency": 8000.0,
|
| 14 |
+
"mel_floor": 0.001,
|
| 15 |
+
"min_frequency": 0.0,
|
| 16 |
+
"padding_side": "right",
|
| 17 |
+
"padding_value": 0.0,
|
| 18 |
+
"per_bin_mean": null,
|
| 19 |
+
"per_bin_stddev": null,
|
| 20 |
+
"preemphasis": 0.0,
|
| 21 |
+
"preemphasis_htk_flavor": true,
|
| 22 |
+
"return_attention_mask": true,
|
| 23 |
+
"sampling_rate": 16000
|
| 24 |
+
},
|
| 25 |
+
"image_processor": {
|
| 26 |
+
"do_convert_rgb": true,
|
| 27 |
+
"do_normalize": false,
|
| 28 |
+
"do_rescale": true,
|
| 29 |
+
"do_resize": true,
|
| 30 |
+
"image_mean": [
|
| 31 |
+
0.0,
|
| 32 |
+
0.0,
|
| 33 |
+
0.0
|
| 34 |
+
],
|
| 35 |
+
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
+
"image_seq_length": 280,
|
| 37 |
+
"image_std": [
|
| 38 |
+
1.0,
|
| 39 |
+
1.0,
|
| 40 |
+
1.0
|
| 41 |
+
],
|
| 42 |
+
"max_soft_tokens": 280,
|
| 43 |
+
"patch_size": 16,
|
| 44 |
+
"pooling_kernel_size": 3,
|
| 45 |
+
"resample": 3,
|
| 46 |
+
"rescale_factor": 0.00392156862745098
|
| 47 |
+
},
|
| 48 |
+
"image_seq_length": 280,
|
| 49 |
+
"processor_class": "EmbeddingGemma2Processor",
|
| 50 |
+
"video_processor": {
|
| 51 |
+
"add_timestamps": false,
|
| 52 |
+
"do_convert_rgb": true,
|
| 53 |
+
"do_normalize": false,
|
| 54 |
+
"do_rescale": true,
|
| 55 |
+
"do_resize": true,
|
| 56 |
+
"do_sample_frames": true,
|
| 57 |
+
"fps": 1,
|
| 58 |
+
"image_mean": [
|
| 59 |
+
0.0,
|
| 60 |
+
0.0,
|
| 61 |
+
0.0
|
| 62 |
+
],
|
| 63 |
+
"image_std": [
|
| 64 |
+
1.0,
|
| 65 |
+
1.0,
|
| 66 |
+
1.0
|
| 67 |
+
],
|
| 68 |
+
"max_frames": 32,
|
| 69 |
+
"max_soft_tokens": 140,
|
| 70 |
+
"overflow_strategy": "uniform",
|
| 71 |
+
"patch_size": 16,
|
| 72 |
+
"pooling_kernel_size": 3,
|
| 73 |
+
"resample": 3,
|
| 74 |
+
"rescale_factor": 0.00392156862745098,
|
| 75 |
+
"return_metadata": false,
|
| 76 |
+
"video_processor_type": "EmbeddingGemma2VideoProcessor"
|
| 77 |
+
}
|
| 78 |
+
}
|
scripts/pyproject.toml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "sonicembed-onnx"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Scores the SonicEmbed ONNX files"
|
| 5 |
+
requires-python = ">=3.11,<3.13"
|
| 6 |
+
dependencies = [
|
| 7 |
+
"onnxruntime==1.31.1",
|
| 8 |
+
"huggingface-hub>=1.0",
|
| 9 |
+
"numpy>=2",
|
| 10 |
+
"sentence-transformers>=6.1",
|
| 11 |
+
"librosa>=0.11",
|
| 12 |
+
"pyarrow>=20",
|
| 13 |
+
"pandas>=3.1.1",
|
| 14 |
+
"tqdm",
|
| 15 |
+
"pillow>=11",
|
| 16 |
+
"torchvision>=0.23",
|
| 17 |
+
]
|
scripts/song_describer.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Text-to-music search on Song Describer with the ONNX builds: each of the 1,106 captions looks for its track among all 706.
|
| 2 |
+
|
| 3 |
+
Tracks are embedded two ways: one 10 s clip from the middle, and the average of three 10 s clips.
|
| 4 |
+
AUDIO:TEXT mixes two builds: q8:q4 uses q8 for the audio encoder and q4 for the text model.
|
| 5 |
+
|
| 6 |
+
uv run song_describer.py fp32 fp16 q8 q8:q4 q4
|
| 7 |
+
"""
|
| 8 |
+
import argparse
|
| 9 |
+
import io
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
import librosa
|
| 13 |
+
import numpy as np
|
| 14 |
+
import onnxruntime as ort
|
| 15 |
+
import pyarrow.parquet as pq
|
| 16 |
+
from huggingface_hub import snapshot_download
|
| 17 |
+
from sentence_transformers import SentenceTransformer
|
| 18 |
+
from tqdm import tqdm
|
| 19 |
+
|
| 20 |
+
MODEL = "jaisawhney/SonicEmbed"
|
| 21 |
+
MODEL_REVISION = "16c73997cfc80d00a71f06b1fa821465aa2c7e2d"
|
| 22 |
+
DATASET = "dukesun99/SongDescriber-T2A" # the official 2-minute excerpts, byte for byte
|
| 23 |
+
REVISION = "c58ad9b08343e56ce412d4da41accd15bffdbd6d"
|
| 24 |
+
SR = 16000
|
| 25 |
+
FILE_SUFFIXES = {"fp32": "", "fp16": "_fp16", "q8": "_quantized", "q4": "_q4"}
|
| 26 |
+
NO_FEATURES = np.zeros((0, 512), "float32")
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def clips(wave, sr=SR):
|
| 30 |
+
size = 10 * sr
|
| 31 |
+
starts = [min(max(int(position * len(wave)) - size // 2, 0), len(wave) - size) for position in (0.25, 0.5, 0.75)]
|
| 32 |
+
return [wave[start:start + size] for start in starts]
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def load_captions(data):
|
| 36 |
+
print("Downloading Song Describer (3.3 GB, first run only)")
|
| 37 |
+
snapshot_download(DATASET, repo_type="dataset", revision=REVISION, local_dir=data)
|
| 38 |
+
queries = pq.read_table(data / "queries").to_pandas()
|
| 39 |
+
qrels = pq.read_table(data / "qrels").to_pandas()
|
| 40 |
+
return queries.merge(qrels, left_on="id", right_on="query-id")
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def load_tracks(data, sr=SR):
|
| 44 |
+
shards = sorted((data / "corpus").glob("*.parquet"))
|
| 45 |
+
with tqdm(total=sum(pq.ParquetFile(shard).metadata.num_rows for shard in shards), desc="tracks") as bar:
|
| 46 |
+
for shard in shards:
|
| 47 |
+
for row in pq.read_table(shard).to_pylist():
|
| 48 |
+
wave, _ = librosa.load(io.BytesIO(row["audio"]["bytes"]), sr=sr, mono=True)
|
| 49 |
+
yield row["id"], wave
|
| 50 |
+
bar.update()
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def recall_table(text, audio, caption_tracks, tracks):
|
| 54 |
+
sims = text @ audio.T
|
| 55 |
+
correct = sims[np.arange(len(text)), np.searchsorted(tracks, caption_tracks)]
|
| 56 |
+
ranks = (sims > correct[:, None]).sum(1) + 1
|
| 57 |
+
return {"R@1": 100 * (ranks <= 1).mean(), "R@5": 100 * (ranks <= 5).mean(),
|
| 58 |
+
"R@10": 100 * (ranks <= 10).mean(), "MedR": np.median(ranks), "MRR": (1 / ranks).mean()}
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def print_results(name, text, views, caption_tracks, tracks):
|
| 62 |
+
print(f"\n{name}: {len(text)} captions, {len(tracks)} tracks\n")
|
| 63 |
+
print("| Audio | R@1 | R@5 | R@10 | MedR | MRR |\n|---|---|---|---|---|---|")
|
| 64 |
+
for view, audio in views.items():
|
| 65 |
+
scores = recall_table(text, audio, caption_tracks, tracks)
|
| 66 |
+
print(f"| {view} | {scores['R@1']:.1f} | {scores['R@5']:.1f} | {scores['R@10']:.1f} | {scores['MedR']:g} | {scores['MRR']:.4f} |")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def open_session(path):
|
| 70 |
+
options = ort.SessionOptions()
|
| 71 |
+
options.log_severity_level = 3
|
| 72 |
+
return ort.InferenceSession(str(path), options, providers=["CPUExecutionProvider"])
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def embed_text(text_model, inputs, audio_features=NO_FEATURES):
|
| 76 |
+
output = text_model.run(["sentence_embedding"], {
|
| 77 |
+
"input_ids": inputs["input_ids"].numpy(), "attention_mask": inputs["attention_mask"].numpy(),
|
| 78 |
+
"image_features": NO_FEATURES, "video_features": NO_FEATURES, "audio_features": audio_features})[0][0]
|
| 79 |
+
return output / np.linalg.norm(output)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def embed_clip(audio_encoder, text_model, inputs):
|
| 83 |
+
features = audio_encoder.run(None, {
|
| 84 |
+
"input_features": inputs["input_features"].numpy().astype("float32"),
|
| 85 |
+
"input_features_mask": inputs["input_features_mask"].numpy().astype(bool)})[0]
|
| 86 |
+
return embed_text(text_model, inputs, features)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def main():
|
| 90 |
+
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 91 |
+
parser.add_argument("builds", nargs="+", help="fp32, fp16, q8, q4 or AUDIO:TEXT")
|
| 92 |
+
parser.add_argument("--onnx", type=Path, default=Path("../onnx"))
|
| 93 |
+
parser.add_argument("--data", type=Path, default=Path("data/song_describer"))
|
| 94 |
+
args = parser.parse_args()
|
| 95 |
+
|
| 96 |
+
captions = load_captions(args.data)
|
| 97 |
+
model = SentenceTransformer(MODEL, revision=MODEL_REVISION, device="cpu", config_kwargs={"vision_config": None})
|
| 98 |
+
|
| 99 |
+
tracks, clip_inputs = [], []
|
| 100 |
+
for track, wave in load_tracks(args.data):
|
| 101 |
+
tracks.append(track)
|
| 102 |
+
clip_inputs += [model.preprocess([{"array": clip, "sampling_rate": SR}]) for clip in clips(wave)]
|
| 103 |
+
caption_inputs = [model.preprocess([caption], prompt=model.prompts["query"]) for caption in captions.text]
|
| 104 |
+
|
| 105 |
+
order = np.argsort(tracks)
|
| 106 |
+
tracks = np.array(tracks)[order]
|
| 107 |
+
caption_tracks = captions["corpus-id"].to_numpy()
|
| 108 |
+
|
| 109 |
+
for build in args.builds:
|
| 110 |
+
audio_build, text_build = build, build
|
| 111 |
+
if ":" in build:
|
| 112 |
+
audio_build, text_build = build.split(":")
|
| 113 |
+
audio_encoder = open_session(args.onnx / f"audio_encoder{FILE_SUFFIXES[audio_build]}.onnx")
|
| 114 |
+
text_model = open_session(args.onnx / f"model{FILE_SUFFIXES[text_build]}.onnx")
|
| 115 |
+
|
| 116 |
+
emb = np.stack([embed_clip(audio_encoder, text_model, inputs) for inputs in tqdm(clip_inputs, desc=f"{build} audio")])
|
| 117 |
+
text = np.stack([embed_text(text_model, inputs) for inputs in tqdm(caption_inputs, desc=f"{build} text")])
|
| 118 |
+
|
| 119 |
+
emb = emb.reshape(len(tracks), 3, -1)
|
| 120 |
+
middle, average = emb[:, 1][order], emb.mean(1)[order]
|
| 121 |
+
average = average / np.linalg.norm(average, axis=-1, keepdims=True)
|
| 122 |
+
|
| 123 |
+
print_results(build, text, {"one 10 s clip": middle, "three 10 s clips": average}, caption_tracks, tracks)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
scripts/uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d777ef5bdc1aa36227abdfb77c3e49e7b9c892d16e1b6bda41c393504828be4
|
| 3 |
+
size 32170510
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_token": "<|audio|>",
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"boa_token": "<|audio>",
|
| 5 |
+
"boi_token": "<|image>",
|
| 6 |
+
"bos_token": "<bos>",
|
| 7 |
+
"eoa_token": "<audio|>",
|
| 8 |
+
"eoc_token": "<channel|>",
|
| 9 |
+
"eoi_token": "<image|>",
|
| 10 |
+
"eos_token": "<eos>",
|
| 11 |
+
"eot_token": "<turn|>",
|
| 12 |
+
"escape_token": "<|\"|>",
|
| 13 |
+
"etc_token": "<tool_call|>",
|
| 14 |
+
"etd_token": "<tool|>",
|
| 15 |
+
"etr_token": "<tool_response|>",
|
| 16 |
+
"extra_special_tokens": [
|
| 17 |
+
"<|video|>"
|
| 18 |
+
],
|
| 19 |
+
"image_token": "<|image|>",
|
| 20 |
+
"is_local": true,
|
| 21 |
+
"local_files_only": false,
|
| 22 |
+
"mask_token": "<mask>",
|
| 23 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 24 |
+
"model_specific_special_tokens": {
|
| 25 |
+
"audio_token": "<|audio|>",
|
| 26 |
+
"boa_token": "<|audio>",
|
| 27 |
+
"boi_token": "<|image>",
|
| 28 |
+
"eoa_token": "<audio|>",
|
| 29 |
+
"eoc_token": "<channel|>",
|
| 30 |
+
"eoi_token": "<image|>",
|
| 31 |
+
"eot_token": "<turn|>",
|
| 32 |
+
"escape_token": "<|\"|>",
|
| 33 |
+
"etc_token": "<tool_call|>",
|
| 34 |
+
"etd_token": "<tool|>",
|
| 35 |
+
"etr_token": "<tool_response|>",
|
| 36 |
+
"image_token": "<|image|>",
|
| 37 |
+
"soc_token": "<|channel>",
|
| 38 |
+
"sot_token": "<|turn>",
|
| 39 |
+
"stc_token": "<|tool_call>",
|
| 40 |
+
"std_token": "<|tool>",
|
| 41 |
+
"str_token": "<|tool_response>",
|
| 42 |
+
"think_token": "<|think|>",
|
| 43 |
+
"video_token": "<|video|>"
|
| 44 |
+
},
|
| 45 |
+
"pad_token": "<pad>",
|
| 46 |
+
"padding_side": "right",
|
| 47 |
+
"processor_class": "EmbeddingGemma2Processor",
|
| 48 |
+
"soc_token": "<|channel>",
|
| 49 |
+
"sot_token": "<|turn>",
|
| 50 |
+
"stc_token": "<|tool_call>",
|
| 51 |
+
"std_token": "<|tool>",
|
| 52 |
+
"str_token": "<|tool_response>",
|
| 53 |
+
"think_token": "<|think|>",
|
| 54 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 55 |
+
"unk_token": "<unk>",
|
| 56 |
+
"video_token": "<|video|>"
|
| 57 |
+
}
|