Download common.py from weathon/DecoyFace: direct link, hf CLI and curl.
- Browser
- Download file 896 Bytes
-
https://huggingface.co/weathon/DecoyFace/resolve/main/common.py
- Command line
-
hf download hf://weathon/DecoyFace/common.py
-
curl -L -o common.py https://huggingface.co/weathon/DecoyFace/resolve/main/common.py
896 Bytes
| """Shared config and paths for DecoyFace.""" | |
| from pathlib import Path | |
| import torch | |
| CKPT = Path(__file__).resolve().parent / "checkpoints" | |
| ADAFACE_CKPT = CKPT / "adaface_ir50_ms1mv2.backbone.pth" | |
| # DecoyFace hyper-parameters (paper Sec. V-B "Implementation Details"). | |
| CFG = { | |
| "C": 64, | |
| "r": 32, # RSS rank | |
| "G": 16, # groups | |
| "K": 3, # preserved true-sample groups | |
| "M": 5000, # auxiliary complementary bank size | |
| "sc_lo": 8, "sc_hi": 12, # coherent subset size s_c ~ U[8,12] | |
| "L_lo": 2, "L_hi": 4, # shared source count L ~ U[2,4] | |
| "t": 3, # random scale exponent k ~ U[-3,3] | |
| "q": 0.95, # quantile | |
| "tau_s": 0.8, # server target magnitude | |
| "eps": 1e-6, | |
| } | |
| DEVICE = "cuda:0" | |
| def fixed_perm(C=64, seed=1234): | |
| g = torch.Generator().manual_seed(seed) | |
| return torch.randperm(C, generator=g) | |