Cap cpu-fast lane at attn_query_chunk 512 for the 8 GB server
Config-only tuning of the temporary CPU lane (no pipeline/code change). Query chunk 512 trims ViTMatte's attention transient ~0.9 GB at 2048x2048 (8.0 -> 7.1 GB peak working set) with bitwise-identical output; 256 gives nothing more. The remaining ~7.1 GB floor is attributed to ViTMatte's detail-capture decoder (backbone stage peaks 4.6 GB, decoder 7.1 GB, pymatting only 0.08 GB), so it is not further reducible by attention chunking -- noted for a possible future decoder-tiling pass. Accepted as-is for the 8 GB box. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,11 +4,22 @@
|
||||
# per 1.5 MP image on CPU. It needs ONLY these two weights provisioned --
|
||||
# BiRefNet_HR-matting (cross-check) and anime-seg are never loaded.
|
||||
#
|
||||
# Tuned for an 8 GB box (~7 GB for the service). Measured peak working set:
|
||||
# 2048x1152 (2.4 MP) ~5.6 GB | 2048x2048 (4.2 MP) ~7.1 GB.
|
||||
# The 2048x2048 peak is a floor set by ViTMatte's own dense compute, not the
|
||||
# attention (shrinking the chunk below 512 does not lower it further). Set
|
||||
# MemoryMax=8G with a hard 4 MP input cap (BGFILTER_MAX_IMAGE_PIXELS default),
|
||||
# or cap inputs tighter if you need more headroom.
|
||||
#
|
||||
# Anything omitted here inherits the built-in defaults (identical to default.yaml).
|
||||
|
||||
model:
|
||||
device: cpu
|
||||
precision: fp32 # fp32 only: this lane targets non-bf16 CPUs
|
||||
# Query chunk of 512 (vs the 2048 default) trims ViTMatte's attention transient
|
||||
# ~0.9 GB at 2048x2048 (8.0 -> 7.1 GB) for ~1 s more compute; 256 gives nothing
|
||||
# more. Exact/bitwise-identical output -- purely a memory-vs-speed knob.
|
||||
attn_query_chunk: 512
|
||||
|
||||
segmentation:
|
||||
enabled: true
|
||||
|
||||
Reference in New Issue
Block a user