regisss HF staff commited on
Commit
88e164b
1 Parent(s): 30315c1

Change usage section

Browse files
Files changed (1) hide show
  1. README.md +19 -21
README.md CHANGED
@@ -23,25 +23,23 @@ 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 GPT2Tokenizer, GPT2Model
31
-
32
- tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
33
- model = GPT2Model.from_pretrained('gpt2')
34
- args = GaudiTrainingArguments(
35
- output_dir="/tmp/output_dir",
36
- use_habana=True,
37
- use_lazy_mode=True,
38
- gaudi_config_name="Habana/gpt2",
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/language-modeling/run_clm.py) is a causal language modeling example script to pre-train/fine-tune a model. You can run it with GPT2 with the following command:
29
+ ```bash
30
+ python run_clm.py \
31
+ --model_name_or_path gpt2 \
32
+ --dataset_name wikitext \
33
+ --dataset_config_name wikitext-2-raw-v1 \
34
+ --per_device_train_batch_size 4 \
35
+ --per_device_eval_batch_size 4 \
36
+ --do_train \
37
+ --do_eval \
38
+ --output_dir /tmp/test-clm \
39
+ --gaudi_config_name Habana/gpt2 \
40
+ --use_habana \
41
+ --use_lazy_mode \
42
+ --throughput_warmup_steps 2
 
 
 
 
43
  ```
44
+
45
+ Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples.