pat229988 commited on
Commit
5cd26e8
·
0 Parent(s):

Uploading tflite to HF, dynamic quant version

Browse files
.gitattributes ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ *.tflite filter=lfs diff=lfs merge=lfs -text
2
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
5
+ *.onnx filter=lfs diff=lfs merge=lfs -text
6
+ *.h5 filter=lfs diff=lfs merge=lfs -text
7
+ *.pb filter=lfs diff=lfs merge=lfs -text
8
+ *.pt filter=lfs diff=lfs merge=lfs -text
9
+ *.pth filter=lfs diff=lfs merge=lfs -text
EVALUATION.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Evaluation Summary
2
+
3
+ This folder contains a dynamic-range quantized TensorFlow Lite conversion of
4
+ `KintsugiHealth/dam`. The evaluation below compares the converted TFLite model
5
+ against official PyTorch DAM scores on DAIC-WOZ participant-only audio extracts.
6
+
7
+ ## Model Size
8
+
9
+ | Model | Size | Relative |
10
+ |---|---:|---:|
11
+ | Legacy fp32 TFLite rebuild | 695.64 MiB | 1.00x |
12
+ | Dynamic-range TFLite | 184.98 MiB | 0.266x |
13
+
14
+ The dynamic-range model is approximately **73.4% smaller** / **3.76x smaller**.
15
+
16
+ ## Accuracy Comparison
17
+
18
+ Evaluation target: official PyTorch DAM per-chunk scores aggregated with mean.
19
+
20
+ | Task | Mean diff | MAE | Median AE | Max AE | Severity agreement |
21
+ |---|---:|---:|---:|---:|---:|
22
+ | Depression | +0.01310 | 0.01580 | 0.01421 | 0.04136 | 20/20 |
23
+ | Anxiety | +0.01315 | 0.01580 | 0.01430 | 0.03887 | 20/20 |
24
+
25
+ Per-chunk errors across the same 20 files:
26
+
27
+ | Task | Per-chunk mean diff | Per-chunk MAE | Per-chunk max AE |
28
+ |---|---:|---:|---:|
29
+ | Depression | +0.01298 | 0.02206 | 0.08962 |
30
+ | Anxiety | +0.01300 | 0.02137 | 0.09266 |
31
+
32
+ ## Threshold Agreement
33
+
34
+ No depression or anxiety severity levels changed across the 20 DAIC-WOZ files
35
+ tested.
36
+
37
+ Thresholds used:
38
+
39
+ - Depression: `[-0.6699, -0.2908]`
40
+ - Anxiety: `[-0.7939, -0.2173, 0.1521]`
41
+
42
+ ## Mac Smoke Test
43
+
44
+ On macOS, participant `346` produced:
45
+
46
+ | Metric | Depression | Anxiety |
47
+ |---|---:|---:|
48
+ | Official chunk mean | -0.1387869 | 0.0714643 |
49
+ | Dynamic TFLite chunk mean | -0.1305877 | 0.0790043 |
50
+ | MAE per chunk | 0.0153862 | 0.0136833 |
51
+ | Max AE per chunk | 0.0504357 | 0.0470306 |
52
+ | Correlation | 0.999382 | 0.999388 |
53
+
54
+ ## Limitations
55
+
56
+ - DAIC-WOZ raw audio is not redistributed here.
57
+ - The evaluation uses participant-only audio derived from DAIC-WOZ transcripts.
58
+ - This is not a clinical validation of the quantized model; it is a conversion
59
+ fidelity check against official DAM outputs.
60
+ - The model is not intended for diagnosis or self-diagnosis without clinical
61
+ oversight.
LICENSE ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
NOTICE ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This repository contains a dynamic-range quantized TensorFlow Lite conversion
2
+ of the Kintsugi Health Depression-Anxiety Model (DAM).
3
+
4
+ Original model:
5
+ - Hugging Face: https://huggingface.co/KintsugiHealth/dam
6
+ - Source model ID: KintsugiHealth/dam
7
+ - Base model: openai/whisper-small.en
8
+ - Original model card license metadata: apache-2.0
9
+
10
+ This derivative repository publishes only converted TensorFlow Lite weights and
11
+ conversion/evaluation documentation. It does not include the original PyTorch
12
+ checkpoint or any DAIC-WOZ audio.
13
+
14
+ Clinical/safety note: DAM is intended for research, screening, clinical decision
15
+ support, and monitoring workflows. It is not intended for diagnosis or
16
+ self-diagnosis without clinical oversight.
ORIGINAL_MODEL_CARD_REFERENCE.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Original Model Card Reference
2
+
3
+ The original DAM model card is available at:
4
+
5
+ https://huggingface.co/KintsugiHealth/dam
6
+
7
+ The local source checkout used during conversion contained the original model
8
+ card in `dam/README.md` with the following metadata:
9
+
10
+ ```yaml
11
+ license: apache-2.0
12
+ language:
13
+ - en
14
+ base_model:
15
+ - openai/whisper-small.en
16
+ pipeline_tag: audio-classification
17
+ ```
18
+
19
+ This quantized-weight repository is a derivative conversion and does not replace
20
+ the original model card. Users should read the original model card for clinical
21
+ context, intended use, limitations, data description, tuning guidance, and
22
+ references.
23
+
24
+ Original model summary from `KintsugiHealth/dam`:
25
+
26
+ - DAM is a speech-based model designed to screen for signs of depression and
27
+ anxiety using voice biomarkers.
28
+ - It operates on acoustic properties of speech rather than transcribed content.
29
+ - It outputs raw depression and anxiety scores that can be thresholded into
30
+ severity levels.
31
+ - It is not intended for diagnosis or self-diagnosis without clinical oversight.
PUBLISH_TO_HUGGINGFACE.md ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Step-by-Step Publishing Guide
2
+
3
+ This guide publishes the contents of `tflite-dynamic-range-quant/` as a Hugging
4
+ Face model repository containing only the converted dynamic-range TFLite weights
5
+ and evaluation documentation.
6
+
7
+ ## 1. Review the Folder
8
+
9
+ Expected files:
10
+
11
+ ```text
12
+ tflite-dynamic-range-quant/
13
+ ├── .gitattributes
14
+ ├── LICENSE
15
+ ├── NOTICE
16
+ ├── README.md
17
+ ├── EVALUATION.md
18
+ ├── evaluation_results.json
19
+ ├── dam_features_scores_dynamic_range.metadata.json
20
+ └── dam_features_scores_dynamic_range.tflite
21
+ ```
22
+
23
+ Confirm the model file checksum if desired:
24
+
25
+ ```bash
26
+ python - <<'PY'
27
+ from pathlib import Path
28
+ import hashlib
29
+ p = Path('tflite-dynamic-range-quant/dam_features_scores_dynamic_range.tflite')
30
+ print(p.stat().st_size / 1024 / 1024, 'MiB')
31
+ print(hashlib.sha256(p.read_bytes()).hexdigest())
32
+ PY
33
+ ```
34
+
35
+ Expected SHA256:
36
+
37
+ ```text
38
+ c9540444d577612a036ce8c4f24ce08d734b1b4ef90846b89600a73401dedab8
39
+ ```
40
+
41
+ ## 2. Install Hugging Face Tools
42
+
43
+ ```bash
44
+ python -m pip install -U huggingface_hub hf_transfer
45
+ ```
46
+
47
+ Optional, for faster uploads:
48
+
49
+ ```bash
50
+ export HF_HUB_ENABLE_HF_TRANSFER=1
51
+ ```
52
+
53
+ ## 3. Log In
54
+
55
+ ```bash
56
+ huggingface-cli login
57
+ ```
58
+
59
+ Paste a write token from:
60
+
61
+ ```text
62
+ https://huggingface.co/settings/tokens
63
+ ```
64
+
65
+ ## 4. Choose a Repository ID
66
+
67
+ Examples:
68
+
69
+ ```text
70
+ YOUR_USERNAME/dam-tflite-dynamic-range
71
+ YOUR_ORG/dam-tflite-dynamic-range
72
+ ```
73
+
74
+ Set it in your shell:
75
+
76
+ ```bash
77
+ export HF_REPO_ID="YOUR_USERNAME/dam-tflite-dynamic-range"
78
+ ```
79
+
80
+ ## 5. Create the Hugging Face Repo
81
+
82
+ ```bash
83
+ huggingface-cli repo create "$HF_REPO_ID" --type model
84
+ ```
85
+
86
+ If you want it private first:
87
+
88
+ ```bash
89
+ huggingface-cli repo create "$HF_REPO_ID" --type model --private
90
+ ```
91
+
92
+ ## 6. Upload the Folder
93
+
94
+ From the project root:
95
+
96
+ ```bash
97
+ huggingface-cli upload "$HF_REPO_ID" tflite-dynamic-range-quant/ . --repo-type model
98
+ ```
99
+
100
+ Alternative Python upload:
101
+
102
+ ```bash
103
+ python - <<'PY'
104
+ import os
105
+ from huggingface_hub import HfApi
106
+
107
+ repo_id = os.environ['HF_REPO_ID']
108
+ api = HfApi()
109
+ api.upload_folder(
110
+ repo_id=repo_id,
111
+ repo_type='model',
112
+ folder_path='tflite-dynamic-range-quant',
113
+ path_in_repo='.',
114
+ )
115
+ print(f'Uploaded to https://huggingface.co/{repo_id}')
116
+ PY
117
+ ```
118
+
119
+ ## 7. Edit Runtime Download Snippet
120
+
121
+ After publishing, update `README.md` in the Hugging Face UI or locally by
122
+ replacing:
123
+
124
+ ```text
125
+ YOUR_USERNAME_OR_ORG/YOUR_REPO_NAME
126
+ ```
127
+
128
+ with your actual repo ID.
129
+
130
+ Then upload the README again if edited locally:
131
+
132
+ ```bash
133
+ huggingface-cli upload "$HF_REPO_ID" tflite-dynamic-range-quant/README.md README.md --repo-type model
134
+ ```
135
+
136
+ ## 8. Test Download
137
+
138
+ ```bash
139
+ python - <<'PY'
140
+ import os
141
+ from huggingface_hub import hf_hub_download
142
+
143
+ repo_id = os.environ['HF_REPO_ID']
144
+ path = hf_hub_download(repo_id=repo_id, filename='dam_features_scores_dynamic_range.tflite')
145
+ print(path)
146
+ PY
147
+ ```
148
+
149
+ ## 9. Runtime Download Example
150
+
151
+ Use this in your app/backend tooling:
152
+
153
+ ```python
154
+ from huggingface_hub import hf_hub_download
155
+
156
+ model_path = hf_hub_download(
157
+ repo_id="YOUR_USERNAME/dam-tflite-dynamic-range",
158
+ filename="dam_features_scores_dynamic_range.tflite",
159
+ )
160
+ ```
161
+
162
+ For mobile apps, usually download once, verify checksum, and cache the file in
163
+ app-private storage.
164
+
165
+ ## 10. Suggested Release Notes
166
+
167
+ ```text
168
+ Initial release: dynamic-range quantized TFLite conversion of KintsugiHealth/dam.
169
+
170
+ - Publishes converted TFLite weights only.
171
+ - Input/output remain float32: [1, 80, 3000] -> [2].
172
+ - Size reduced from 695.64 MiB to 184.98 MiB (~73.4% smaller).
173
+ - DAIC-WOZ participant-only conversion-fidelity check: 20/20 depression and
174
+ 20/20 anxiety severity-level agreement vs official PyTorch chunk-mean scores.
175
+ ```
176
+
177
+ ## 11. Important Compliance Notes
178
+
179
+ - Keep attribution to `KintsugiHealth/dam` in the README and NOTICE.
180
+ - Do not upload DAIC-WOZ raw audio or derived private data.
181
+ - Keep clinical limitation language visible in the model card.
182
+ - If publishing under an organization, verify that your intended use and
183
+ redistribution comply with the original Apache-2.0 license and any applicable
184
+ institutional/data-use requirements.
README.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - KintsugiHealth/dam
7
+ - openai/whisper-small.en
8
+ pipeline_tag: audio-classification
9
+ tags:
10
+ - tflite
11
+ - dynamic-range-quantization
12
+ - audio-classification
13
+ - mental-health
14
+ - depression
15
+ - anxiety
16
+ - whisper
17
+ library_name: tensorflow-lite
18
+ ---
19
+
20
+ # DAM TFLite Dynamic-Range Quantized Weights
21
+
22
+ This repository publishes a **dynamic-range quantized TensorFlow Lite** version
23
+ of the Kintsugi Health Depression-Anxiety Model (DAM):
24
+ [`KintsugiHealth/dam`](https://huggingface.co/KintsugiHealth/dam).
25
+
26
+ Only the converted TFLite weights and conversion/evaluation metadata are
27
+ published here. The original PyTorch checkpoint, original training data, and
28
+ DAIC-WOZ audio are not included.
29
+
30
+ ## Relationship to the Original Model
31
+
32
+ This is a derivative conversion of `KintsugiHealth/dam` for smaller on-device
33
+ runtime deployment. For the original model card, intended use, limitations,
34
+ clinical context, and references, see:
35
+
36
+ - Original model: https://huggingface.co/KintsugiHealth/dam
37
+ - Original license metadata: Apache-2.0
38
+ - Base model: `openai/whisper-small.en`
39
+
40
+ This model card intentionally separates the converted-weight details from the
41
+ original DAM model card. The original clinical and safety limitations still
42
+ apply.
43
+
44
+ ## Files
45
+
46
+ | File | Description |
47
+ |---|---|
48
+ | `dam_features_scores_dynamic_range.tflite` | Dynamic-range quantized TFLite model |
49
+ | `dam_features_scores_dynamic_range.metadata.json` | Input/output metadata and thresholds |
50
+ | `evaluation_results.json` | Machine-readable size/accuracy summary |
51
+ | `EVALUATION.md` | Human-readable evaluation summary |
52
+ | `NOTICE` | Derivative-work and original-model attribution |
53
+ | `LICENSE` | Apache License 2.0 |
54
+
55
+ ## Input / Output
56
+
57
+ The model expects **precomputed DAM/Whisper log-mel features**, not raw audio.
58
+
59
+ Input:
60
+
61
+ ```text
62
+ dtype: float32
63
+ shape: [1, 80, 3000]
64
+ ```
65
+
66
+ Output:
67
+
68
+ ```text
69
+ dtype: float32
70
+ shape: [2]
71
+ order: [depression_score, anxiety_score]
72
+ ```
73
+
74
+ The app/runtime should perform the same preprocessing as DAM's `featex.py`:
75
+
76
+ 1. Load mono audio and resample to 16 kHz.
77
+ 2. Remove DC offset and normalize amplitude to `[-1, 1]`.
78
+ 3. Pad/split audio into 30-second chunks.
79
+ 4. Run Whisper log-mel feature extraction.
80
+ 5. Apply DAM log-mel energy rescaling.
81
+ 6. Run this TFLite model per chunk and aggregate scores as needed.
82
+
83
+ ## Quantization Type
84
+
85
+ This is **dynamic-range quantization**:
86
+
87
+ - input remains `float32`
88
+ - output remains `float32`
89
+ - weights are quantized/compressed internally by TensorFlow Lite
90
+
91
+ No preprocessing or postprocessing dtype changes are required relative to the
92
+ fp32 TFLite model.
93
+
94
+ ## Size and Accuracy
95
+
96
+ | Model | Size | Relative |
97
+ |---|---:|---:|
98
+ | Legacy fp32 TFLite rebuild | 695.64 MiB | 1.00x |
99
+ | Dynamic-range TFLite | 184.98 MiB | 0.266x |
100
+
101
+ The dynamic-range model is approximately **73.4% smaller** / **3.76x smaller**.
102
+
103
+ Evaluation on 20 DAIC-WOZ participant-only audio files showed:
104
+
105
+ | Task | MAE vs official PyTorch chunk mean | Max AE | Severity agreement |
106
+ |---|---:|---:|---:|
107
+ | Depression | 0.01580 | 0.04136 | 20/20 |
108
+ | Anxiety | 0.01580 | 0.03887 | 20/20 |
109
+
110
+ See `EVALUATION.md` and `evaluation_results.json` for details.
111
+
112
+ ## Runtime Download Example
113
+
114
+ ```python
115
+ from huggingface_hub import hf_hub_download
116
+
117
+ model_path = hf_hub_download(
118
+ repo_id="pat229988/dam-tflite-dynamic-range",
119
+ filename="dam_features_scores_dynamic_range.tflite",
120
+ )
121
+ print(model_path)
122
+ ```
123
+
124
+ ## Loading with TensorFlow Lite / LiteRT
125
+
126
+ ```python
127
+ import numpy as np
128
+
129
+ try:
130
+ from ai_edge_litert.interpreter import Interpreter
131
+ except Exception:
132
+ import tensorflow as tf
133
+ Interpreter = tf.lite.Interpreter
134
+
135
+ interpreter = Interpreter(model_path="dam_features_scores_dynamic_range.tflite")
136
+ interpreter.allocate_tensors()
137
+
138
+ input_details = interpreter.get_input_details()[0]
139
+ output_details = interpreter.get_output_details()[0]
140
+
141
+ # features shape: [1, 80, 3000], dtype float32
142
+ features = np.zeros((1, 80, 3000), dtype=np.float32)
143
+
144
+ interpreter.set_tensor(input_details["index"], features)
145
+ interpreter.invoke()
146
+ scores = interpreter.get_tensor(output_details["index"]).reshape(-1)
147
+
148
+ depression_score, anxiety_score = scores.tolist()
149
+ ```
150
+
151
+ ## Thresholds
152
+
153
+ The metadata file includes the original DAM thresholds:
154
+
155
+ ```json
156
+ {
157
+ "depression": [-0.6699, -0.2908],
158
+ "anxiety": [-0.7939, -0.2173, 0.1521]
159
+ }
160
+ ```
161
+
162
+ ## Safety / Clinical Limitations
163
+
164
+ - This model is not intended for diagnosis or self-diagnosis without clinical
165
+ oversight.
166
+ - Performance may degrade with noisy audio, multiple speakers, non-English
167
+ speech, or recordings outside intended conditions.
168
+ - This repository provides a conversion-fidelity evaluation, not an independent
169
+ clinical validation of the quantized model.
170
+
171
+ ## Attribution
172
+
173
+ Original DAM model by Kintsugi Health:
174
+
175
+ - https://huggingface.co/KintsugiHealth/dam
176
+ - Source model ID: `KintsugiHealth/dam`
177
+ - Original license metadata: Apache-2.0
dam_features_scores_dynamic_range.metadata.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_model": "KintsugiHealth/dam",
3
+ "model_dir": "dam",
4
+ "input": {
5
+ "name": "whisper_logmel_features",
6
+ "dtype": "float32",
7
+ "shape": [
8
+ 1,
9
+ 80,
10
+ 3000
11
+ ],
12
+ "description": "Preprocessed DAM/Whisper log-mel features, not raw audio."
13
+ },
14
+ "output": {
15
+ "dtype": "float32",
16
+ "shape": [
17
+ 2
18
+ ],
19
+ "labels": [
20
+ "depression_score",
21
+ "anxiety_score"
22
+ ]
23
+ },
24
+ "preprocessing": {
25
+ "sample_rate_hz": 16000,
26
+ "chunk_seconds": 30,
27
+ "n_mels": 80,
28
+ "n_frames": 3000,
29
+ "notes": [
30
+ "Load mono audio and resample to 16 kHz.",
31
+ "Remove DC offset and normalize amplitude to [-1, 1].",
32
+ "Pad/split audio into 30-second chunks.",
33
+ "Run Whisper log-mel feature extraction as in DAM featex.py.",
34
+ "Apply DAM logmel_energies rescale before inference."
35
+ ]
36
+ },
37
+ "thresholds": {
38
+ "depression": [
39
+ -0.6699,
40
+ -0.2908
41
+ ],
42
+ "anxiety": [
43
+ -0.7939,
44
+ -0.2173,
45
+ 0.1521
46
+ ]
47
+ },
48
+ "raw_score_order": [
49
+ "depression",
50
+ "anxiety"
51
+ ]
52
+ }
dam_features_scores_dynamic_range.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9540444d577612a036ce8c4f24ce08d734b1b4ef90846b89600a73401dedab8
3
+ size 193966344
evaluation_results.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": {
3
+ "name": "dam_features_scores_dynamic_range.tflite",
4
+ "source_model": "KintsugiHealth/dam",
5
+ "conversion": "TensorFlow Lite dynamic-range quantization",
6
+ "input": {
7
+ "dtype": "float32",
8
+ "shape": [1, 80, 3000]
9
+ },
10
+ "output": {
11
+ "dtype": "float32",
12
+ "shape": [2],
13
+ "order": ["depression", "anxiety"]
14
+ },
15
+ "file_size_mib": 184.98072052001953,
16
+ "sha256": "c9540444d577612a036ce8c4f24ce08d734b1b4ef90846b89600a73401dedab8"
17
+ },
18
+ "baseline": {
19
+ "name": "legacy fp32 TFLite rebuild",
20
+ "file_size_mib": 695.6440963745117
21
+ },
22
+ "size_comparison": {
23
+ "absolute_reduction_mib": 510.6633758544922,
24
+ "relative_size_ratio": 0.2659128733846568,
25
+ "relative_reduction_percent": 73.40871266153432,
26
+ "smaller_by_factor": 3.760631267572199
27
+ },
28
+ "evaluation": {
29
+ "dataset": "DAIC-WOZ participant-only audio extracts",
30
+ "num_audio_files": 20,
31
+ "comparison_target": "official PyTorch DAM per-chunk scores aggregated by mean",
32
+ "aggregation": "chunk_mean",
33
+ "depression": {
34
+ "mean_diff_dynamic_minus_official": 0.013095549532314881,
35
+ "mean_absolute_error": 0.01580149956564844,
36
+ "median_absolute_error": 0.014209017778436417,
37
+ "max_absolute_error": 0.0413626036606729,
38
+ "severity_level_agreement": "20/20",
39
+ "per_chunk_mean_diff": 0.012983481563285841,
40
+ "per_chunk_mean_absolute_error": 0.022058436869572894,
41
+ "per_chunk_max_absolute_error": 0.089621901512146
42
+ },
43
+ "anxiety": {
44
+ "mean_diff_dynamic_minus_official": 0.013152226906022909,
45
+ "mean_absolute_error": 0.015800999800324254,
46
+ "median_absolute_error": 0.014297692570835352,
47
+ "max_absolute_error": 0.0388676428119652,
48
+ "severity_level_agreement": "20/20",
49
+ "per_chunk_mean_diff": 0.012999067678340252,
50
+ "per_chunk_mean_absolute_error": 0.021374379997907936,
51
+ "per_chunk_max_absolute_error": 0.09266304969787598
52
+ }
53
+ },
54
+ "mac_smoke_test_346": {
55
+ "file": "results/mac-dynamic-test-chunkmean.jsonl",
56
+ "dynamic_file_size_mib": 184.98072052001953,
57
+ "official_chunk_mean": {
58
+ "depression": -0.13878686849027871,
59
+ "anxiety": 0.07146425396203995
60
+ },
61
+ "dynamic_chunk_mean": {
62
+ "depression": -0.13058771580457687,
63
+ "anxiety": 0.07900430142879486
64
+ },
65
+ "depression": {
66
+ "mean_absolute_error": 0.015386152900755406,
67
+ "max_absolute_error": 0.05043572187423706,
68
+ "correlation": 0.9993821695348476
69
+ },
70
+ "anxiety": {
71
+ "mean_absolute_error": 0.013683260977268219,
72
+ "max_absolute_error": 0.047030627727508545,
73
+ "correlation": 0.999388358572843
74
+ }
75
+ }
76
+ }