azure-ai-ml-py – skill Dữ liệu & Khoa học cho agent AI
SDK Azure Machine Learning v2 cho Python. Dùng cho workspace ML, job, model, dataset, compute và pipeline.
Cài skill azure-ai-ml-py bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-ai-ml-py-aa87e.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /azure-ai-ml-py – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-ai-ml-py-aa87e.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $azure-ai-ml-py – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-ai-ml-py-aa87e.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /azure-ai-ml-py – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/azure-ai-ml-py-aa87e.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /azure-ai-ml-py – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Azure Machine Learning SDK v2 for Python
Client library for managing Azure ML resources: workspaces, jobs, models, data, and compute.
Scope and execution
Confirm subscription, tenant, workspace, region and budget before create/update or compute/job submission. Examples are fragments: training components, source files and environment definitions are not bundled. Select currently supported reviewed SDK/environment versions; historical image and @latest examples do not establish reproducibility. Use least-privilege identity and do not print private job data.
Installation
pip install azure-ai-mlEnvironment Variables
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
AZURE_RESOURCE_GROUP=<your-resource-group>
AZURE_ML_WORKSPACE_NAME=<your-workspace-name>Authentication
import os
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
ml_client = MLClient(
credential=DefaultAzureCredential(),
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"],
resource_group_name=os.environ["AZURE_RESOURCE_GROUP"],
workspace_name=os.environ["AZURE_ML_WORKSPACE_NAME"]
)From Config File
import os
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
# Uses config.json in current directory or parent
ml_client = MLClient.from_config(
credential=DefaultAzureCredential()
)Workspace Management
Create Workspace
from azure.ai.ml.entities import Workspace
ws = Workspace(
name="my-workspace",
location="eastus",
display_name="My Workspace",
description="ML workspace for experiments",
tags={"purpose": "demo"}
)
ml_client.workspaces.begin_create(ws).result()List Workspaces
for ws in ml_client.workspaces.list():
print(f"{ws.name}: {ws.location}")Data Assets
Register Data
from azure.ai.ml.entities import Data
from azure.ai.ml.constants import AssetTypes
# Register a file
my_data = Data(
name="my-dataset",
version="1",
path="azureml://datastores/workspaceblobstore/paths/data/train.csv",
type=AssetTypes.URI_FILE,
description="Training data"
)
ml_client.data.create_or_update(my_data)Register Folder
my_data = Data(
name="my-folder-dataset",
version="1",
path="azureml://datastores/workspaceblobstore/paths/data/",
type=AssetTypes.URI_FOLDER
)
ml_client.data.create_or_update(my_data)Model Registry
Register Model
from azure.ai.ml.entities import Model
from azure.ai.ml.constants import AssetTypes
model = Model(
name="my-model",
version="1",
path="./model/",
type=AssetTypes.CUSTOM_MODEL,
description="My trained model"
)
ml_client.models.create_or_update(model)List Models
for model in ml_client.models.list(name="my-model"):
print(f"{model.name} v{model.version}")Compute
Create Compute Cluster
from azure.ai.ml.entities import AmlCompute
cluster = AmlCompute(
name="cpu-cluster",
type="amlcompute",
size="Standard_DS3_v2",
min_instances=0,
max_instances=4,
idle_time_before_scale_down=120
)
ml_client.compute.begin_create_or_update(cluster).result()List Compute
for compute in ml_client.compute.list():
print(f"{compute.name}: {compute.type}")Jobs
Command Job
from azure.ai.ml import command, Input
job = command(
code="./src",
command="python train.py --data ${{inputs.data}} --lr ${{inputs.learning_rate}}",
inputs={
"data": Input(type="uri_folder", path="azureml:my-dataset:1"),
"learning_rate": 0.01
},
environment="AzureML-sklearn-1.0-ubuntu20.04-py38-cpu@latest",
compute="cpu-cluster",
display_name="training-job"
)
returned_job = ml_client.jobs.create_or_update(job)
print(f"Job URL: {returned_job.studio_url}")Monitor Job
ml_client.jobs.stream(returned_job.name)Pipelines
from azure.ai.ml import dsl, Input, Output
@dsl.pipeline(
compute="cpu-cluster",
description="Training pipeline"
)
def training_pipeline(data_input):
prep_step = prep_component(data=data_input)
train_step = train_component(
data=prep_step.outputs.output_data,
learning_rate=0.01
)
return {"model": train_step.outputs.model}
pipeline = training_pipeline(
data_input=Input(type="uri_folder", path="azureml:my-dataset:1")
)
pipeline_job = ml_client.jobs.create_or_update(pipeline)Environments
Create Custom Environment
from azure.ai.ml.entities import Environment
env = Environment(
name="my-env",
version="1",
image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04",
conda_file="./environment.yml"
)
ml_client.environments.create_or_update(env)Datastores
List Datastores
for ds in ml_client.datastores.list():
print(f"{ds.name}: {ds.type}")Get Default Datastore
default_ds = ml_client.datastores.get_default()
print(f"Default: {default_ds.name}")MLClient Operations
| Property | Operations |
|----------|------------|
| workspaces | create, get, list, delete |
| jobs | create_or_update, get, list, stream, cancel |
| models | create_or_update, get, list, archive |
| data | create_or_update, get, list |
| compute | begin_create_or_update, get, list, delete |
| environments | create_or_update, get, list |
| datastores | create_or_update, get, list, get_default |
| components | create_or_update, get, list |
Best Practices
1. Use versioning for data, models, and environments
2. Configure idle scale-down to reduce compute costs
3. Use environments for reproducible training
4. Stream job logs to monitor progress
5. Register models after successful training jobs
6. Use pipelines for multi-step workflows
7. Tag resources for organization and cost tracking
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- mageck – Phân tích FASTQ đọc từ màn hình CRISPR gộp và ma trận đếm guide bằng MAGeCK, kiểm tra…
- marine-carbonate-chemistry – Giải bài toán hóa học carbonate nước biển bằng PyCO2SYS cho hóa học hải dương, axit hóa…
- hunt-nosqli – Săn lỗ hổng NoSQL Injection — MongoDB operator injection ($where, $regex, $gt, $ne)…
- market-research-reports – Xây dựng báo cáo nghiên cứu thị trường có thể truy xuất bằng chứng và mô hình quy mô thị…
- grounded-citations – Neo câu trả lời và tài liệu vào các nguồn có trích dẫn, có thể kiểm chứng.
- market-sizing-analysis – Tính TAM/SAM/SOM cho cơ hội thị trường theo các phương pháp top-down, bottom-up và lý…
- context-engine – Tải và quản lý ngữ cảnh công ty cho tất cả skill cố vấn C-suite. Đọc…
- matplotlib – Tạo và tùy chỉnh biểu đồ khoa học với Matplotlib. Dùng để kiểm soát chi tiết các thành…