Skip to content

Commit c607d4f

Browse files
ebrlstein
authored andcommitted
(config) clarify why we're setting the env var
1 parent 6d6076d commit c607d4f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

scripts/configure_invokeai.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ def download_weights(opt:dict) -> Union[str, None]:
536536
if not (access_token := HfFolder.get_token()):
537537
# 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)
538538
if (access_token := os.getenv("HUGGINGFACE_TOKEN")):
539+
# set the environment variable here instead of simply calling huggingface_hub.login(token), to maintain consistent behaviour.
540+
# 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.
539541
os.environ['HUGGING_FACE_HUB_TOKEN'] = access_token
540542

541543
if opt.yes_to_all:

0 commit comments

Comments
 (0)