3c3
< # Copyright 2020 The HuggingFace Inc. team. All rights reserved.
---
> # Copyright 2022 The HuggingFace Inc. team. All rights reserved.
17,19c17,18
< Fine-tuning the library models for causal language modeling (GPT, GPT-2, CTRL, ...) on a text file or a dataset.
< 
< Here is the full list of checkpoints on the hub that can be fine-tuned by this script:
---
> Training the library models for causal language modeling (GPT, GPT-2, CTRL, ...) on a text file or a dataset.
> Here is the full list of checkpoints on the hub that can be trained by this script:
35,36d33
< from datasets import load_dataset
< 
37a35
> from datasets import load_dataset
45,46d42
<     Trainer,
<     TrainingArguments,
48,49d43
<     is_torch_tpu_available,
<     set_seed,
55a50,52
> from optimum.habana import GaudiConfig, GaudiTrainer, GaudiTrainingArguments
> from optimum.habana.utils import set_seed
> 
58c55
< check_min_version("4.29.0.dev0")
---
> check_min_version("4.28.0")
79c76,77
<                 "The model checkpoint for weights initialization.Don't set if you want to train a model from scratch."
---
>                 "The model checkpoint for weights initialization. Don't set it if you want to train a model from"
>                 " scratch."
132a131,139
>     use_cache: bool = field(
>         default=True,
>         metadata={
>             "help": (
>                 "Whether or not the model should return the last key/values attentions (not used by all models)."
>                 "Only relevant if `config.is_decoder=True`."
>             )
>         },
>     )
185c192,193
<     streaming: bool = field(default=False, metadata={"help": "Enable streaming mode"})
---
> 
>     streaming: bool = field(default=False, metadata={"help": "Enable streaming mode."})
233c241
<     parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments))
---
>     parser = HfArgumentParser((ModelArguments, DataTrainingArguments, GaudiTrainingArguments))
262a271,277
>     gaudi_config = GaudiConfig.from_pretrained(
>         training_args.gaudi_config_name,
>         cache_dir=model_args.cache_dir,
>         revision=model_args.model_revision,
>         use_auth_token=True if model_args.use_auth_token else None,
>     )
> 
265,266c280,282
<         f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}"
<         + f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}"
---
>         f"Process rank: {training_args.local_rank}, device: {training_args.device}, "
>         + f"distributed training: {bool(training_args.local_rank != -1)}, "
>         + f"mixed-precision training: {gaudi_config.use_habana_mixed_precision}"
376a393
>         "use_cache": False if training_args.gradient_checkpointing else model_args.use_cache,
562c579
<     trainer = Trainer(
---
>     trainer = GaudiTrainer(
563a581
>         gaudi_config=gaudi_config,
570,573c588,589
<         compute_metrics=compute_metrics if training_args.do_eval and not is_torch_tpu_available() else None,
<         preprocess_logits_for_metrics=preprocess_logits_for_metrics
<         if training_args.do_eval and not is_torch_tpu_available()
<         else None,
---
>         compute_metrics=compute_metrics if training_args.do_eval else None,
>         preprocess_logits_for_metrics=preprocess_logits_for_metrics if training_args.do_eval else None,
627,631d642
< 
< 
< def _mp_fn(index):
<     # For xla_spawn (TPUs)
<     main()
