Search code examples
herokupytorchweb-deployment

where I can deploy ml algorithm without time out?


I used Heroku to deploy ml algorithm with Pytorch but when I sent request to app to train model with 100 epochs then I got this error

at=error code=H12 desc="Request Timeout" method=POST path="/train"

I searched about request time out and I find that the limit to request time
from Heroku is 30 sec

What's the solution of time out problem and is there an platform for training model without time out?


Solution

  • Model training can be an expensive and lengthy operation that can take from minutes to hours (depending on context and amount of data), so it is likely that you will have a request timeout on other providers too.

    The solution is to make the model train a background task:

    • create a worker Dyno which schedule the model training (ie everyday at h11:00)

    OR

    • keep the web Dyno but make sure the /train request spawns a background thread (hence the web request completes quickly and the training happens in background)