edit : hugging face login 로컬에 로그인되어있으면 무시
This commit is contained in:
@@ -31,6 +31,8 @@ import os, sys
|
||||
|
||||
from transformers import CLIPProcessor, CLIPModel
|
||||
from huggingface_hub import login as huggingface_login
|
||||
from huggingface_hub import whoami, logout
|
||||
from huggingface_hub.utils import LocalTokenNotFoundError
|
||||
|
||||
"""
|
||||
Package: custom
|
||||
@@ -104,7 +106,18 @@ class FEOpenAIClipViT(FEM.FeatureExtractionModel):
|
||||
|
||||
# huggingface token
|
||||
if self.huggingface_token:
|
||||
huggingface_login(fem_arguments.token)
|
||||
"""
|
||||
토큰이 있다면 로그인이 되어있는지 확인
|
||||
안되어있다면 로그인 시도
|
||||
"""
|
||||
try:
|
||||
user_info = whoami()
|
||||
except Exception as LocalTokenNotFoundError:
|
||||
huggingface_login(fem_arguments.token)
|
||||
|
||||
except Exception as e:
|
||||
log.error(f'Huggingface login error: {e}')
|
||||
raise e
|
||||
|
||||
# model path check
|
||||
if not os.path.exists(fem_arguments.trained_model):
|
||||
|
||||
Reference in New Issue
Block a user