Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,66 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
|
5 |
+
[Optimum Habana](https://github.com/huggingface/optimum-habana) is the interface between the Hugging Face Transformers and Diffusers libraries and Habana's Gaudi processor (HPU).
|
6 |
+
It provides a set of tools enabling easy and fast model loading, training and inference on single- and multi-HPU settings for different downstream tasks.
|
7 |
+
Learn more about how to take advantage of the power of Habana HPUs to train and deploy Transformers and Diffusers models at [hf.co/hardware/habana](https://huggingface.co/hardware/habana).
|
8 |
+
|
9 |
+
## Whisper model HPU configuration
|
10 |
+
|
11 |
+
This model only contains the `GaudiConfig` file for running the [Whisper](https://huggingface.co/openai/whisper-small) model on Habana's Gaudi processors (HPU).
|
12 |
+
|
13 |
+
**This model contains no model weights, only a GaudiConfig.**
|
14 |
+
|
15 |
+
This enables to specify:
|
16 |
+
- `use_fused_adam`: whether to use Habana's custom AdamW implementation
|
17 |
+
- `use_fused_clip_norm`: whether to use Habana's fused gradient norm clipping operator
|
18 |
+
- `use_torch_autocast`: whether to use Torch Autocast for managing mixed precision
|
19 |
+
|
20 |
+
## Usage
|
21 |
+
|
22 |
+
The model is instantiated the same way as in the Transformers library.
|
23 |
+
The only difference is that there are a few new training arguments specific to HPUs.\
|
24 |
+
It is strongly recommended to train this model doing bf16 mixed-precision training for optimal performance and accuracy.
|
25 |
+
|
26 |
+
[Here](https://github.com/huggingface/optimum-habana/blob/main/examples/speech-recognition/run_speech_recognition_seq2seq.py) is a sequence-to-sequence speech recognition example script to fine-tune a model. You can run it with Whisper with the following command:
|
27 |
+
```bash
|
28 |
+
python run_speech_recognition_seq2seq.py \
|
29 |
+
--model_name_or_path="openai/whisper-small" \
|
30 |
+
--dataset_name="mozilla-foundation/common_voice_11_0" \
|
31 |
+
--dataset_config_name="hi" \
|
32 |
+
--language="hindi" \
|
33 |
+
--train_split_name="train+validation" \
|
34 |
+
--eval_split_name="test" \
|
35 |
+
--gaudi_config_name="Habana/whisper" \
|
36 |
+
--max_steps="5000" \
|
37 |
+
--output_dir="/tmp/whisper-small-hi" \
|
38 |
+
--per_device_train_batch_size="48" \
|
39 |
+
--per_device_eval_batch_size="2" \
|
40 |
+
--logging_steps="25" \
|
41 |
+
--learning_rate="1e-5" \
|
42 |
+
--warmup_steps="500" \
|
43 |
+
--evaluation_strategy="steps" \
|
44 |
+
--eval_steps="1000" \
|
45 |
+
--save_strategy="steps" \
|
46 |
+
--save_steps="1000" \
|
47 |
+
--generation_max_length="225" \
|
48 |
+
--preprocessing_num_workers="1" \
|
49 |
+
--length_column_name="input_length" \
|
50 |
+
--max_duration_in_seconds="30" \
|
51 |
+
--text_column_name="sentence" \
|
52 |
+
--freeze_feature_encoder="False" \
|
53 |
+
--group_by_length \
|
54 |
+
--bf16 \
|
55 |
+
--overwrite_output_dir \
|
56 |
+
--do_train \
|
57 |
+
--do_eval \
|
58 |
+
--predict_with_generate \
|
59 |
+
--use_habana \
|
60 |
+
--use_hpu_graphs_for_inference \
|
61 |
+
--label_features_max_length 128 \
|
62 |
+
--dataloader_num_workers 8 \
|
63 |
+
--throughput_warmup_steps 3
|
64 |
+
```
|
65 |
+
|
66 |
+
Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.
|