GokseninYuksel commited on
Commit
cc8e7e7
·
verified ·
1 Parent(s): 24e9ac9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +122 -138
README.md CHANGED
@@ -1,199 +1,183 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
  # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
 
10
 
11
 
12
  ## Model Details
13
 
 
 
 
 
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
 
 
 
 
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
 
 
 
29
 
30
- <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
  ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
 
50
- [More Information Needed]
51
 
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
- ## How to Get Started with the Model
 
 
 
 
71
 
72
- Use the code below to get started with the model.
 
73
 
74
- [More Information Needed]
 
 
 
 
75
 
76
  ## Training Details
77
 
 
78
  ### Training Data
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
 
 
 
 
 
 
 
 
 
 
81
 
82
- [More Information Needed]
83
 
84
  ### Training Procedure
85
 
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
 
 
 
 
 
 
 
 
 
87
 
88
- #### Preprocessing [optional]
 
 
 
 
89
 
90
- [More Information Needed]
91
 
 
 
 
 
 
 
92
 
93
- #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
 
107
  ### Testing Data, Factors & Metrics
108
 
109
  #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
 
 
 
 
 
 
 
 
118
 
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
 
127
  ### Results
128
 
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
 
135
- ## Model Examination [optional]
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
 
 
 
 
 
196
 
197
  ## Model Card Contact
198
 
