remove hf_access_token check

This commit is contained in:
Qing 2023-01-08 20:59:55 +08:00
parent 9de96a09c2
commit 51e0be2c96

View File

@ -21,7 +21,7 @@ def parse_args():
parser.add_argument( parser.add_argument(
"--hf_access_token", "--hf_access_token",
default="", default="",
help="Huggingface access token. Check how to get token from: https://huggingface.co/docs/hub/security-tokens", help="SD model no more need token: https://github.com/huggingface/diffusers/issues/1447",
) )
parser.add_argument( parser.add_argument(
"--sd-disable-nsfw", "--sd-disable-nsfw",
@ -36,7 +36,7 @@ def parse_args():
parser.add_argument( parser.add_argument(
"--sd-run-local", "--sd-run-local",
action="store_true", action="store_true",
help="After first time Stable Diffusion model downloaded, you can add this arg and remove --hf_access_token.", help="SD model no more need token, use --local-files-only to set not connect to huggingface server",
) )
parser.add_argument( parser.add_argument(
"--local-files-only", "--local-files-only",
@ -87,10 +87,4 @@ def parse_args():
if not output_dir.is_dir(): if not output_dir.is_dir():
parser.error(f"invalid --output-dir: {output_dir} is not a directory") parser.error(f"invalid --output-dir: {output_dir} is not a directory")
if args.model == 'sd1.5' and not (args.sd_run_local or args.local_files_only):
if not args.hf_access_token.startswith("hf_"):
parser.error(
f"sd(stable-diffusion) model requires huggingface access token. Check how to get token from: https://huggingface.co/docs/hub/security-tokens"
)
return args return args