Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Package existing model as container in Azure Machine Learning
from azureml.core import Workspace, Model
from azureml.core.model import InferenceConfig
from azureml.core.environment import Environment
from azureml.core.conda_dependencies import CondaDependencies
ws = Workspace.from_config()
env = Environment("inference-env")
env.docker.enabled = True
# Replace with your conda enviroment file
env.python.conda_dependencies = CondaDependencies("./conda.yml")
# Replace with your
inference_config = InferenceConfig(entry_script="", environment=env)
# Replace with your model
model = Model(ws, 'my-model')
package = Model.package(ws, [model], inference_config)
print(f"Packaged model image: {package.location}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment