YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
I-JEPA deepfake detectors (per generator)
Fine-tune facebook/ijepa_vith14_1k (ViT-H/14) as a binary fake vs real detector, one model per generator.
Protocol
For each trainable generator G โADM, BigGAN, Midjourney, VQDM, glide, wukong, stable_diffusion_v_1_4, stable_diffusion_v_1_5, imagenetv3:
| Split | Fakes | Reals |
|---|---|---|
| Train | dataset/G/train/ai |
dataset/train_nature (shared) |
| Eval | every dataset/*/val/ai |
matching val/nature or val/real |
- Never train on
flux2ordrifting(test-only / OOD). - Labels:
0 = real,1 = fake. - A 10% train holdout is used only for in-run monitoring (not a GenImage holdout).
Dual-GPU launch (not DDP)
run_all.py starts one process per GPU. Each process:
- sets
CUDA_VISIBLE_DEVICES=<gpu> - trains + evaluates one detector
- shuts down DataLoader workers and frees CUDA
- pulls the next unfinished generator until the queue is empty
Training uses a 5% balanced holdout from train/ai + train_nature (metric=acc, patience=4, checks every 1000 steps, max 1 epoch). Classes are balanced 50/50.
imagenetv3-only extras (other generators unchanged):
- no patience (full epoch)
- LR hypertune on a small split (
2k/class, 800 steps,1e-5โฆ1e-4) - after training, pick last-epoch vs best-holdout on its own
valsplit
cd /home/themis/workspace_firas/appli/i-jepa
conda activate test # or any env with torch + transformers
pip install -r requirements.txt
# full sweep on GPU 0 and GPU 1
python run_all.py --gpus 0,1
# retrain ADM only (overwrite broken checkpoint)
python train.py --generator ADM --device cuda:0 --force
# smoke test
python run_all.py --gpus 0,1 --limit-per-class 200 --epochs 1
# subset
python run_all.py --gpus 0,1 --generators ADM,BigGAN
Single-generator (one GPU):
python train.py --generator ADM --device cuda:0
Metrics
- Accuracy: argmax over 2-class logits
- AUROC: ranking score = MSP (
maxsoftmax probability), against labels0=real,1=fake
To recompute AUROC with MSP for already-trained detectors (rewrites metrics.json / CSVs):
python recompute_auroc_msp.py --gpus 0,1
# or single GPU:
python recompute_auroc_msp.py --device cuda:0
Outputs
runs/<generator>/
detector.pt
train_log.json
metrics.json
metrics.csv
runs/summary_auroc.csv
runs/summary_acc.csv
Resume-safe:
- If
runs/<gen>/detector.ptexists โ training is skipped - If
runs/<gen>/metrics.jsonalso exists โ eval is skipped (job fully done) - If only the detector exists โ eval-only resume
- Use
--forceto retrain + re-eval from scratch
Memory / workers
- Default
--batch-size 8+--amp bf16for ViT-H. Raise batch if VRAM allows. --num-workers 2withpersistent_workers=False; workers are shut down after every job.- Optional
--freeze-backbonefor a linear probe (much lighter).
Layout
| File | Role |
|---|---|
config.py |
paths + hyperparameters |
data.py |
train/eval loaders |
model.py |
I-JEPA binary detector |
train.py |
train + cross-generator eval |
cleanup.py |
DataLoader / CUDA teardown |
run_all.py |
multi-GPU job queue |
upload_ijepa_hf.py |
upload this folder (code + runs/) to Hugging Face |
Upload to Hugging Face
cd /home/themis/workspace_firas/appli/i-jepa
export HF_TOKEN=hf_...
python upload_ijepa_hf.py --repo-id fira7s/ijepa
# private / dataset / resumable workers:
python upload_ijepa_hf.py --repo-id fira7s/ijepa --private --num-workers 4
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support