Forums

504-loadbalancer when runing lightgbm

Hi Community,

I'm new to deploying the ML model. Can anyone give some suggestion on how can I run lightgbm with pythonanywhere? I got Error code: 504-loadbalancer and I run my lightbgm web app.

Thank you so much.

Does your web app work at all?

It works properly. However, when it comes to predicting, it crashed after taking a long loading time.

Are you using some machine learning code in your web app? If so, check this help page.

Hello @pafk why the threads only allow for 1 ? is still can use more than 1 ? 2 maybe ?

Currently you can use only one thread in the web app's code. Alternatively, you could move your ML code to, e.g., an always-on task, where you could use threading, see this help page.

Hello everyone,

I have the same error, 504 loadbalancer. I am trying to deploy a Flask app to do a light gbm "predict_proba" . I pre trained the light gbm model I want to use and exported in joblib format...but I am not able to make it work. Locally, in my pc, it works and it's quick.

Is there anyone that managed to do a prediction with lightgmb through a pythonanywhere web app?

I read other topics where for some machine learning tasks the async work is recomended... but I don't have a clear picture, it's the firt time for me in deploying a machine learning web app, with flask. Can anyone help me with this?

Thanks in advance

Yes, it is likely that you will need to move the machine learning code out of the web app. See https://help.pythonanywhere.com/pages/AsyncInWebApps/