Slackbot
01/27/2023, 8:32 AMShihgian Lee
01/27/2023, 3:45 PMJames Zhang
01/27/2023, 4:00 PMimport os
import bentoml
from <http://bentoml.io|bentoml.io> import JSON
model_uri = os.getenv("MODEL_URI")
my_runner = bentoml.mlflow.import_model(f"my_model", model_uri).to_runner()
svc = bentoml.Service("my_service", runners=[my_runner])
@svc.api(input=JSON(), output=JSON())
def predict(input_arr):
return my_runner.predict.run(input_arr)
and I started it in a Dockerfile like this ($BASE_IMAGE just provide python packages)
ARG BASE_IMAGE
FROM --platform=linux/amd64 $BASE_IMAGE
WORKDIR /
COPY service.py service.py
EXPOSE 3000:3000
ENTRYPOINT ["bentoml", "serve", "service:svc", "--reload"]
not sure what I did wrong hereShihgian Lee
01/27/2023, 4:07 PMJames Zhang
01/30/2023, 10:48 AM--reload
that causes this mem usage… after i changed it to --production
it’s a stable flatline nowShihgian Lee
01/30/2023, 2:20 PMJames Zhang
01/30/2023, 2:24 PMShihgian Lee
01/30/2023, 2:28 PMShihgian Lee
01/30/2023, 3:25 PMJames Zhang
01/30/2023, 3:35 PMcontainerize
but then i found out that in our current infrastructure it’s not possible because our EKS doesn’t support dind anymore… i also tried to use podman
buildah
as the backend
argument, they didn’t work either because i could only install older versions of them but containerize
seems to invoke methods of the newer versions of them, after some tries i gave it up…Shihgian Lee
01/30/2023, 10:08 PMbentoml build
command outputs my customized Dockerfile. Then I just point my containerization script to the generated custom Dockerfile. If your current approach is simple and works for you, that is great! No need to use the Dockerfile template.