Adopt framework-specific blocks for content (#16342)

*  refactor code samples with framework-specific blocks

*  update training.mdx

* 🖍 apply feedback
This commit is contained in:
Steven Liu
2022-03-22 14:14:58 -07:00
committed by GitHub
parent 62cbd8423b
commit 7732148124
13 changed files with 169 additions and 133 deletions

View File

@@ -91,8 +91,10 @@ Use 🤗 Datasets [`map`](https://huggingface.co/docs/datasets/package_reference
>>> encoded_ks = ks.map(preprocess_function, remove_columns=["audio", "file"], batched=True)
```
## Fine-tune with Trainer
## Train
<frameworkcontent>
<pt>
Load Wav2Vec2 with [`AutoModelForAudioClassification`]. Specify the number of labels, and pass the model the mapping between label number and label class:
```py
@@ -135,6 +137,8 @@ At this point, only three steps remain:
>>> trainer.train()
```
</pt>
</frameworkcontent>
<Tip>