mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-09 06:45:09 +00:00
small fix
This commit is contained in:
@@ -14,12 +14,12 @@ def fire_in_thread(f):
|
|||||||
|
|
||||||
|
|
||||||
def huggingface_exists_repo(
|
def huggingface_exists_repo(
|
||||||
repo_id: str, repo_type: str, revision: str = "main", hf_token: str = None
|
repo_id: str, repo_type: str, revision: str = "main", token: str = None
|
||||||
):
|
):
|
||||||
api = HfApi()
|
api = HfApi()
|
||||||
try:
|
try:
|
||||||
api.repo_info(
|
api.repo_info(
|
||||||
repo_id=repo_id, token=hf_token, revision=revision, repo_type=repo_type
|
repo_id=repo_id, token=token, revision=revision, repo_type=repo_type
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
@@ -34,15 +34,15 @@ def huggingface_upload(
|
|||||||
):
|
):
|
||||||
repo_id = args.huggingface_repo_id
|
repo_id = args.huggingface_repo_id
|
||||||
repo_type = args.huggingface_repo_type
|
repo_type = args.huggingface_repo_type
|
||||||
hf_token = args.huggingface_token
|
token = args.huggingface_token
|
||||||
path_in_repo = args.huggingface_path_in_repo + dest_suffix
|
path_in_repo = args.huggingface_path_in_repo + dest_suffix
|
||||||
private = args.huggingface_repo_visibility == "private"
|
private = args.huggingface_repo_visibility == "private"
|
||||||
api = HfApi()
|
api = HfApi()
|
||||||
if not huggingface_exists_repo(
|
if not huggingface_exists_repo(
|
||||||
repo_id=repo_id, repo_type=repo_type, token=hf_token
|
repo_id=repo_id, repo_type=repo_type, token=token
|
||||||
):
|
):
|
||||||
api.create_repo(
|
api.create_repo(
|
||||||
token=hf_token, repo_id=repo_id, repo_type=repo_type, private=private
|
token=token, repo_id=repo_id, repo_type=repo_type, private=private
|
||||||
)
|
)
|
||||||
|
|
||||||
is_folder = (type(src) == str and os.path.isdir(src)) or (
|
is_folder = (type(src) == str and os.path.isdir(src)) or (
|
||||||
@@ -54,7 +54,7 @@ def huggingface_upload(
|
|||||||
repo_type=repo_type,
|
repo_type=repo_type,
|
||||||
folder_path=src,
|
folder_path=src,
|
||||||
path_in_repo=path_in_repo,
|
path_in_repo=path_in_repo,
|
||||||
token=hf_token,
|
token=token,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
api.upload_file(
|
api.upload_file(
|
||||||
@@ -62,5 +62,5 @@ def huggingface_upload(
|
|||||||
repo_type=repo_type,
|
repo_type=repo_type,
|
||||||
path_or_fileobj=src,
|
path_or_fileobj=src,
|
||||||
path_in_repo=path_in_repo,
|
path_in_repo=path_in_repo,
|
||||||
token=hf_token,
|
token=token,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user