Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,62 @@
|
|
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 |
+
## Llama model HPU configuration
|
10 |
+
|
11 |
+
This model only contains the `GaudiConfig` file for running [Falcon models](https://huggingface.co/tiiuae) 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 PyTorch's autocast 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 |
+
|
25 |
+
[Here](https://github.com/huggingface/optimum-habana/blob/main/examples/language-modeling/run_clm.py) is a causal language modeling example script to pre-train/fine-tune a model. You can run it with Falcon with the following command:
|
26 |
+
```bash
|
27 |
+
LOWER_LIST=ops_bf16.txt python3 run_lora_clm.py \
|
28 |
+
--model_name_or_path tiiuae/falcon-40b \
|
29 |
+
--dataset_name timdettmers/openassistant-guanaco \
|
30 |
+
--bf16 True \
|
31 |
+
--output_dir ./model_lora_falcon \
|
32 |
+
--num_train_epochs 3 \
|
33 |
+
--per_device_train_batch_size 1 \
|
34 |
+
--per_device_eval_batch_size 1 \
|
35 |
+
--gradient_accumulation_steps 16 \
|
36 |
+
--evaluation_strategy "no" \
|
37 |
+
--save_strategy "no" \
|
38 |
+
--learning_rate 3e-4 \
|
39 |
+
--max_grad_norm 0.3 \
|
40 |
+
--warmup_ratio 0.03 \
|
41 |
+
--lr_scheduler_type "constant" \
|
42 |
+
--logging_steps 1 \
|
43 |
+
--do_train \
|
44 |
+
--use_habana \
|
45 |
+
--use_lazy_mode \
|
46 |
+
--pipelining_fwd_bwd \
|
47 |
+
--throughput_warmup_steps 3 \
|
48 |
+
--lora_rank=64 \
|
49 |
+
--lora_alpha=16 \
|
50 |
+
--lora_dropout=0.1 \
|
51 |
+
--lora_target_modules "query_key_value" "dense" "dense_h_to_4h" "dense_4h_to_h" \
|
52 |
+
--dataset_concatenation \
|
53 |
+
--max_seq_length 256 \
|
54 |
+
--low_cpu_mem_usage True \
|
55 |
+
--adam_epsilon 1e-08 \
|
56 |
+
--do_eval \
|
57 |
+
--validation_split_percentage 5
|
58 |
+
```
|
59 |
+
|
60 |
+
You will need to install the [PEFT](https://huggingface.co/docs/peft/index) library with `pip install peft` to run the command above.
|
61 |
+
|
62 |
+
Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.
|