regisss HF staff commited on
Commit
f785e89
1 Parent(s): 08165f1

Add README

Browse files
Files changed (1) hide show
  1. README.md +42 -0
README.md CHANGED
@@ -1,3 +1,45 @@
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 Transformers library and Habana's Gaudi processor (HPU). It provides a set of tools enabling easy and fast model loading and fine-tuning on single- and multi-HPU settings for different downstream tasks.
6
+ Learn more about how to take advantage of the power of Habana HPUs to train Transformers models at [hf.co/hardware/habana](https://huggingface.co/hardware/habana).
7
+
8
+ ## ViT model HPU configuration
9
+
10
+ This model contains just the `GaudiConfig` file for running the [ViT](https://huggingface.co/google/vit-base-patch16-224-in21k) model on Habana's Gaudi processors (HPU).
11
+
12
+ **This model contains no model weights, only a GaudiConfig.**
13
+
14
+ This enables to specify:
15
+ - `use_habana_mixed_precision`: whether to use Habana Mixed Precision (HMP)
16
+ - `hmp_opt_level`: optimization level for HMP, see [here](https://docs.habana.ai/en/latest/PyTorch/PyTorch_User_Guide/PT_Mixed_Precision.html#configuration-options) for a detailed explanation
17
+ - `hmp_bf16_ops`: list of operators that should run in bf16
18
+ - `hmp_fp32_ops`: list of operators that should run in fp32
19
+ - `hmp_is_verbose`: verbosity
20
+ - `use_fused_adam`: whether to use Habana's custom AdamW implementation
21
+ - `use_fused_clip_norm`: whether to use Habana's fused gradient norm clipping operator
22
+
23
+ ## Usage
24
+
25
+ The model is instantiated the same way as in the Transformers library.
26
+ The only difference is that there are a few new training arguments specific to HPUs:
27
+
28
+ ```
29
+ from optimum.habana import GaudiTrainer, GaudiTrainingArguments
30
+ from transformers import ViTForImageClassification
31
+
32
+ model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224-in21k')
33
+ args = GaudiTrainingArguments(
34
+ output_dir="/tmp/output_dir",
35
+ use_habana=True,
36
+ use_lazy_mode=True,
37
+ gaudi_config_name="Habana/vit",
38
+ )
39
+
40
+ trainer = GaudiTrainer(
41
+ model=model,
42
+ args=args,
43
+ )
44
+ trainer.train()
45
+ ```