Instructions to use minchul/cvlface_adaface_ir50_ms1mv2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use minchul/cvlface_adaface_ir50_ms1mv2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="minchul/cvlface_adaface_ir50_ms1mv2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("minchul/cvlface_adaface_ir50_ms1mv2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload directory
Browse files
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
arxiv: 2204.00964
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
<div align="center">
|
| 8 |
+
<h1>
|
| 9 |
+
CVLFace Pretrained Model (ADAFACE IR50 MS1MV2)
|
| 10 |
+
</h1>
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
<p align="center">
|
| 15 |
+
🌎 <a href="https://github.com/mk-minchul/CVLface" target="_blank">GitHub</a> • 🤗 <a href="https://huggingface.co/minchul" target="_blank">Hugging Face</a>
|
| 16 |
+
</p>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
-----
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
## 1. Introduction
|
| 23 |
+
|
| 24 |
+
Model Name: ADAFACE IR50 MS1MV2
|
| 25 |
+
|
| 26 |
+
Related Paper: AdaFace: Quality Adaptive Margin for Face Recognition (https://arxiv.org/abs/2204.00964)
|
| 27 |
+
|
| 28 |
+
Please cite the orignal paper and follow the license of the training dataset.
|
| 29 |
+
|
| 30 |
+
## 2. Quick Start
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from transformers import AutoModel
|
| 34 |
+
from huggingface_hub import hf_hub_download
|
| 35 |
+
import shutil
|
| 36 |
+
import os
|
| 37 |
+
import torch
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# helpfer function to download huggingface repo and use model
|
| 41 |
+
def download(repo_id, path, HF_TOKEN=None):
|
| 42 |
+
files_path = os.path.join(path, 'files.txt')
|
| 43 |
+
if not os.path.exists(files_path):
|
| 44 |
+
hf_hub_download(repo_id, 'files.txt', token=HF_TOKEN, local_dir=path, local_dir_use_symlinks=False)
|
| 45 |
+
with open(os.path.join(path, 'files.txt'), 'r') as f:
|
| 46 |
+
files = f.read().split('\n')
|
| 47 |
+
for file in [f for f in files if f] + ['config.json', 'wrapper.py', 'model.safetensors']:
|
| 48 |
+
full_path = os.path.join(path, file)
|
| 49 |
+
if not os.path.exists(full_path):
|
| 50 |
+
hf_hub_download(repo_id, file, token=HF_TOKEN, local_dir=path, local_dir_use_symlinks=False)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# helpfer function to download huggingface repo and use model
|
| 54 |
+
def load_model_from_local_path(path, HF_TOKEN=None):
|
| 55 |
+
cwd = os.getcwd()
|
| 56 |
+
os.chdir(path)
|
| 57 |
+
model = AutoModel.from_pretrained(path, trust_remote_code=True, token=HF_TOKEN)
|
| 58 |
+
os.chdir(cwd)
|
| 59 |
+
return model
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
# helpfer function to download huggingface repo and use model
|
| 63 |
+
def load_model_by_repo_id(repo_id, save_path, HF_TOKEN=None, force_download=False):
|
| 64 |
+
if force_download:
|
| 65 |
+
if os.path.exists(save_path):
|
| 66 |
+
shutil.rmtree(save_path)
|
| 67 |
+
download(repo_id, save_path, HF_TOKEN)
|
| 68 |
+
return load_model_from_local_path(save_path, HF_TOKEN)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
if __name__ == '__main__':
|
| 72 |
+
HF_TOKEN = 'YOUR_HUGGINGFACE_TOKEN'
|
| 73 |
+
path = 'path/to/store/model/locally'
|
| 74 |
+
repo_id = 'minchul/cvlface_adaface_ir50_ms1mv2'
|
| 75 |
+
model = load_model_by_repo_id(repo_id, path, HF_TOKEN)
|
| 76 |
+
input = torch.randn(1, 3, 112, 112)
|
| 77 |
+
out = model(input)
|
| 78 |
+
```
|
| 79 |
+
|