Line art (informative-drawings)
Informative-drawings line art (MIT CSAIL, CVPR 2022), as packaged for ControlNet: draws the lines of a photo as a sketch-like map, the input of the line-art ControlNet; a fine and a coarse version. MIT code and weights.
experimental Fork of huggingface/controlnet_aux@b1aac31 · backends: portable, kernels
- Paper Learning to generate line drawings that convey geometry and semantics CVPR 2022 · first released 23 Mar 2022
- Paper Adding Conditional Control to Text-to-Image Diffusion Models ICCV 2023 · first released 10 Feb 2023
Paper 2022 Added in 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import edges
model = edges.load("lineart") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.edges
result.backend # what ran: mode, device, dtype, kernels fastforks bench lineart Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c lineart, host OpenCV resize, float post-processing | fp16 | 29.8 | – | 221 MiB/264 MiB | 0.1 | 0.03 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 18.3 | 1.6× | 222 MiB/284 MiB | 0.2 | 0.02 |
| Kernels | not measured | – | – | – | – | |
| Portable + torch.compile | not measured here | – | – | – | – | |
| TensorRT | not measured here | – | – | – | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 114 | 1,481 MiB process | – | 1024x1024 |
| Portable | fp16 | 66.5 | 1,362 MiB process | matches | 1024x1024 | |
| Portable | fp32 | 95.8 | 1,361 MiB process | matches | 1024x1024 | |
| Kernels | fp32 | not implemented | – | 1024x1024 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- MIT LICENSE
- Weights
- MIT (assumed from code)(not stated by the authors; assumed to follow the code) source
- Training data
- Not stated for these checkpoints (lllyasviel/Annotators, ControlNet 1.1); informative-drawings trains on unpaired photographs and line drawings.
- weights licence not stated by the original authors; assumed to be the code licence
Our reading of the licences, not legal advice.
Weights
sk_model.pth 17.2 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download lineart).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
Accuracy not measured for lineart.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output edges).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 | 0.00011 |
| GPU default dtypes, p99 |diff| | ≤ 0.25 | 0.00078 |
Recorded for lineart on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: cudnn_hacccutlass_convigevvol_norm
Details
Line art preprocessor of ControlNet 1.1 (controlnet_aux `LineartDetector`, ComfyUI's "Realistic Lineart"): the informative-drawings generator (Chan, Durand and Isola, CVPR 2022; 3 residual blocks, instance norm) turns a photo into a line drawing. `lineart` is the realistic model, `lineart-coarse` the coarse one.
- Input / output
- Input: one RGB image. Output: a line / edge map
[H, W]in [0, 1] at the input size (1 = line), the ControlNet preprocessors (line art, HED, PiDiNet, TEED / Anyline); M-LSD also returns straight line segments. - Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 1080x1920 (222 MiB allocated)
- Options
short_side=512>= 64· changes the output
- Outputs
edges- CUDA kernels
vol_norminstance norm and LeakyReLU on 3D volumesigevIGEV stereo: convolution epilogues, correlation lookups, GRU gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Full reference, generated from the repository
Informative-drawings line art (MIT CSAIL, CVPR 2022), as packaged for ControlNet: draws the lines of a photo as a sketch-like map, the input of the line-art ControlNet; a fine and a coarse version. MIT code and weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
lineart | synthetic (1080x1920) | original portable kernels | 29.8 18.3 – | 221 / 264 222 / 284 – |
lineart | synthetic (1024x1024) | original portable kernels portable + torch.compile TensorRT fp16 | 15.7 9.93 – 6.49 4.80 | 141 / 186 129 / 164 – 117 / 164 150 / 176 |
lineart-coarse | synthetic (1080x1920) | original portable kernels | 30.4 18.3 – | 221 / 264 222 / 284 – |
lineart-coarse | synthetic (1024x1024) | original portable kernels portable + torch.compile TensorRT fp16 | 15.8 9.92 – 6.49 4.80 | 141 / 186 129 / 164 – 117 / 164 150 / 176 |
Details
- Original code: https://github.com/huggingface/controlnet_aux at
b1aac318b15c - Code licence: MIT (permissive); files:
LICENSE - Weights licence: MIT (assumed from code)
- Licence evidence: https://github.com/huggingface/controlnet_aux/blob/b1aac318b15c4e65a21bc516dc236ad4bf593d46/src/controlnet_aux/lineart/LICENSE ; https://huggingface.co/lllyasviel/Annotators
- Training data: Not stated for these checkpoints (lllyasviel/Annotators, ControlNet 1.1); informative-drawings trains on unpaired photographs and line drawings.
- Options:
short_side= 512 (>= 64; alsoresolution; alsodetect_resolution) - Kernel libraries:
vol_norm,igev,cutlass_conv,cudnn_hacc - Variants:
lineart,lineart-coarse - Outputs: edges
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
lineart1080x1920 (0.2 GiB peak allocated, 0.3 reserved);lineart-coarse1080x1920 (0.2 GiB peak allocated, 0.3 reserved) lineart1024x1024, first call: portable + torch.compile 10 s (cold Inductor cache), TensorRT fp16 10 s (ONNX + engine).lineart-coarse1024x1024, first call: portable + torch.compile 10 s (cold Inductor cache), TensorRT fp16 10 s (ONNX + engine).lineartoriginal 1080x1920, original 1024x1024: torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c lineart, host OpenCV resize, float post-processinglineart-coarseoriginal 1080x1920, original 1024x1024: torch.autocast(float16) around the call; huggingface/controlnet_aux@b1aac318b15c lineart, host OpenCV resize, float post-processinglineartload / first call: original 0.65 s / 0.049 s, portable 0.16 s / 0.019 slineart-coarseload / first call: original 0.16 s / 0.048 s, portable 0.16 s / 0.019 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Parity
CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output edges).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
lineart | 0.00011 / 0.00078 | RTX 5060 Ti, torch 2.10.0+cu130 | cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120, vol_norm@44036d4da567:sm_120 |
lineart-coarse | 0.00013 / 0.00103 | RTX 5060 Ti, torch 2.10.0+cu130 | cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120, vol_norm@44036d4da567:sm_120 |
Example output
No example rendered for this checkpoint yet.