Commit
•
6c885bb
1
Parent(s):
dd04400
Remove hmp from config and README (#1)
Browse files- Remove hmp from config and README (82c4ed4da8fce1b0b79a45e1d9cedfeb0a150fbf)
- Update README.md (90387c976d1727ecf2195569f34cca9b830ddb7b)
Co-authored-by: Jan Wieczorek <jwieczorekhabana@users.noreply.huggingface.co>
- README.md +5 -7
- gaudi_config.json +1 -24
README.md
CHANGED
@@ -13,18 +13,15 @@ This model only contains the `GaudiConfig` file for running the [bert-base-uncas
|
|
13 |
**This model contains no model weights, only a GaudiConfig.**
|
14 |
|
15 |
This enables to specify:
|
16 |
-
- `use_habana_mixed_precision`: whether to use Habana Mixed Precision (HMP)
|
17 |
-
- `hmp_opt_level`: optimization level for HMP, see [here](https://docs.habana.ai/en/latest/PyTorch/PyTorch_Mixed_Precision/PT_Mixed_Precision.html#configuration-options) for a detailed explanation
|
18 |
-
- `hmp_bf16_ops`: list of operators that should run in bf16
|
19 |
-
- `hmp_fp32_ops`: list of operators that should run in fp32
|
20 |
-
- `hmp_is_verbose`: verbosity
|
21 |
- `use_fused_adam`: whether to use Habana's custom AdamW implementation
|
22 |
- `use_fused_clip_norm`: whether to use Habana's fused gradient norm clipping operator
|
|
|
23 |
|
24 |
## Usage
|
25 |
|
26 |
The model is instantiated the same way as in the Transformers library.
|
27 |
-
The only difference is that there are a few new training arguments specific to HPUs
|
|
|
28 |
|
29 |
[Here](https://github.com/huggingface/optimum-habana/blob/main/examples/question-answering/run_qa.py) is a question-answering example script to fine-tune a model on SQuAD. You can run it with BERT with the following command:
|
30 |
```bash
|
@@ -42,7 +39,8 @@ python run_qa.py \
|
|
42 |
--output_dir /tmp/squad/ \
|
43 |
--use_habana \
|
44 |
--use_lazy_mode \
|
45 |
-
--throughput_warmup_steps 2
|
|
|
46 |
```
|
47 |
|
48 |
Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.
|
|
|
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/question-answering/run_qa.py) is a question-answering example script to fine-tune a model on SQuAD. You can run it with BERT with the following command:
|
27 |
```bash
|
|
|
39 |
--output_dir /tmp/squad/ \
|
40 |
--use_habana \
|
41 |
--use_lazy_mode \
|
42 |
+
--throughput_warmup_steps 2 \
|
43 |
+
--bf16
|
44 |
```
|
45 |
|
46 |
Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.
|
gaudi_config.json
CHANGED
@@ -1,28 +1,5 @@
|
|
1 |
{
|
2 |
-
"use_habana_mixed_precision": true,
|
3 |
-
"hmp_is_verbose": false,
|
4 |
"use_fused_adam": true,
|
5 |
"use_fused_clip_norm": true,
|
6 |
-
"
|
7 |
-
"add",
|
8 |
-
"addmm",
|
9 |
-
"bmm",
|
10 |
-
"div",
|
11 |
-
"dropout",
|
12 |
-
"gelu",
|
13 |
-
"iadd",
|
14 |
-
"linear",
|
15 |
-
"layer_norm",
|
16 |
-
"matmul",
|
17 |
-
"mm",
|
18 |
-
"rsub",
|
19 |
-
"softmax",
|
20 |
-
"truediv"
|
21 |
-
],
|
22 |
-
"hmp_fp32_ops": [
|
23 |
-
"embedding",
|
24 |
-
"nll_loss",
|
25 |
-
"log_softmax",
|
26 |
-
"cross_entropy"
|
27 |
-
]
|
28 |
}
|
|
|
1 |
{
|
|
|
|
|
2 |
"use_fused_adam": true,
|
3 |
"use_fused_clip_norm": true,
|
4 |
+
"use_torch_autocast": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|