regisss HF staff commited on
Commit
e831476
1 Parent(s): 87333a4

Change usage section

Browse files
Files changed (1) hide show
  1. README.md +21 -21
README.md CHANGED
@@ -23,25 +23,25 @@ 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 BertTokenizer, BertModel
31
-
32
- tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
33
- model = BertModel.from_pretrained("bert-base-uncased")
34
- args = GaudiTrainingArguments(
35
- output_dir="/tmp/output_dir",
36
- use_habana=True,
37
- use_lazy_mode=True,
38
- gaudi_config_name="Habana/bert-base-uncased",
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_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:
29
+ ```bash
30
+ python run_qa.py \
31
+ --model_name_or_path bert-base-uncased \
32
+ --gaudi_config_name Habana/bert-base-uncased \
33
+ --dataset_name squad \
34
+ --do_train \
35
+ --do_eval \
36
+ --per_device_train_batch_size 24 \
37
+ --per_device_eval_batch_size 8 \
38
+ --learning_rate 3e-5 \
39
+ --num_train_epochs 2 \
40
+ --max_seq_length 384 \
41
+ --output_dir /tmp/squad/ \
42
+ --use_habana \
43
+ --use_lazy_mode \
44
+ --throughput_warmup_steps 2
 
 
45
  ```
46
+
47
+ Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.