azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Sweep job can't run on local compute

Open pietergobin opened this issue 3 years ago • 4 comments

  • azure.ai.ml:
  • 1.9.0:
  • Ubuntu and Windows 10:
  • 3.10:

Describe the bug When running a sweep job with local compute target, it tries to set environment variables to a sweep job but a sweep job does not have the environment variables attribute.

To Reproduce Steps to reproduce the behavior:

  1. Produce a sweep job with compute target set to local:
from azure.ai.ml import command, Input
from azure.ai.ml.sweep import Choice, Uniform, MedianStoppingPolicy
from azure.identity import DefaultAzureCredential

# Create your base command job
command_job = command(
    code="./src",
    command="python main.py --iris-csv ${{inputs.iris_csv}} --learning-rate ${{inputs.learning_rate}} --boosting ${{inputs.boosting}}",
    environment="AzureML-lightgbm-3.2-ubuntu18.04-py37-cpu@latest",
    inputs={
        "iris_csv": Input(
            type="uri_file",
            path="https://azuremlexamples.blob.core.windows.net/datasets/iris.csv",
        ),
        "learning_rate": 0.9,
        "boosting": "gbdt",
    },
    compute="local",
)

# Override your inputs with parameter expressions
command_job_for_sweep = command_job(
    learning_rate=Uniform(min_value=0.01, max_value=0.9),
    boosting=Choice(values=["gbdt", "dart"]),
)

# Call sweep() on your command job to sweep over your parameter expressions
sweep_job = command_job_for_sweep.sweep(
    compute="local",
    sampling_algorithm="random",
    primary_metric="test-multi_logloss",
    goal="Minimize",
)

# Specify your experiment details
sweep_job.display_name = "lightgbm-iris-sweep-example"
sweep_job.experiment_name = "lightgbm-iris-sweep-example"
sweep_job.description = "Run a hyperparameter sweep job for LightGBM on Iris dataset."

# Define the limits for this sweep
sweep_job.set_limits(max_total_trials=20, max_concurrent_trials=10, timeout=7200)

# Set early stopping on this one
sweep_job.early_termination = MedianStoppingPolicy(
    delay_evaluation=5, evaluation_interval=2
)```

**Expected behavior**
A sweep job that can run on a local gpu machine but upload its findings to the azure ml workspace

pietergobin avatar Aug 09 '23 08:08 pietergobin

Thanks for the feedback, we’ll investigate asap.

xiangyan99 avatar Aug 09 '23 23:08 xiangyan99

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-github @Azure/azure-ml-sdk.

github-actions[bot] avatar Aug 09 '23 23:08 github-actions[bot]

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github.

github-actions[bot] avatar Aug 08 '24 04:08 github-actions[bot]

Sweep job can't be created with 'local' compute target. Functionally its not supported.

jayesh-tanna avatar Aug 27 '24 07:08 jayesh-tanna