machine-learningbentoml

BentoML: how can I build a model without importing the services.py file?


Is it possible to run bentoml build without importing the services.py file during the process?

I'm trying to put the BentoML build and containerize steps in our CI/CD server. Our model depends on some OS packages installed and some Python packages. I thought I could run bentoml build to package the model code and binaries that are present. I'd leave the dependencies specification to the containerize step.

To my surprise, the BentoML build process tried to import the service file during the packaging and the build failed since I didn't have the dependencies installed in my CI/CD machine.

Can I prevent this importing while building/packaging the model? Maybe I should ignore the BentoML containerize and create my BentoML container by hand and just execute the BentoML serve inside.

I feel that the need to install the dependencies by hand is doubling the effort to specify them in the bentofile.yaml file and preventing the reproducibility of my environment.


Solution

  • This is not currently possible. The community is working on an environment management feature, such that an environment with the necessary dependencies will be automatically created during build.