Build an image
from klio_compute import function, Image
image = Image(
python_version="python3.12",
python_packages=["transformers", "torch"],
commands=["apt-get update && apt-get install -y ffmpeg"],
)
@function(image=image, gpu="L4")
def run():
...Images are built once and reused. Klio Compute runs Python 3.12: Image(python_version="python3.12"), and plain Image(), is the supported image, and anything built on it can import klio_compute with nothing to install. Asking for another version stops with a message before anything is sent.
Your own base image
image = Image(base_image="docker.io/library/python:3.11-slim")An image with its own base_image may use any Python. Image from klio_compute adds one build step that installs this release of klio-compute without its dependencies, so from klio_compute import function works inside it too. Set KLIO_SDK_INSTALL_SPEC to install it from somewhere else, such as a private mirror.
- Use
Imagefromklio_compute, not from another package. - Don't list
klio-computeinpython_packages: its dependencies would conflict with the versions the platform fixes in images. klio runandklio deployalso take--dockerfileto build from a Dockerfile.