사용법
# pip install open_clip_torch huggingface_hub safetensors
import json, torch, open_clip
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
repo = "2lY0/wearlystyle" # 비공개 저장소면 먼저 `huggingface-cli login`
cfg = json.load(open(hf_hub_download(repo, "musinsa_clip_config.json")))
model, _, preprocess = open_clip.create_model_and_transforms(cfg["model"], pretrained=None)
model.load_state_dict(load_file(hf_hub_download(repo, "model.safetensors"))); model.eval()
tok = open_clip.get_tokenizer(cfg["model"])
texts = [cfg["templates"][0].format(cfg["en_phrase"][c]) for c in cfg["classes"]]