Spleeter on Google Cloud Functions

Viewed 148

Im trying to run spleeter lib on Google Cloud Functions. I have a problem. The separate_to_file function is creating pretrained_models files while executing in root folder. The only directory I can write something is /tmp. Is there any way to change directory of pretrained models?

2 Answers

You can set the MODEL_DIRECTORY environment variable to the path of the directory you want models to be written into before to run Spleeter. Please note that most models are quite heavy and may require lot of storage.

I was doing the same thing. Fetching the models can be solved by pointing to the /tmp directory, as already pointed out.

Unfortunately, that wasn't the end of it. Spleeter depends on linux binaries that weren't included in serverless enironments. I solved this by deploying a docker image instead of a plain script.

Then there was the issue that spleeter consumes a lot of memory, especially for 4-way and 5-way splits. Google Cloud doesn't offer enough RAM. AWS Lambdas offer 10GB RAM, which is enough to split a regular, radio-friendly song.

Related