Change usage section
Browse files22 unmodified lines2324252627282930313233343536373839404142434426272829303132333435363738394041424344454647484950515222 unmodified lines## Usage
The model is instantiated the same way as in the Transformers library.The only difference is that there are a few new training arguments specific to HPUs:
```from optimum.habana import GaudiTrainer, GaudiTrainingArgumentsfrom transformers import ViTForImageClassification
model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224-in21k')args = GaudiTrainingArguments( output_dir="/tmp/output_dir", use_habana=True, use_lazy_mode=True, gaudi_config_name="Habana/vit",)
trainer = GaudiTrainer( model=model, args=args,)trainer.train()The only difference is that there are a few new training arguments specific to HPUs.
[Here](https://github.com/huggingface/optimum-habana/blob/main/examples/image-classification/run_image_classification.py) is an image classification example script to fine-tune a model. You can run it with ViT with the following command:```bashpython run_image_classification.py \ --model_name_or_path google/vit-base-patch16-224-in21k \ --dataset_name cifar10 \ --output_dir /tmp/outputs/ \ --remove_unused_columns False \ --do_train \ --do_eval \ --learning_rate 2e-5 \ --num_train_epochs 5 \ --per_device_train_batch_size 64 \ --per_device_eval_batch_size 64 \ --evaluation_strategy epoch \ --save_strategy epoch \ --load_best_model_at_end True \ --save_total_limit 3 \ --seed 1337 \ --use_habana \ --use_lazy_mode \ --gaudi_config_name Habana/vit \ --throughput_warmup_steps 2```
Check the [documentation](https://huggingface.co/docs/optimum/habana/index) out for more advanced usage and examples. README.md+26-19