Upload Model Bundle

Now that the bundle is confirmed to run and conform to the annotation format, it can be uploaded to Nucleus! To do this, import and initialize the Nucleus client.

To create the bundle, we want to set the following arguments:

Bundle args:
env_params - this is used to set up deep learning frameworks. Since we’re using PyTorch, we will set a pytorch image tag
load_predict_fn - pass in the load_predict_fn we’ve created
requirements - pass in any pip requirements the model needs
model / load_model_fn - pass in the model or load_model_fn we’ve created

Name: Model’s name
Reference ID: Model’s Reference ID, must be unique

Sample code:

env_params = {
     "framework_type": "pytorch", # if using any deep learning frameworks
     "pytorch_image_tag": "1.10.0-cuda11.3-cudnn8-runtime",  # uses python 3.7
}

NUCLEUS_MODEL_NAME="box-detection-test-model"

bundle_args = dict(env_params=env_params,
                  load_predict_fn=load_pytorch_predict_fn,
                  requirements=["torchvision", "torch"],
                  model=model,
                  load_model_fn=None)

model = nucleus_client.create_launch_model(name=NUCLEUS_MODEL_NAME, reference_id=NUCLEUS_MODEL_NAME, bundle_args=bundle_args)

After running this, the model should be available for use in Nucleus!