Model reference · open weights
cvlface_adaface_ir101_webface12m is an open-weight embedding model from minchul. cvlface_adaface_ir101_webface12m (FP32) weighs 130 MB; the smallest configuration that runs it is RTX 3060 12 GB.
What it is
| Released by | minchul |
|---|---|
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 65M |
| Runs with | transformers |
| Released | 2024-06-06 |
| Popularity | 891 downloads / month |
| Weights | 130 MB (cvlface_adaface_ir101_webface12m (FP32), file size) |
| Licence | Licence not stated |
What it runs on
Weights 130 MB (file size) · overhead about 1.1 GB.
| Card | Runs | Counted memory |
|---|---|---|
| RTX 3060 12 GB | fits | 11.6 GB |
| RTX 4060 Ti 16 GB | fits | 15.4 GB |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
Estimates, not measurements: the weights are the build's file size. No cache grows with use; a batch of inputs needs working memory of its own. Counted memory is 92 % of what CUDA reports for the card.
From the model card
CVLFace Pretrained Model (ADAFACE IR101 WEBFACE12M)
🌎 GitHub • 🤗 Hugging Face
Model Name: ADAFACE IR101 WEBFACE12M
Related Paper: AdaFace: Quality Adaptive Margin for Face Recognition (https://arxiv.org/abs/2204.00964)
Please cite the orignal paper and follow the license of the training dataset.
from transformers import AutoModel
from huggingface_hub import hf_hub_download
import shutil
import os
import torch
import sys
# helpfer function to download huggingface repo and use model
def download(repo_id, path, HF_TOKEN=None):
os.makedirs(path, exist_ok=True)
files_path = os.path.join(path, 'files.txt')
if not os.path.exists(files_path):
hf_hub_download(repo_id, 'files.txt', token=HF_TOKEN, local_dir=path, local_dir_use_symlinks=False)
with open(os.path.join(path, 'files.txt'), 'r') as f:
files = f.read().split('\n')
for file in [f for f in files if f] + ['config.json', 'wrapper.py', 'model.safetensors']:
full_path = os.path.join(path, file)
if not os.path.exists(full_path):
hf_hub_download(repo_id, file, token=HF_TOKEN, local_dir=path, local_dir_use_symlinks=False)
# helpfer function to download huggingface repo and use model
def load_model_from_local_path(path, HF_TOKEN=None):
cwd = os.getcwd()
os.chdir(path)
sys.path.insert(0, path)
model = AutoModel.from_pretrained(path, trust_remote_code=True, token=HF_TOKEN)
os.chdir(cwd)
sys.path.pop(0)
return model
# helpfer function to download huggingface repo and use model
def load_model_by_repo_id(repo_id, save_path, HF_TOKEN=None, force_download=False):
if force_download:
if os.path.exists(save_path):
shutil.rmtree(save_path)
download(repo_id, save_path, HF_TOKEN)
return load_model_from_local_path(save_path, HF_TOKEN)
if __name__ == '__main__':
HF_TOKEN = 'YOUR_HUGGINGFACE_TOKEN'
path = os.path.expanduser('~/.cvlface_cache/minchul/cvlface_adaface_ir101_webface12m')
repo_id = 'minchul/cvlface_adaface_ir101_webface12m'
model = load_model_by_repo_id(repo_id, path, HF_TOKEN)
# input is a rgb image normalized.
from torchvision.transforms import Compose, ToTensor, Normalize
from PIL import Image
img = Image.open('path/to/image.jpg')
trans = Compose([ToTensor(), Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])])
input = trans(img).unsqueeze(0) # torch.randn(1, 3, 112, 112)
out = model(input)
Quoted from the model card on Hugging Face — the full card is behind the Hugging Face link above.