AmusementClub / vs-mlrt

Efficient CPU/GPU ML Runtimes for VapourSynth (with built-in support for waifu2x, DPIR, RealESRGANv2/v3, Real-CUGAN, RIFE, SCUNet and more!)
GNU General Public License v3.0
282 stars 20 forks source link

HUGE disk space usage in ORT_COREML #107

Open yuygfgg opened 1 day ago

yuygfgg commented 1 day ago

The coreml models compiled (or translated) from onnx is taking over 180GB in /private/var/folders/gb/m6gky8t10yx68drv06ncbj_h0000gn/T/ folder. I assume there is some missing cleaning up steps in vsort but can't confirm that. As a workaround, I added

import subprocess; subprocess.run('rm -r /private/var/folders/gb/m6gky8t10yx68drv06ncbj_h0000gn/T/onnxruntime*', shell=True, check=True) 

at the end of my VS script.

The picture shows running a small model (Waifu2xModel.upconv_7_anime_style_art_rgb) for several times.

截屏2024-09-18 23 24 04

If larger model is used, larger mlmodel(c) folder (yes, although they look like files, they are folders in fact) is generated. For example, DPIR takes 130.1MB per run per tile.

WolframRhodium commented 1 day ago

Thanks for the information, I'll check it tomorrow.

WolframRhodium commented 1 day ago

I think this is a limitation of ORT itself: https://github.com/microsoft/onnxruntime/blob/0f1f3b7705ddc2fe4f371f78a8a8b6a0428a68de/onnxruntime/core/providers/coreml/builders/model_builder.cc#L996-L1008 so your post cleaning script is required unfortunately.

yuygfgg commented 1 day ago

I think this is a limitation of ORT itself: https://github.com/microsoft/onnxruntime/blob/0f1f3b7705ddc2fe4f371f78a8a8b6a0428a68de/onnxruntime/core/providers/coreml/builders/model_builder.cc#L996-L1008 so your post cleaning script is required unfortunately.

I see. I'm now kind of worrying about my SSD...