199
- [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ tags:
4
+ - audio
5
+ - spatial
6
+ - speech
7
+ license: mit
8
+ datasets:
9
+ - agkphysics/AudioSet
10
+ metrics:
11
+ - accuracy
12
+ pipeline_tag: feature-extraction
13
  ---
14
 
15
  # Model Card for Model ID
16
 
17
+ GRAM (General Purpose Audio Representation Model) is trained on AudioSet with newly proposed naturalistic training methadology.
18
+ GRAMs utilize MWMAE (Multi-window multi-head attention), and RIR augmentations to achieve state-of-the-art results on downstream tasks such as FSD50K, ESC50, VL even when conditions are very adverse. What is different about GRAMs is the spatial reasoning capabilities, and the robustness to noise and reverberation.
19
+ GRAMs natively support binaural localization, and ambisonics localization tasks unlike other models in the literature. Therefore, GRAMs can be used for understanding spatial scenes as well as classifying sounds, or recognizing speech in very noisy and reverberant environments.
20
 
21
 
22
  ## Model Details
23
 
24
+ The GRAM learns spatial audio representation by reconstructing multi-channel masked spectrogram
25
+ patches. First, a patch extractor consisting of a single convolutional layer with 2D convolutional
26
+ filters divides each multi-channel spectrogram into n non-overlapping patches. Nonmasked patch embeddings are input to the encoder, for which we selected the 12-layer ViT-Base
27
+ (ViT-B) Transformer (Dosovitskiy et al., 2021) similar to Huang et al. (2022); Yadav et al. (2024).
28
+ The encoder outputs patch representations that can be further used for fine-tuning.
29
  ### Model Description
30
 
31
+ GRAM is a self-supervised, multi-channel masked auto-encoder model that efficiently learns spatial general-purpose audio representations
32
+ from simulated real-world sound scenes. To train GRAM, we developed a custom pipeline which
33
+ makes use of the Soundspace 2.0 platform (Chen et al., 2022a) to simulate high-quality real-world
34
+ sound scenes from AudioSet (Gemmeke et al., 2017), and of WHAMR! (Maciejewski et al., 2020)
35
+ for adding background noise. We present two versions of GRAM to ensure flexible application across audio formats:
36
+ GRAM-Binaural for two-channel audio clips, and GRAM-Ambisonics for four-channel audio clips in
37
+ the first-order Ambisonics format.
38
 
 
 
 
 
 
 
 
39
 
40
+ - **Developed by:** Goksenin Yuksel, [email protected]
41
+ - **Model type:** Transformers, Audio Foundation Models
42
+ - **Language(s) (NLP):** GRAMs support all languages, but mainly English.
43
+ - **License:** MIT
44
 
45
+ ### Model Sources
46
 
47
+ - **Repository:** https://github.com/labhamlet/GRAM-T
48
+ - **Paper:** https://arxiv.org/abs/2506.00934
 
49
 
50
  ## Uses
51
 
52
+ GRAMs can be used as a powerful feature extractor for downstream tasks such as enviromental sound classification, speech recognition, speaker counting, sound localization.
53
+ Later, training a linear head on top of these extracted features would yield a fine-tuned audio scene analysis model.
 
 
 
 
 
 
 
 
 
54
 
 
55
 
56
+ ## How to Get Started with the Model
 
 
 
 
 
 
 
 
 
 
 
 
57
 
 
58
 
59
+ GRAMs have three strategies to choose from; "raw", "mean" or "cls". We advise to use "raw" strategy as this prooduces embeddings over the time frames, and is more robust to silent parts.
60
 
61
+ Raw : Break audio clips into non-overlapping 2 second chunks, concatenating the features in time and finally taking a mean over the time axis to generate a fixed vector representation independent of the input audio duration
62
+ Mean : Break audio clips into non-overlapping 2 second chunks, and taking a mean over all the patches to generate a fixed vector representation independent of the input audio duration
63
+ Cls : Break audio clips into non-overlapping 2 second chunks, and return the "[CLS]" token representation.
64
+ ~~~python
65
+ from transformers import AutoModel, AutoFeatureExtractor
66
 
67
+ model = AutoModel.from_pretrained("labhamlet/gramt-mono", trust_remote_code=True)
68
+ extractor = AutoFeatureExtractor.from_pretrained("labhamlet/gramt-mono", trust_remote_code=True)
69
 
70
+ audio = torch.zeros([1,320000])
71
+ extracted = extractor(audio, return_tensors="pt")
72
+ log_mel = extracted['input_values']
73
+ print(model(log_mel, strategy = "raw").shape)
74
+ ~~~
75
 
76
  ## Training Details
77
 
78
+
79
  ### Training Data
80
 
81
+ The 85,000 naturalistic scenes were split into a train set of 70,000 scenes (corresponding to 70 Matterport3D houses), and a test set of 15,000 scenes (15
82
+ Matterport3D houses) for down-stream evaluation (see Section 3.4). We used the 70,000 naturalistic
83
+ scenes in the train set to generate naturalistic scenes for all audio clips in the unbalanced training
84
+ set of AudioSet (10-second sound tracks of 1.74 million YouTube videos (Gemmeke et al., 2017)).
85
+ Specifically, during training we randomly paired an AudioSet clip with a noise sound clip from the
86
+ WHAMR! background noise database (Maciejewski et al., 2020). WHAMR! noise clips longer than
87
+ 10 s were trimmed to 10 s duration and a linear fade-in/fade-out of 200 ms was applied to every noise
88
+ clip prior to mixing of the sound scene.
89
+ To create a naturalistic sound scene, we then convolved the AudioSet clip either with BRIR(s, r, θ)
90
+ for GRAM-Binaural, or with a ARIR(s, r, θ) for GRAM-Ambisonics, to obtain T. Similarly, we
91
+ convolved the WHAMR! noise clip with the to obtain naturalistic scenes.
92
 
 
93
 
94
  ### Training Procedure
95
 
96
+ We transformed the channels of each sound scene (i.e., the waveforms) into logscale mel spectrograms using 128 mel filters in the frequency range of 50-16000 Hz with a 25 ms
97
+ Hanning window and 10 ms hop length, resulting in spectrograms of dimension 1024 × 128. For
98
+ GRAM-Ambisonic, we extracted normalized active Intensity Vectors (IVs) from the spectrograms
99
+ as additional input features encoding spatial information. We concatenated mel
100
+ spectrograms and intensity vectors, resulting in input x = [xmel, IV s] for each naturalistic scene
101
+ generated from an AudioSet clip. In-batch sampling: As the online mixing of naturalistic acoustic scenes is computationally expensive
102
+ due to multiple long convolutions, we used a random in-batch sampling procedure to increase the
103
+ effective batch size in a computationally efficient manner. We randomly sampled 16 partially
104
+ overlapping segments of 2 seconds to create 16 samples of dimension 200 × 128. This increases the
105
+ original batch size of 96 to an effective batch size of 1536.
106
 
107
+ For pre-training, we divided the binaural spectrogram into 2×8×16,ambisonics spectrograms into 7×8×16 patches. We used an adapted version
108
+ of the mask-based framework of MW-MAE (Yadav et al., 2024), randomly selecting a subset of
109
+ n patches M1, . . . , Mn for i = 1, . . . , n for masking (masking ratio = 0.8) and replacing their
110
+ embedding with a learnable mask token. Finally, we added fixed sinusoidal positional embeddings to
111
+ all embedded patches.
112
 
 
113
 
114
+ We trained all GRAMs for 500 K steps on an H100 92 GB GPU machine
115
+ with 16 CPU cores. We used the AdamW optimizer (Loshchilov & Hutter, 2017) with weight decay
116
+ rate of 0.01, gradient clipping, and a cosine learning rate scheduler with 10 K steps warm-up. The
117
+ initial learning rate was set to 0.0002, and decayed to 0. We optimize the mean squared error (MSE)
118
+ loss function between the predicted masked patches and their corresponding input spectrogram
119
+ patches.
120
 
121
+ #### Preprocessing
122
 
123
+ Firstly, RMS Normalization was applied to audio clips to get all of them in the same loudness levels. Later, instance normalization was applied to the convolved scenes
124
 
 
125
 
126
+ #### Training Hyperparameters
127
 
128
+ - **Training regime:**: GRAMs were trained with mixed precision, torch.compile and flash attention.
129
 
130
  ## Evaluation
131
 
132
+ We evaluate GRAM and other state-of-the-art models on the HEAR benchmark
133
+ task suite, which presents a wide range of tasks to evaluate the downstream performance of audio
134
+ representation models (Turian et al., 2022). We additionally evaluated performance on simulated real-worldsound scenes using Nat-HEAR.
135
  ### Testing Data, Factors & Metrics
136
 
137
  #### Testing Data
138
 
139
+ **HEAR**: The aim of the HEAR benchmark is to develop a general-purpose audio representation that provides a strong basis for learning in a wide variety of tasks and scenarios.
140
+ HEAR evaluates audio representations using a benchmark suite across a variety of domains, including speech, environmental sound, and music.
141
+ HEAR was launched as a NeurIPS 2021 shared challenge. It still remains an open question whether one single general-purpose audio representation can perform as holistically as the human ear.
 
 
142
 
143
+ **NatHEAR**: Orovides a naturalistic version of all selected datasets in the HEAR benchmark suite in
144
+ two audio formats: a two-channel, binaural format and a four-channel, first-order Ambisonics
145
+ format. Weincluded sound localization tasks for two different domains which we generated using
146
+ HEAR benchmark datasets: A speech localization task based on SC-5, and an environmental sound
147
+ localization task based on ESC-50. The localization tasks are modeled as a multi-output regression
148
+ task in which model outputs represent the estimated 3D Cartesian coordinates [x, y, z] on the unit
149
+ sphere (Adavanne et al., 2018). Finally, to assess the transferability of GRAM to real-world sound
150
+ scenes, we evaluate also on the sound event detection and localization tasks in TUT Sound Events
151
+ 2018 REAL (Adavanne et al., 2019)
152
 
 
 
 
 
 
 
 
153
 
154
  ### Results
155
 
 
 
 
 
 
156
 
157
+ | Model | DCASE | FSD50K | LC | ESC-50 | CD | VL | SC-5 | NS | BO | Mri-S | Mri-T | s(m) |
158
+ |-------|-------|--------|-------|--------|-------|-------|------|-----|-------|-------|-------|------|
159
+ | HEAR-Naive | 8.8 | 13.2 | 43.5 ± 1.6 | 28.6 ± 3.1 | 38.0 ± 2.3 | 14.8 ± 3.0 | 13.3 | 87.6 | 98.7 ± 1.9 | 94.1 ± 0.5 | 87.6 ± 6.4 | 0.0 |
160
+ | Wav2Vec 2.0 | 23.5 | 29.4 | 69.9 ± 2.1 | 46.4 ± 1.8 | 57.3 ± 1.1 | 34.9 ± 2.4 | 85.3 | 17.4 | 81.4 ± 4.8 | 90.7 ± 0.8 | 77.0 ± 0.9 | 31.5 |
161
+ | HuBERT | 78.3 | 32.8 | 63.3 ± 1.2 | 58.6 ± 2.8 | 71.2 ± 1.2 | 65.2 ± 2.9 | 94.0 | 19.8 | 93.2 ± 5.9 | 94.6 ± 0.4 | 85.0 ± 2.5 | 44.7 |
162
+ | WavLM | 27.0 | 25.7 | 61.3 ± 2.3 | 49.5 ± 3.8 | 64.3 ± 1.3 | 60.1 ± 3.2 | 93.8 | 18.2 | 84.3 ± 6.3 | 88.8 ± 1.0 | 76.8 ± 0.5 | 36.8 |
163
+ | MAE | – | 33.4 | 62.3 ± 1.1 | 72.9 ± 2.1 | 60.8 ± 1.8 | 21.3 ± 5.8 | 66.6 | 63.6 | 94.5 ± 5.6 | 94.8 ± 0.6 | 85.1 ± 10.4 | 32.7 |
164
+ | SSAST* | – | 21.4 | 57.8 ± 3.3 | 58.3 ± 2.6 | 48.0 ± 2.1 | 15.4 ± 2.6 | 22.0 | 64.2 | 95.8 ± 4.3 | 90.2 ± 5.9 | 89.1 ± 8.0 | 15.8 |
165
+ | BEATs | – | 54.1 | 77.8 ± 1.2 | 85.8 ± 2.9 | 66.9 ± 2.5 | 39.7 ± 4.3 | 86.9 | 68.6 | 94.1 ± 3.5 | 95.5 ± 0.4 | 96.6 ± 0.5 | 61.4 |
166
+ | MW-MAE | 94.2 | 51.8 | 80.3 ± 1.9 | 82.2 ± 3.2 | 74.4 ± 1.5 | 45.5 ± 1.7 | 91.6 | 69.4 | 95.8 ± 4.3 | 97.5 ± 0.4 | 97.6 ± 0.6 | 71.0 |
167
+ | SSAM | 87.3 | 53.5 | 75.5 ± 1.4 | 82.9 ± 3.6 | 70.2 ± 0.4 | 56.4 ± 5.2 | 89.3 | 72.6 | 93.2 ± 3.5 | 97.8 ± 0.5 | 96.9 ± 0.5 | 71.2 |
168
+ | **GRAM-Binaural** | 95.6 | 56.1 | 81.0 ± 1.1 | 86.7 ± 2.4 | 75.0 ± 1.4 | 53.2 ± 3.0 | 92.5 | 77.0 | 94.9 ± 3.2 | 97.3 ± 0.3 | 98.1 ± 0.2 | 74.6 |
169
+ | **GRAM-Ambisonics** | 94.3 | 53.0 | 79.4 ± 1.5 | 85.9 ± 1.5 | 71.9 ± 1.9 | 53.7 ± 1.2 | 89.6 | 73.8 | 94.9 ± 4.9 | 97.6 ± 0.5 | 98.5 ± 0.4 | 73.4 |
170
+ | **GRAM-Mono** | 95.3 | 56.8 | 81.3 ± 1.8 | 87.5 ± 2.3 | 75.1 ± 0.6 | 57.3 ± 3.4 | 93.5 | 75.8 | 95.8 ± 3.7 | 97.4 ± 0.3 | 98.0 ± 0.2 | 76.1 |
171
 
172
+ #### Summary
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
+ We present a General-purpose, Real-world Audio representation Model (GRAM), which learns spatial
175
+ audio representations using a multi-channel masked auto-encoder approach. GRAM demonstrates
176
+ remarkable performance in naturalistic sound scenes as well as clean sound scenes, surpassing all
177
+ state-of-the-art self-supervised spectrogram-based audio foundation models while requiring only a
178
+ fraction of the training data. Moreover, GRAM is the first audio foundation model that is available
179
+ in both a two-channel, binaural format and a four-channel, first-order ambisonics format
180
 
181
  ## Model Card Contact
182
 
183
+ Goksenin Yuksel; [email protected]