cog icon indicating copy to clipboard operation
cog copied to clipboard

Better handling of temporary files

Open andreasjansson opened this issue 4 years ago • 2 comments
trafficstars

Many models depend on temporary files and folders, and it's currently up to the user to clear them all up at the end of a prediction.

There should be some way in Cog to create temporary files and folders that are scoped to a single prediction and cleaned up automatically by Cog at the end of the prediction.

andreasjansson avatar Sep 28 '21 10:09 andreasjansson

I wonder if there's something clever we can do with file handles, in a way that's also not confusing and memory inefficient...

bfirsh avatar Sep 28 '21 15:09 bfirsh

I think we need a more general solution, since many of these temp files are generated by things far away from predict.py. For example, a common pattern is for an audio model to output a .wav file, and then shell out to ffmpeg to convert it to mp3.

andreasjansson avatar Sep 28 '21 16:09 andreasjansson