Measure where model-load time goes
CPU · your Macscript90 minrequiredGoal · Produce a table of cold versus warm load times for a 1-3 GB model and explain each number with page-cache and bandwidth measurements.
- 1In a Linux VM or Docker container on your Mac (or a free Colab CPU runtime), download a safetensors model of 1-3 GB (for example Qwen2.5-0.5B or TinyLlama).
- 2Measure storage read bandwidth with dd or fio on the same disk; record MB/s.
- 3Drop the page cache (echo 3 > /proc/sys/vm/drop_caches as root, or restart the container) and time a cold load with transformers; then time a second, warm load.
- 4Use vmtouch or fincore to show how much of the file is cached before and after each load.
- 5Repeat the cold load with safetensors memory-mapping versus a plain torch.load of the same weights converted to .bin; compare.
- 6Record peak RSS with /usr/bin/time -v for each variant and explain the difference between mmap and read.
- 7Write the table and a paragraph predicting the cold load time for a 15 GB model on the same disk.
- Deliverable
- A markdown table of cold/warm load times, bandwidth, cached bytes and RSS for each variant plus the 15 GB prediction.
- Check
- Cold load time is within 30 percent of file_size / measured_disk_bandwidth; warm load is at least 3x faster than cold; fincore shows the file fully cached after the first load.