Created
May 3, 2021 13:55
-
-
Save csiebler/60eb01de4d2552e9aa85e292e48b4a62 to your computer and use it in GitHub Desktop.
Package existing model as container in Azure Machine Learning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 score.py | |
inference_config = InferenceConfig(entry_script="score.py", environment=env) | |
# Replace with your model | |
model = Model(ws, 'my-model') | |
package = Model.package(ws, [model], inference_config) | |
package.wait_for_creation(show_output=True) | |
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