From 3768676e3128fe3ce67f78613a404462f98ffc40 Mon Sep 17 00:00:00 2001 From: "mulin.lyh" Date: Wed, 26 Jun 2024 18:19:10 +0800 Subject: [PATCH] fix logging dup --- modelscope/hub/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modelscope/hub/api.py b/modelscope/hub/api.py index 5ed4ed99..717264dd 100644 --- a/modelscope/hub/api.py +++ b/modelscope/hub/api.py @@ -1086,6 +1086,7 @@ class ModelScopeConfig: GIT_TOKEN_FILE_NAME = 'git_token' USER_INFO_FILE_NAME = 'user' USER_SESSION_ID_FILE_NAME = 'session' + cookie_expired_warning = False @staticmethod def make_sure_credential_path_exist(): @@ -1107,8 +1108,9 @@ class ModelScopeConfig: with open(cookies_path, 'rb') as f: cookies = pickle.load(f) for cookie in cookies: - if cookie.is_expired(): - logger.debug( + if cookie.is_expired() and not ModelScopeConfig.cookie_expired_warning: + ModelScopeConfig.cookie_expired_warning = True + logger.warning( 'Authentication has expired, ' 'please re-login if you need to access private models or datasets.') return None