diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index 6567de9186201f..0c3ea207bb140b 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -2770,6 +2770,7 @@ def init_git_repo(self, at_init: bool = False): self.args.output_dir, clone_from=repo_name, use_auth_token=use_auth_token, + private=self.args.hub_private_repo, ) except EnvironmentError: if self.args.overwrite_output_dir and at_init: diff --git a/src/transformers/training_args.py b/src/transformers/training_args.py index 3f05b772721237..adaf50da8ffe41 100644 --- a/src/transformers/training_args.py +++ b/src/transformers/training_args.py @@ -416,6 +416,8 @@ class TrainingArguments: hub_token (`str`, *optional*): The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with `huggingface-cli login`. + hub_private_repo (`bool`, *optional*, defaults to `False`): + If True, the Hub repo will be set to private. gradient_checkpointing (`bool`, *optional*, defaults to `False`): If True, use gradient checkpointing to save memory at the expense of slower backward pass. include_inputs_for_metrics (`bool`, *optional*, defaults to `False`): @@ -738,6 +740,7 @@ class TrainingArguments: metadata={"help": "The hub strategy to use when `--push_to_hub` is activated."}, ) hub_token: str = field(default=None, metadata={"help": "The token to use to push to the Model Hub."}) + hub_private_repo: bool = field(default=False, metadata={"help": "Whether the model repository is private or not."}) gradient_checkpointing: bool = field( default=False, metadata={