cog
cog copied to clipboard
Better handling of temporary files
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.
I wonder if there's something clever we can do with file handles, in a way that's also not confusing and memory inefficient...
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.