Skip to content

Commit 0e5a99b

Browse files
committed
Quick hacks for push_to_hub from notebooks - follow-up
1 parent e3c982e commit 0e5a99b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/diffusers/hub_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def init_git_repo(args, at_init: bool = False):
5050
Whether this function is called before any training or not. If `self.args.overwrite_output_dir` is `True`
5151
and `at_init` is `True`, the path to the repo (which is `self.args.output_dir`) might be wiped out.
5252
"""
53-
if not hasattr(args, "local_rank") or args.local_rank not in [-1, 0]:
53+
if hasattr(args, "local_rank") and args.local_rank not in [-1, 0]:
5454
return
5555
hub_token = args.hub_token if hasattr(args, "hub_token") else None
5656
use_auth_token = True if hub_token is None else hub_token
@@ -112,7 +112,7 @@ def push_to_hub(
112112
commit and an object to track the progress of the commit if `blocking=True`
113113
"""
114114

115-
if args.hub_model_id is None:
115+
if not hasattr(args, "hub_model_id") or args.hub_model_id is None:
116116
model_name = Path(args.output_dir).name
117117
else:
118118
model_name = args.hub_model_id.split("/")[-1]
@@ -123,7 +123,7 @@ def push_to_hub(
123123
pipeline.save_pretrained(output_dir)
124124

125125
# Only push from one node.
126-
if not hasattr(args, "local_rank") or args.local_rank not in [-1, 0]:
126+
if hasattr(args, "local_rank") and args.local_rank not in [-1, 0]:
127127
return
128128

129129
# Cancel any async push in progress if blocking=True. The commits will all be pushed together.

0 commit comments

Comments
 (0)