smkrv commited on
Commit
318e620
·
verified ·
1 Parent(s): e19e5a9

Add ONNX models (INT8 + FP32) and config

Browse files
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: onnxruntime
4
+ base_model: prithivMLmods/Speech-Emotion-Classification
5
+ tags:
6
+ - audio-classification
7
+ - speech-emotion-recognition
8
+ - wav2vec2
9
+ - onnx
10
+ - chotko
11
+ language:
12
+ - en
13
+ pipeline_tag: audio-classification
14
+ ---
15
+
16
+ # Speech Emotion Classification — ONNX (INT8)
17
+
18
+ ONNX INT8-quantized version of [prithivMLmods/Speech-Emotion-Classification](https://huggingface.co/prithivMLmods/Speech-Emotion-Classification) for on-device inference in macOS apps via ONNX Runtime C API.
19
+
20
+ ## Model Details
21
+
22
+ - **Architecture:** Wav2Vec2ForSequenceClassification (facebook/wav2vec2-base-960h fine-tuned)
23
+ - **Format:** ONNX INT8 quantized
24
+ - **Size:** ~91 MB (INT8), ~361 MB (FP32)
25
+ - **Input:** Raw audio waveform (16kHz, mono), shape `[1, num_samples]`
26
+ - **Output:** 8-class emotion logits
27
+
28
+ ### Emotion Labels
29
+
30
+ | ID | Label | Full |
31
+ |----|-------|------|
32
+ | 0 | ANG | Anger |
33
+ | 1 | CAL | Calm |
34
+ | 2 | DIS | Disgust |
35
+ | 3 | FEA | Fear |
36
+ | 4 | HAP | Happy |
37
+ | 5 | NEU | Neutral |
38
+ | 6 | SAD | Sad |
39
+ | 7 | SUR | Surprised |
40
+
41
+ ## Usage
42
+
43
+ Used in [Chotko](https://github.com/smkrv/Chotko) macOS app for real-time speech emotion classification during transcription. Inference via ONNX Runtime C API (bundled with Sherpa-ONNX).
44
+
45
+ ```swift
46
+ // Swift — load and run via OnnxRuntimeWrapper
47
+ let wrapper = OnnxRuntimeWrapper()
48
+ try wrapper.load(modelPath: "model_int8.onnx")
49
+ let logits = try wrapper.run(inputName: "input_values", inputData: audioBuffer, inputShape: [1, Int64(audioBuffer.count)])
50
+ let emotionIdx = logits.firstIndex(of: logits.max()!)!
51
+ ```
52
+
53
+ ## Files
54
+
55
+ - `model_int8.onnx` — INT8 quantized model (recommended for on-device use)
56
+ - `model.onnx` — FP32 full precision model
57
+ - `config.json` — Model configuration with label mappings
58
+
59
+ ## Attribution
60
+
61
+ Original model by [prithivMLmods](https://huggingface.co/prithivMLmods). Converted to ONNX by [onnx-community](https://huggingface.co/onnx-community). INT8 quantization and packaging for macOS by [@smkrv](https://huggingface.co/smkrv).
fp32/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
fp32/README.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers.js
3
+ base_model:
4
+ - prithivMLmods/Speech-Emotion-Classification
5
+ ---
6
+
7
+ # Speech-Emotion-Classification (ONNX)
8
+
9
+ This is an ONNX version of [prithivMLmods/Speech-Emotion-Classification](https://huggingface.co/prithivMLmods/Speech-Emotion-Classification). It was automatically converted and uploaded using [this space](https://huggingface.co/spaces/onnx-community/convert-to-onnx).
10
+
11
+ # Speech-Emotion-Classification
12
+
13
+ > **Speech-Emotion-Classification** is a fine-tuned version of `facebook/wav2vec2-base-960h` for **multi-class audio classification**, specifically trained to detect **emotions** in speech. This model utilizes the `Wav2Vec2ForSequenceClassification` architecture to accurately classify speaker emotions from audio signals.
14
+
15
+ ## Intended Use
16
+
17
+ `Speech-Emotion-Classification` is designed for:
18
+
19
+ * **Speech Emotion Analytics** – Analyze speaker emotions in call centers, interviews, or therapeutic sessions.
20
+ * **Conversational AI Personalization** – Adjust voice assistant responses based on detected emotion.
21
+ * **Mental Health Monitoring** – Support emotion recognition in voice-based wellness or teletherapy apps.
22
+ * **Voice Dataset Curation** – Tag or filter speech datasets by emotion for research or model training.
23
+ * **Media Annotation** – Automatically annotate podcasts, audiobooks, or videos with speaker emotion metadata.
fp32/config.json ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": true,
3
+ "_name_or_path": "prithivMLmods/Speech-Emotion-Classification",
4
+ "activation_dropout": 0.0,
5
+ "adapter_attn_dim": null,
6
+ "adapter_kernel_size": 3,
7
+ "adapter_stride": 2,
8
+ "add_adapter": false,
9
+ "apply_spec_augment": true,
10
+ "architectures": [
11
+ "Wav2Vec2ForSequenceClassification"
12
+ ],
13
+ "attention_dropout": 0.1,
14
+ "bos_token_id": 1,
15
+ "classifier_proj_size": 256,
16
+ "codevector_dim": 256,
17
+ "contrastive_logits_temperature": 0.1,
18
+ "conv_bias": false,
19
+ "conv_dim": [
20
+ 512,
21
+ 512,
22
+ 512,
23
+ 512,
24
+ 512,
25
+ 512,
26
+ 512
27
+ ],
28
+ "conv_kernel": [
29
+ 10,
30
+ 3,
31
+ 3,
32
+ 3,
33
+ 3,
34
+ 2,
35
+ 2
36
+ ],
37
+ "conv_stride": [
38
+ 5,
39
+ 2,
40
+ 2,
41
+ 2,
42
+ 2,
43
+ 2,
44
+ 2
45
+ ],
46
+ "ctc_loss_reduction": "sum",
47
+ "ctc_zero_infinity": false,
48
+ "diversity_loss_weight": 0.1,
49
+ "do_stable_layer_norm": false,
50
+ "eos_token_id": 2,
51
+ "feat_extract_activation": "gelu",
52
+ "feat_extract_norm": "group",
53
+ "feat_proj_dropout": 0.1,
54
+ "feat_quantizer_dropout": 0.0,
55
+ "final_dropout": 0.0,
56
+ "freeze_feat_extract_train": true,
57
+ "hidden_act": "gelu",
58
+ "hidden_dropout": 0.1,
59
+ "hidden_size": 768,
60
+ "id2label": {
61
+ "0": "ANG",
62
+ "1": "CAL",
63
+ "2": "DIS",
64
+ "3": "FEA",
65
+ "4": "HAP",
66
+ "5": "NEU",
67
+ "6": "SAD",
68
+ "7": "SUR"
69
+ },
70
+ "initializer_range": 0.02,
71
+ "intermediate_size": 3072,
72
+ "label2id": {
73
+ "ANG": 0,
74
+ "CAL": 1,
75
+ "DIS": 2,
76
+ "FEA": 3,
77
+ "HAP": 4,
78
+ "NEU": 5,
79
+ "SAD": 6,
80
+ "SUR": 7
81
+ },
82
+ "layer_norm_eps": 1e-05,
83
+ "layerdrop": 0.0,
84
+ "mask_channel_length": 10,
85
+ "mask_channel_min_space": 1,
86
+ "mask_channel_other": 0.0,
87
+ "mask_channel_prob": 0.0,
88
+ "mask_channel_selection": "static",
89
+ "mask_feature_length": 10,
90
+ "mask_feature_min_masks": 0,
91
+ "mask_feature_prob": 0.0,
92
+ "mask_time_length": 10,
93
+ "mask_time_min_masks": 2,
94
+ "mask_time_min_space": 1,
95
+ "mask_time_other": 0.0,
96
+ "mask_time_prob": 0.05,
97
+ "mask_time_selection": "static",
98
+ "model_type": "wav2vec2",
99
+ "no_mask_channel_overlap": false,
100
+ "no_mask_time_overlap": false,
101
+ "num_adapter_layers": 3,
102
+ "num_attention_heads": 12,
103
+ "num_codevector_groups": 2,
104
+ "num_codevectors_per_group": 320,
105
+ "num_conv_pos_embedding_groups": 16,
106
+ "num_conv_pos_embeddings": 128,
107
+ "num_feat_extract_layers": 7,
108
+ "num_hidden_layers": 12,
109
+ "num_negatives": 100,
110
+ "output_hidden_size": 768,
111
+ "pad_token_id": 0,
112
+ "proj_codevector_dim": 256,
113
+ "tdnn_dilation": [
114
+ 1,
115
+ 2,
116
+ 3,
117
+ 1,
118
+ 1
119
+ ],
120
+ "tdnn_dim": [
121
+ 512,
122
+ 512,
123
+ 512,
124
+ 512,
125
+ 1500
126
+ ],
127
+ "tdnn_kernel": [
128
+ 5,
129
+ 3,
130
+ 3,
131
+ 1,
132
+ 1
133
+ ],
134
+ "torch_dtype": "float32",
135
+ "transformers_version": "4.49.0",
136
+ "use_weighted_layer_sum": false,
137
+ "vocab_size": 32,
138
+ "xvector_output_dim": 512
139
+ }
fp32/onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14b8bf484dd54512fd5c278ac27ab176c0e82a48a82d008a85dcbeaceaadfda0
3
+ size 378609481
fp32/onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e885dffd59cbd307854d3ba5e97a85da47b0272b10c699f3ecfc082503fdd4c8
3
+ size 84630595
fp32/onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f76a2072399be11130e0e89c0b715cbc2fa1273b044a6ec06e9b03bae448d33
3
+ size 189468010
fp32/onnx/model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1720a40017ecd8d71bc41988b115bd9d96cfdf796c127268b2afa1302473632f
3
+ size 95389021
fp32/onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb4b907c758b975a64a60af2c54902bfa5ddf5e3993463f388fae84cfff3d3a8
3
+ size 89975333
fp32/onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a8f8da326aafd658e7934e0c489a3c77165a66142ee19fe561733e94543bed7
3
+ size 66537637
fp32/onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3217e95e4b28d53913fbe94cd9650b520f8e7ecf2bd643b9e45fc5b8b93b8aab
3
+ size 95389059
fp32/onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3217e95e4b28d53913fbe94cd9650b520f8e7ecf2bd643b9e45fc5b8b93b8aab
3
+ size 95389059
fp32/preprocessor_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
4
+ "feature_size": 1,
5
+ "padding_side": "right",
6
+ "padding_value": 0.0,
7
+ "return_attention_mask": false,
8
+ "sampling_rate": 16000
9
+ }
fp32/quantize_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "modes": [
3
+ "fp16",
4
+ "q8",
5
+ "int8",
6
+ "uint8",
7
+ "q4",
8
+ "q4f16",
9
+ "bnb4"
10
+ ],
11
+ "per_channel": false,
12
+ "reduce_range": false,
13
+ "block_size": null,
14
+ "is_symmetric": true,
15
+ "accuracy_level": null,
16
+ "quant_type": 1,
17
+ "op_block_list": null
18
+ }