Skip to main content

Container Images

You can import existing images from remote Docker registries like Google Artifact Registry, ECR, Docker Hub, Nvidia and more, simply provide the image argument within your @function or @signal decorator containing an Instance of the Image class

  1. Create a Image instance by importing the Image class

    from snowcell.workload import Image

    image = Image(
    base_image="docker.io/nvidia/cuda:12.3.1-runtime-ubuntu20.04"
    )
    .add_commands(["apt-get update -y", "apt-get install neovim -y"])
    .add_python_packages(["torch", "cuda"])
  2. Add the image instance to your decorator: This will now run the commands you have specified, add the python packages of your choice and also import the base docker image you'd like to use

    @client.function(name="my task", cpu=1.5, memory=2, image=image)
    def predict(**inputs):
    return inputs['x'] + inputs['y']

    predict(x=3, y=2)