mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
(config) clarify why we're setting the env var
This commit is contained in:
committed by
Lincoln Stein
parent
6d6076d3c7
commit
c607d4fe6c
@ -536,6 +536,8 @@ def download_weights(opt:dict) -> Union[str, None]:
|
|||||||
if not (access_token := HfFolder.get_token()):
|
if not (access_token := HfFolder.get_token()):
|
||||||
# If unable to find an existing token or expected environment, try the non-canonical environment variable (widely used in the community and supported as per docs)
|
# If unable to find an existing token or expected environment, try the non-canonical environment variable (widely used in the community and supported as per docs)
|
||||||
if (access_token := os.getenv("HUGGINGFACE_TOKEN")):
|
if (access_token := os.getenv("HUGGINGFACE_TOKEN")):
|
||||||
|
# set the environment variable here instead of simply calling huggingface_hub.login(token), to maintain consistent behaviour.
|
||||||
|
# when calling the .login() method, the token is cached in the user's home directory. When the env var is used, the token is NOT cached.
|
||||||
os.environ['HUGGING_FACE_HUB_TOKEN'] = access_token
|
os.environ['HUGGING_FACE_HUB_TOKEN'] = access_token
|
||||||
|
|
||||||
if opt.yes_to_all:
|
if opt.yes_to_all:
|
||||||
|
Reference in New Issue
Block a user