Model files in memory-mappable formats (such as safetensors) can be mapped into the address space: pages load lazily on first access through the page cache, avoid an extra copy, and are shared between processes using the same file, so loading and starting many workers is faster and uses less RAM.
The first load reads from disk (cold cache) and later loads are fast (warm cache); this explains why a second run often starts much faster.
If the file does not fit in RAM, you get constant page faults and thrashing, so check available memory, and for big datasets prefer streaming or memory-mapped arrays.
Loading…