How do you deploy your models in production?
- Render
- AWS BeanStalk
- Google App Engine
- Other (mention in comments)
0 voters
0 voters
Google kubernetes engine
Iād like to deploy my model as part of an executable for Linux and Windows. I know this is old-fashioned, but it needs to work on hospitalsā¦
Iāve run into a small problem, though. It seems like fastai has a hard dependency on tk, so Iām having trouble deploying my models in a Python environment without tk. I get āNo module named tkinterā when trying to import fastai.vision. I even get this error if I do āimport fastai.basic_trainā and then do load_learner(path).
Is it possible to get around this? I tried just loading the model using torch: torch.load(src, strict=False) and then running it as a pure torch model. But this way, my input data doesnāt get transformed, and thus my model doesnāt perform as it should. Iāve also tried to replicate what is going on in basic_train.load_learner but Iāve had no luck so far.
Can you please point me in the right direction?
Kind regards,
Andreas
Hosting on my own dedicated server.
Deploy fastai model with GKE on GCP
GKE = google kubernetes engine
GCP = google compute platform
flask (starlette application)
web server code -> https://github.com/render-examples/fastai-v3
save model to google drive -> https://course.fast.ai/deployment_render.html
move server.py (app.py) to the same dir as dockerfile
dockerfile -> (1.8 GB)
I used the docker file from https://github.com/render-examples/fastai-v3
but changed the app/server.py to server.py because I moved the file into the dockerfile directory
build docker image with google cloud build
google deployment tools -> https://www.jhanley.com/google-cloud-run-getting-started-with-python-and-flask/
John Hanleyās page works except I had to use GKE instead of cloud run to deploy model (bc of memory?)
cloud build can build the docker image much faster than docker desktop great for big images (fastai)
cloud build will build and publish the image to google container registry
I didnāt use docker desktop to build the docker image
deploy the image to GKE
cloud run didnāt work (memory?) so I used GKE
you can use the google console or command line to deploy the image to GKE
ignore some warning messages about pytorch version incompatibility
Exampleā¦ SourceChangeWarning: source code of class āfastai.text.models.awd_lstm.LinearDecoderā has changed.
expose application to internet --port 80 --target-port 8080
have to use both port and target-port for public web page
view web page ā¦ GKE -> services & Ingress (menu on the left)-> overview (menu on top) -> External endpoints
I see that 52% of the people that voted used Google App Engine, why is that?? even though Jeremy uses render (13% of people that voted) if iām not mistakenā¦
I deploy everything on SeeMe.ai but I might be biased since I created itā¦
Itās easy, you can share models and we have native iOS (with Core ML support) and Android appsā¦
Heroku/voila because it was the first one I came across which was free and easy and worked properly.
Heroku