AutoML run "wait_for_completion(show_output=True)" raises UnboundLocalError: local variable 'setup_run' referenced before assignment
After upgrading azureml-sdk[automl] from 1.0.33 to 1.0.39 the code below raises an error message. Is this a known issue or is it a breaking change?
automl_config = AutoMLConfig(task = 'regression',
preprocess = True,
name = experiment_name,
debug_log = 'automl_errors.log',
primary_metric = primary_metric,
iteration_timeout_minutes = 25,
iterations = 5,
n_cross_validations = 5,
verbosity = logging.INFO,
X=training_data["X"].values,
y=training_data["y"],
enable_onnx_compatible_models=True,
path = project_folder, )
local_run = experiment.submit(automl_config)
# Wait until the run finishes.
local_run.wait_for_completion(show_output = True) # throws
...
The line above throws the following exception:
File "scripts/train.py", line 62, in <module>
local_run.wait_for_completion(show_output = True)
File "/azureml-envs/azureml_bb8ed044f42124387800249fdd974e61/lib/python3.6/site-packages/azureml/train/automl/run.py", line 722, in wait_for_completion
self._stream_run_output(file_handle=sys.stdout)
File "/azureml-envs/azureml_bb8ed044f42124387800249fdd974e61/lib/python3.6/site-packages/azureml/train/automl/run.py", line 762, in _stream_run_output
primary_metric)
File "/azureml-envs/azureml_bb8ed044f42124387800249fdd974e61/lib/python3.6/site-packages/azureml/train/automl/_remote_console_interface.py", line 91, in print_scores
if setup_run:
UnboundLocalError: local variable 'setup_run' referenced before assignment
Removing argument show_output = True seems to have fixed it:
local_run.wait_for_completion()
Hi @ksiomelo, as far as I'm aware, currently local execution is always synchronous. wait_for_completion only makes sense for remote runs which run asynchronously.
With that being said, this is still a bug. FYI @SKrupa
@wchill Thanks for the feedback. This code is indeed running remotely, the name of that variable "local_run" is not correct, I apologize.
Are you using get_default_compute_target?
I had this error recently when using get_default_compute_target without a default compute defined. (the default compute is created by Workspace.create but only if it creates a new resource group)
Yesterday, I changed our auto-ml-remote-amlcompute sample notebook to use ComputeTarget.create instead of get_default_compute_target in order to work on existing workspaces.
Has this issue been resolved? @ksiomelo
Closed per Ani "Waiting to hear if they are still running into this issue. However, we have a new version of the sdk. I assume this can be closed now".