Skip to content

Commit

Permalink
Private repo TrainingArgument (#16707)
Browse files Browse the repository at this point in the history
* private repo argument to trainer

* format

Co-authored-by: Nicholas Broad <nicholas@nmbroad.com>
  • Loading branch information
nbroad1881 and nbroad1881 authored Apr 11, 2022
1 parent d4b3e35 commit 161c0a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions src/transformers/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`):
Expand Down Expand Up @@ -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={
Expand Down

0 comments on commit 161c0a2

Please # to comment.