Core ML
clap
audio
embeddings
philippherzig commited on
Commit
9e47b0e
·
verified ·
1 Parent(s): b41bf08

Upload folder using huggingface_hub

Browse files
GridshiftCLAP.mlpackage.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5512b6fa4aab44b2a08dcb505ae31521b20f849025b2c8a941e81fc4e543f21e
3
+ size 66006191
GridshiftCLAPText.mlpackage.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f2d1bababce0e0fc74f6934ea46b5e5dcfd99167213600276f60285ec87257d
3
+ size 112265825
README.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: laion/larger_clap_general
4
+ tags: [coreml, clap, audio, embeddings]
5
+ ---
6
+
7
+ # CLAP (larger_clap_general) for Core ML — Gridshift
8
+
9
+ Core ML conversion of [`laion/larger_clap_general`](https://huggingface.co/laion/larger_clap_general), used by Gridshift's smart sample search.
10
+
11
+ - `GridshiftCLAP.mlpackage.zip`: audio encoder. Input `audio`: fp32 [1, 480000], mono 48 kHz, 10 s (HF `repeatpad` for shorter files). Output `embedding`: fp32 [1, 512], L2-normalized. Log-mel front-end in the graph (matches `ClapFeatureExtractor`), front-end ops fp32, int8 weights (convolutions excepted).
12
+ - `GridshiftCLAPText.mlpackage.zip`: text encoder. Inputs `input_ids`, `attention_mask`: int32 [1, 64] (RoBERTa tokenizer in `tokenizer.tokenizer.zip`). Output `embedding`: fp32 [1, 512], same space.
13
+
14
+ Validated against the PyTorch reference (`transformers` ClapModel): audio cosine ≥ 0.9995 per sample, pairwise structure Δ ≤ 0.012; text cosine ≥ 0.999. SHA-256s are in `manifest.json` and `text_manifest.json`.
15
+
16
+ Upstream: LAION-CLAP, Apache-2.0. Wu et al., 2022, *Large-scale Contrastive Language-Audio Pretraining with Feature Fusion and Keyword-to-Caption Augmentation* (arXiv:2211.06687).
manifest.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "clap_general_coreml_v2",
3
+ "version": "2.0.0",
4
+ "format": "coreml",
5
+ "backend": "coreml",
6
+ "sample_rate_hz": 48000,
7
+ "audio_samples": 480000,
8
+ "embed_dim": 512,
9
+ "inputs": [
10
+ {
11
+ "name": "audio",
12
+ "layout": "BT",
13
+ "dtype": "f32",
14
+ "shape": [
15
+ 1,
16
+ 480000
17
+ ]
18
+ }
19
+ ],
20
+ "outputs": [
21
+ {
22
+ "name": "embedding",
23
+ "layout": "BD",
24
+ "dtype": "f32",
25
+ "shape": [
26
+ 1,
27
+ 512
28
+ ],
29
+ "normalization": "l2"
30
+ }
31
+ ],
32
+ "artifacts": [
33
+ {
34
+ "file": "GridshiftCLAP.mlpackage.zip",
35
+ "sha256": "5512b6fa4aab44b2a08dcb505ae31521b20f849025b2c8a941e81fc4e543f21e",
36
+ "size_bytes": 66006191,
37
+ "url": "https://huggingface.co/gridshiftstudio/clap-general-coreml/resolve/main/GridshiftCLAP.mlpackage.zip"
38
+ }
39
+ ],
40
+ "entry": "GridshiftCLAP.mlpackage.zip",
41
+ "upstream": {
42
+ "source": "laion/larger_clap_general",
43
+ "license": "Apache-2.0",
44
+ "paper": "https://arxiv.org/abs/2211.06687"
45
+ }
46
+ }
text_manifest.json ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "clap_general_text_coreml_v2",
3
+ "version": "2.0.0",
4
+ "format": "coreml",
5
+ "backend": "coreml",
6
+ "max_seq_len": 64,
7
+ "embed_dim": 512,
8
+ "tokenizer_meta": {
9
+ "pad_token_id": 1,
10
+ "cls_token_id": 0,
11
+ "sep_token_id": 2,
12
+ "mask_token_id": 50264,
13
+ "unk_token_id": 3,
14
+ "max_seq_len": 64,
15
+ "model_max_length": 512
16
+ },
17
+ "inputs": [
18
+ {
19
+ "name": "input_ids",
20
+ "layout": "BS",
21
+ "dtype": "i32",
22
+ "shape": [
23
+ 1,
24
+ 64
25
+ ]
26
+ },
27
+ {
28
+ "name": "attention_mask",
29
+ "layout": "BS",
30
+ "dtype": "i32",
31
+ "shape": [
32
+ 1,
33
+ 64
34
+ ]
35
+ }
36
+ ],
37
+ "outputs": [
38
+ {
39
+ "name": "embedding",
40
+ "layout": "BD",
41
+ "dtype": "f32",
42
+ "shape": [
43
+ 1,
44
+ 512
45
+ ],
46
+ "normalization": "l2",
47
+ "space": "clap_shared"
48
+ }
49
+ ],
50
+ "artifacts": [
51
+ {
52
+ "file": "GridshiftCLAPText.mlpackage.zip",
53
+ "sha256": "7f2d1bababce0e0fc74f6934ea46b5e5dcfd99167213600276f60285ec87257d",
54
+ "size_bytes": 112265825,
55
+ "url": "https://huggingface.co/gridshiftstudio/clap-general-coreml/resolve/main/GridshiftCLAPText.mlpackage.zip"
56
+ },
57
+ {
58
+ "file": "tokenizer.tokenizer.zip",
59
+ "sha256": "d0631f462b3e90d074824177c32572b9d4a43a8bf503ec9e80b873f4ae9d0e61",
60
+ "size_bytes": 1187601,
61
+ "url": "https://huggingface.co/gridshiftstudio/clap-general-coreml/resolve/main/tokenizer.tokenizer.zip"
62
+ }
63
+ ],
64
+ "entry_model": "GridshiftCLAPText.mlpackage.zip",
65
+ "entry_tokenizer": "tokenizer.tokenizer.zip",
66
+ "upstream": {
67
+ "source": "laion/larger_clap_general",
68
+ "license": "Apache-2.0",
69
+ "paper": "https://arxiv.org/abs/2211.06687"
70
+ }
71
+ }
tokenizer.tokenizer.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0631f462b3e90d074824177c32572b9d4a43a8bf503ec9e80b873f4ae9d0e61
3
+ size 1187601