{"id":23340,"library":"azureml-train","title":"Azure Machine Learning Training SDK","description":"The Azure Machine Learning Python SDK training package provides functionality for configuring, submitting, and managing machine learning training runs on Azure. It includes support for hyperparameter tuning (HyperDrive), automated ML (AutoML), and distributed training. Current version is 1.62.0, last updated in early 2025. Release cadence is monthly, aligned with the Azure ML SDK releases.","status":"maintenance","version":"1.62.0","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml","tags":["azure","machine-learning","training","hyperdrive","automl"],"install":[{"cmd":"pip install azureml-train","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Core functionality for Workspace, Experiment, Run, etc.","package":"azureml-core","optional":true},{"reason":"Meta-package that includes all Azure ML SDK components.","package":"azureml-sdk","optional":true}],"imports":[{"note":"HyperDriveRunConfig was removed in earlier SDK versions. Use HyperDriveConfig.","wrong":"from azureml.train.hyperdrive import HyperDriveRunConfig","symbol":"HyperDriveConfig","correct":"from azureml.train.hyperdrive import HyperDriveConfig"},{"note":"Common mistake: importing from wrong submodule.","wrong":"from azureml.train.automl import AutoMLConfig (not from azureml.train or from azureml.core)","symbol":"AutoMLConfig","correct":"from azureml.train.automl import AutoMLConfig"},{"note":"ScriptRunConfig moved to azureml.core in SDK v1.0.85+.","wrong":"from azureml.train import ScriptRunConfig","symbol":"ScriptRunConfig","correct":"from azureml.core import ScriptRunConfig"}],"quickstart":{"code":"from azureml.core import Workspace, Experiment, ScriptRunConfig\nfrom azureml.core.compute import ComputeTarget, AmlCompute\nfrom azureml.core.compute_target import ComputeTargetException\nfrom azureml.train.hyperdrive import HyperDriveConfig, PrimaryMetricGoal, choice\n# Connect to workspace\nws = Workspace.from_config()\n# Create a compute cluster (if not exists)\ncluster_name = \"cpu-cluster\"\ntry:\n    compute_target = ComputeTarget(workspace=ws, name=cluster_name)\nexcept ComputeTargetException:\n    compute_config = AmlCompute.provisioning_configuration(vm_size='STANDARD_D2_V2', max_nodes=4)\n    compute_target = ComputeTarget.create(ws, cluster_name, compute_config)\ncompute_target.wait_for_completion(show_output=True)\n# Configure a hyperparameter sweep\nexp = Experiment(ws, 'my-experiment')\nsrc = ScriptRunConfig(source_directory='.', script='train.py', compute_target=compute_target)\nhyperdrive_config = HyperDriveConfig(run_config=src,\n                                     hyperparameter_sampling=choice({'--lr': [0.01, 0.001]}),\n                                     primary_metric_name='accuracy',\n                                     primary_metric_goal=PrimaryMetricGoal.MAXIMIZE,\n                                     max_total_runs=4)\nsubmitted_run = exp.submit(hyperdrive_config)\nsubmitted_run.wait_for_completion(show_output=True)","lang":"python","description":"Basic example: connect to workspace, create compute target, submit a HyperDrive sweep."},"warnings":[{"fix":"Migrate to azure-ai-ml (v2). See Microsoft migration guide.","message":"Azure ML SDK v2 is now preferred; v1 (azureml-train) is in maintenance mode. New features only for v2.","severity":"breaking","affected_versions":">=1.62.0"},{"fix":"Use azure-ai-ml to create automated ML jobs.","message":"AutoMLConfig from azureml-train is deprecated in favor of azure-ai-ml automl.","severity":"deprecated","affected_versions":">=1.50.0"},{"fix":"Always import ScriptRunConfig from azureml.core.","message":"ScriptRunConfig import changed from azureml.train to azureml.core in SDK v1.0.85.","severity":"gotcha","affected_versions":">=1.0.85"},{"fix":"Use from azureml.train.hyperdrive import HyperDriveConfig.","message":"HyperDriveConfig replaces deprecated HyperDriveRunConfig. Using old name causes ImportError.","severity":"gotcha","affected_versions":">=1.0.85"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install azureml-train. Ensure import uses correct submodule, e.g., 'from azureml.train.hyperdrive import ...'.","cause":"Missing azureml-train package or import path mismatch.","error":"ModuleNotFoundError: No module named 'azureml.train'"},{"fix":"Change import to: from azureml.core import ScriptRunConfig","cause":"ScriptRunConfig was moved to azureml.core in recent SDK versions.","error":"ImportError: cannot import name 'ScriptRunConfig' from 'azureml.train'"},{"fix":"Use 'HyperDriveConfig' instead. Import: from azureml.train.hyperdrive import HyperDriveConfig","cause":"HyperDriveRunConfig was renamed to HyperDriveConfig.","error":"AttributeError: module 'azureml.train.hyperdrive' has no attribute 'HyperDriveRunConfig'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}