Habana
regisss HF staff commited on
Commit
10d236f
1 Parent(s): bda9811

Change usage section

Browse files
Files changed (1) hide show
  1. README.md +25 -21
README.md CHANGED
@@ -23,25 +23,29 @@ This enables to specify:
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 T5Tokenizer, T5Model
31
-
32
- tokenizer = T5Tokenizer.from_pretrained('t5-base')
33
- model = T5Model.from_pretrained('t5-base')
34
- args = GaudiTrainingArguments(
35
- output_dir="/tmp/output_dir",
36
- use_habana=True,
37
- use_lazy_mode=True,
38
- gaudi_config_name="Habana/t5",
39
- )
40
-
41
- trainer = GaudiTrainer(
42
- model=model,
43
- args=args,
44
- tokenizer=tokenizer,
45
- )
46
- trainer.train()
 
 
47
  ```
 
 
 
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
+ [Here](https://github.com/huggingface/optimum-habana/blob/main/examples/question-answering/run_summarization.py) is a summarization example script to fine-tune a model. You can run it with T5-small with the following command:
29
+ ```bash
30
+ python run_summarization.py \
31
+ --model_name_or_path t5-small \
32
+ --do_train \
33
+ --do_eval \
34
+ --dataset_name cnn_dailymail \
35
+ --dataset_config "3.0.0" \
36
+ --source_prefix "summarize: " \
37
+ --output_dir /tmp/tst-summarization \
38
+ --per_device_train_batch_size 4 \
39
+ --per_device_eval_batch_size 4 \
40
+ --overwrite_output_dir \
41
+ --predict_with_generate \
42
+ --use_habana \
43
+ --use_lazy_mode \
44
+ --gaudi_config_name Habana/t5 \
45
+ --ignore_pad_token_for_loss False \
46
+ --pad_to_max_length \
47
+ --save_strategy epoch \
48
+ --throughput_warmup_steps 2
49
  ```
50
+
51
+ Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.