Skip to main content

Deploying models built with Detectron2

Detectron2 is a Facebook object recognition library built on PyTorch.

Because Detectron2 is not in PyPI, when deploying a model that depends on Detectron2, you'll need to tell Modelbit how to build Detectron2 from source. The installation instructions for Detectron specify the git URL to use with the python_packages parameter of modelbit.deploy.

Since Detectron2 depends on gcc, g++ and git, remember to include those in your system_packages as well.

Here is an example call to mb.deploy for an inference function that uses Detectron2:

mb.deploy(my_inference_function,
python_packages=[
"torch==1.13.1",
"git+https://github.com/facebookresearch/detectron2.git"],
system_packages=["gcc", "g++", "git"])