Skip to content

Commit 94fe0b9

Browse files
author
UV
authored
Improved Documentation Of Audio Classification (huggingface#35368)
* Improved Documentation Of Audio Classification * Updated documentation as per review * Updated audio_classification.md * Update audio_classification.md
1 parent c96cc03 commit 94fe0b9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/source/en/tasks/audio_classification.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Unless required by applicable law or agreed to in writing, software distributed
99
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
1010
specific language governing permissions and limitations under the License.
1111
12-
⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
12+
⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be
1313
rendered properly in your Markdown viewer.
1414
1515
-->
@@ -20,7 +20,7 @@ rendered properly in your Markdown viewer.
2020

2121
<Youtube id="KWwzcmG98Ds"/>
2222

23-
Audio classification - just like with text - assigns a class label output from the input data. The only difference is instead of text inputs, you have raw audio waveforms. Some practical applications of audio classification include identifying speaker intent, language classification, and even animal species by their sounds.
23+
Audio classification - just like with text - assigns a class label as output from the input data. The only difference is instead of text inputs, you have raw audio waveforms. Some practical applications of audio classification include identifying speaker intent, language classification, and even animal species by their sounds.
2424

2525
This guide will show you how to:
2626

@@ -57,7 +57,7 @@ Start by loading the MInDS-14 dataset from the 🤗 Datasets library:
5757
>>> minds = load_dataset("PolyAI/minds14", name="en-US", split="train")
5858
```
5959

60-
Split the dataset's `train` split into a smaller train and test set with the [`~datasets.Dataset.train_test_split`] method. This'll give you a chance to experiment and make sure everything works before spending more time on the full dataset.
60+
Split the dataset's `train` split into a smaller train and test set with the [`~datasets.Dataset.train_test_split`] method. This will give you a chance to experiment and make sure everything works before spending more time on the full dataset.
6161

6262
```py
6363
>>> minds = minds.train_test_split(test_size=0.2)
@@ -79,13 +79,13 @@ DatasetDict({
7979
})
8080
```
8181

82-
While the dataset contains a lot of useful information, like `lang_id` and `english_transcription`, you'll focus on the `audio` and `intent_class` in this guide. Remove the other columns with the [`~datasets.Dataset.remove_columns`] method:
82+
While the dataset contains a lot of useful information, like `lang_id` and `english_transcription`, you will focus on the `audio` and `intent_class` in this guide. Remove the other columns with the [`~datasets.Dataset.remove_columns`] method:
8383

8484
```py
8585
>>> minds = minds.remove_columns(["path", "transcription", "english_transcription", "lang_id"])
8686
```
8787

88-
Take a look at an example now:
88+
Here's an example:
8989

9090
```py
9191
>>> minds["train"][0]
@@ -155,7 +155,7 @@ Now create a preprocessing function that:
155155
... return inputs
156156
```
157157

158-
To apply the preprocessing function over the entire dataset, use 🤗 Datasets [`~datasets.Dataset.map`] function. You can speed up `map` by setting `batched=True` to process multiple elements of the dataset at once. Remove the columns you don't need, and rename `intent_class` to `label` because that's the name the model expects:
158+
To apply the preprocessing function over the entire dataset, use 🤗 Datasets [`~datasets.Dataset.map`] function. You can speed up `map` by setting `batched=True` to process multiple elements of the dataset at once. Remove unnecessary columns and rename `intent_class` to `label`, as required by the model:
159159

160160
```py
161161
>>> encoded_minds = minds.map(preprocess_function, remove_columns="audio", batched=True)
@@ -260,7 +260,7 @@ For a more in-depth example of how to fine-tune a model for audio classification
260260

261261
Great, now that you've fine-tuned a model, you can use it for inference!
262262

263-
Load an audio file you'd like to run inference on. Remember to resample the sampling rate of the audio file to match the sampling rate of the model if you need to!
263+
Load an audio file for inference. Remember to resample the sampling rate of the audio file to match the model's sampling rate, if necessary.
264264

265265
```py
266266
>>> from datasets import load_dataset, Audio

0 commit comments

Comments
 (0)