Models / vit
nsfw_image_detection: GPU memory to fine-tune
Fine-tuning nsfw_image_detection at batch 1 takes about 98.5 GB of GPU memory for a full fine-tune (borderline on one H200 141 GB), and 96.5 GB with LoRA r=16 on a bf16 base (borderline on one H200 141 GB). Estimated from the model's structure, not measured. What fits on which card.
Reconstructed from its own config.json
with no weights read. 4.1M downloads on Hugging Face.
Our count against the checkpoint
The left number comes from the graph. The right one is the number of scalars in the published weight files. Nothing on this page was tuned to make them agree.
What it costs to run
Cost is a roofline estimate on the priced GPU for 10 epochs at batch 32 over 50,000 samples (assumed; no dataset attached).
Memory: what fits on which card
Largest batch per card. Training is sized at the input shape below per sample.
| Card | Full fine-tune | LoRA r=16 |
|---|---|---|
| T4 16 GB | does not fit at batch 1 | does not fit at batch 1 |
| L4 24 GB | does not fit at batch 1 | does not fit at batch 1 |
| A100 40 GB | does not fit at batch 1 | does not fit at batch 1 |
| A100 / H100 80 GB | does not fit at batch 1 | does not fit at batch 1 |
| H200 141 GB | batch 1, borderline | batch 1, borderline |
Training: the input shape in the structure table, AdamW with bf16 autocast, SDPA attention (no score matrix stored), 1.15x headroom on every card. Full fine-tune holds weights, gradients and optimizer state (1.2 x 16 bytes per parameter) plus activations. LoRA is r=16 on every linear layer but the head, base frozen in bf16 (2 bytes per parameter), adapters at full AdamW state, same activations. A two-card split is a contiguous layer cut (pipeline parallel), computed only where one card cannot hold batch 1. "Borderline" means the card holds batch 1 on the estimate but not on the conservative peak (the estimate x 1.43, at or above the measured peak on 95% of held-out runs): measure one step before reserving it.
These are estimates from the graph, not measurements. Against measured runs, held out by architecture, the estimate flagged 113 of the 131 jobs that did not fit their card and said "fits" on the other 18. Every measured run.
Structure
76 nodes. Output shapes are propagated from the input shape, batch dimension excluded.
| Layer | Type | Output shape | |
|---|---|---|---|
| 1 | Input | Input | 3 × 224 × 224 |
| 2 | Embedding | Embedding | 3 × 224 × 224 × 768 |
| 3 | Positional_Embedding | Learned Pos Embed | 3 × 224 × 224 × 768 |
| 4 | LayerNorm_1_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 5 | Attention_1 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 6 | Add_1_attn | Add | 3 × 224 × 224 × 768 |
| 7 | LayerNorm_1_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 8 | FFN_1 | Feed Forward | 3 × 224 × 224 × 768 |
| 9 | Add_1_ffn | Add | 3 × 224 × 224 × 768 |
| 10 | LayerNorm_2_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 11 | Attention_2 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 12 | Add_2_attn | Add | 3 × 224 × 224 × 768 |
| 13 | LayerNorm_2_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 14 | FFN_2 | Feed Forward | 3 × 224 × 224 × 768 |
| 15 | Add_2_ffn | Add | 3 × 224 × 224 × 768 |
| 16 | LayerNorm_3_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 17 | Attention_3 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 18 | Add_3_attn | Add | 3 × 224 × 224 × 768 |
| 19 | LayerNorm_3_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 20 | FFN_3 | Feed Forward | 3 × 224 × 224 × 768 |
| 21 | Add_3_ffn | Add | 3 × 224 × 224 × 768 |
| 22 | LayerNorm_4_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 23 | Attention_4 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 24 | Add_4_attn | Add | 3 × 224 × 224 × 768 |
| 25 | LayerNorm_4_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 26 | FFN_4 | Feed Forward | 3 × 224 × 224 × 768 |
| 27 | Add_4_ffn | Add | 3 × 224 × 224 × 768 |
| 28 | LayerNorm_5_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 29 | Attention_5 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 30 | Add_5_attn | Add | 3 × 224 × 224 × 768 |
| 31 | LayerNorm_5_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 32 | FFN_5 | Feed Forward | 3 × 224 × 224 × 768 |
| 33 | Add_5_ffn | Add | 3 × 224 × 224 × 768 |
| 34 | LayerNorm_6_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 35 | Attention_6 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 36 | Add_6_attn | Add | 3 × 224 × 224 × 768 |
| 37 | LayerNorm_6_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 38 | FFN_6 | Feed Forward | 3 × 224 × 224 × 768 |
| 39 | Add_6_ffn | Add | 3 × 224 × 224 × 768 |
| 40 | LayerNorm_7_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 41 | Attention_7 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 42 | Add_7_attn | Add | 3 × 224 × 224 × 768 |
| 43 | LayerNorm_7_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 44 | FFN_7 | Feed Forward | 3 × 224 × 224 × 768 |
| 45 | Add_7_ffn | Add | 3 × 224 × 224 × 768 |
| 46 | LayerNorm_8_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 47 | Attention_8 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 48 | Add_8_attn | Add | 3 × 224 × 224 × 768 |
| 49 | LayerNorm_8_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 50 | FFN_8 | Feed Forward | 3 × 224 × 224 × 768 |
| 51 | Add_8_ffn | Add | 3 × 224 × 224 × 768 |
| 52 | LayerNorm_9_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 53 | Attention_9 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 54 | Add_9_attn | Add | 3 × 224 × 224 × 768 |
| 55 | LayerNorm_9_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 56 | FFN_9 | Feed Forward | 3 × 224 × 224 × 768 |
| 57 | Add_9_ffn | Add | 3 × 224 × 224 × 768 |
| 58 | LayerNorm_10_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 59 | Attention_10 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 60 | Add_10_attn | Add | 3 × 224 × 224 × 768 |
| 61 | LayerNorm_10_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 62 | FFN_10 | Feed Forward | 3 × 224 × 224 × 768 |
| 63 | Add_10_ffn | Add | 3 × 224 × 224 × 768 |
| 64 | LayerNorm_11_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 65 | Attention_11 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 66 | Add_11_attn | Add | 3 × 224 × 224 × 768 |
| 67 | LayerNorm_11_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 68 | FFN_11 | Feed Forward | 3 × 224 × 224 × 768 |
| 69 | Add_11_ffn | Add | 3 × 224 × 224 × 768 |
| 70 | LayerNorm_12_1 | LayerNorm | 3 × 224 × 224 × 768 |
| 71 | Attention_12 | Multi-Head Attention | 3 × 224 × 224 × 768 |
| 72 | Add_12_attn | Add | 3 × 224 × 224 × 768 |
| 73 | LayerNorm_12_2 | LayerNorm | 3 × 224 × 224 × 768 |
| 74 | FFN_12 | Feed Forward | 3 × 224 × 224 × 768 |
| 75 | Add_12_ffn | Add | 3 × 224 × 224 × 768 |
| 76 | Output | Output | 3 × 224 × 224 × 768 |
What the verifier says
deep-attention-default-init
What changed upstream
The change tracker follows Falconsai/nsfw_image_detection: every revision it has read, what changed in the config, tokenizer, chat template or weights between them, and an OSV advisory per change.
Do this to your own model
Same numbers, on a model in your repo, in one command. No account.
pip install neurarch-trace
neurarch-trace Falconsai/nsfw_image_detection --plan --share