From 06f52ae03c65be03af97b1b11b860dbb13863d54 Mon Sep 17 00:00:00 2001 From: Hu Po Date: Tue, 23 Aug 2022 08:00:43 -0500 Subject: [PATCH 1/4] add params to launch_add --- wandb/sdk/launch/sweeps/scheduler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wandb/sdk/launch/sweeps/scheduler.py b/wandb/sdk/launch/sweeps/scheduler.py index 160c680de9b..789bbf3c59c 100644 --- a/wandb/sdk/launch/sweeps/scheduler.py +++ b/wandb/sdk/launch/sweeps/scheduler.py @@ -207,8 +207,9 @@ def _update_run_states(self) -> None: def _add_to_launch_queue( self, - entry_point: Optional[List[str]] = None, run_id: Optional[str] = None, + entry_point: Optional[List[str]] = None, + params: Optional[Dict[str, Any]] = None, ) -> "public.QueuedRun": """Add a launch job to the Launch RunQueue.""" run_id = run_id or generate_id() @@ -223,6 +224,7 @@ def _add_to_launch_queue( queued_run = launch_add( run_id=run_id, entry_point=entry_point, + params=params, uri=_uri, job=_job, project=self._project, From 5e168c1c41d35cff3ea6126627e4ee4e747e194f Mon Sep 17 00:00:00 2001 From: Hu Po Date: Tue, 23 Aug 2022 09:39:21 -0500 Subject: [PATCH 2/4] run args in params --- wandb/sdk/launch/sweeps/scheduler_sweep.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/wandb/sdk/launch/sweeps/scheduler_sweep.py b/wandb/sdk/launch/sweeps/scheduler_sweep.py index 8fe70919c3a..2a38a7a0703 100644 --- a/wandb/sdk/launch/sweeps/scheduler_sweep.py +++ b/wandb/sdk/launch/sweeps/scheduler_sweep.py @@ -144,22 +144,10 @@ def _run(self) -> None: wandb.termlog( f"{LOG_PREFIX}Converting Sweep Run (RunID:{run.id}) to Launch Job" ) - # This is actually what populates the wandb config - # since it is used in wandb.init() - sweep_param_path = os.path.join( - os.environ.get(wandb.env.DIR, os.getcwd()), - "wandb", - f"sweep-{self._sweep_id}", - f"config-{run.id}.yaml", - ) - wandb.termlog(f"{LOG_PREFIX}Saving params to {sweep_param_path}") - wandb_lib.config_util.save_config_file_from_dict(sweep_param_path, run.args) - # Construct entry point using legacy sweeps utilities - command_args = LegacySweepAgent._create_command_args({"args": run.args})["args"] - entry_point = ["python", run.program] + command_args _ = self._add_to_launch_queue( - entry_point=entry_point, + entry_point=["python", run.program], run_id=run.id, + params=run.args, ) def _exit(self) -> None: From 3704207f7ebebfd63575e978f13fec92c4d3ccee Mon Sep 17 00:00:00 2001 From: Hu Po Date: Tue, 23 Aug 2022 10:02:04 -0500 Subject: [PATCH 3/4] formatting --- wandb/sdk/launch/sweeps/scheduler_sweep.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/wandb/sdk/launch/sweeps/scheduler_sweep.py b/wandb/sdk/launch/sweeps/scheduler_sweep.py index 2a38a7a0703..85aaff7cd88 100644 --- a/wandb/sdk/launch/sweeps/scheduler_sweep.py +++ b/wandb/sdk/launch/sweeps/scheduler_sweep.py @@ -1,6 +1,5 @@ """Scheduler for classic wandb Sweeps.""" import logging -import os import pprint import queue import socket @@ -9,7 +8,6 @@ from typing import Any, Dict, List import wandb -from wandb import wandb_lib # type: ignore from wandb.sdk.launch.sweeps import SchedulerError from wandb.sdk.launch.sweeps.scheduler import ( LOG_PREFIX, @@ -18,7 +16,6 @@ SimpleRunState, SweepRun, ) -from wandb.wandb_agent import Agent as LegacySweepAgent logger = logging.getLogger(__name__) @@ -145,8 +142,8 @@ def _run(self) -> None: f"{LOG_PREFIX}Converting Sweep Run (RunID:{run.id}) to Launch Job" ) _ = self._add_to_launch_queue( - entry_point=["python", run.program], run_id=run.id, + entry_point=["python", run.program] if run.program else None, params=run.args, ) From 9b2ea24075b57f6922fd100ad0b345faab516678 Mon Sep 17 00:00:00 2001 From: Hu Po Date: Tue, 23 Aug 2022 18:03:25 -0500 Subject: [PATCH 4/4] the alternate path --- wandb/sdk/launch/sweeps/scheduler.py | 4 ++-- wandb/sdk/launch/sweeps/scheduler_sweep.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wandb/sdk/launch/sweeps/scheduler.py b/wandb/sdk/launch/sweeps/scheduler.py index 789bbf3c59c..9a35eca57a7 100644 --- a/wandb/sdk/launch/sweeps/scheduler.py +++ b/wandb/sdk/launch/sweeps/scheduler.py @@ -209,7 +209,7 @@ def _add_to_launch_queue( self, run_id: Optional[str] = None, entry_point: Optional[List[str]] = None, - params: Optional[Dict[str, Any]] = None, + config: Optional[Dict[str, Any]] = None, ) -> "public.QueuedRun": """Add a launch job to the Launch RunQueue.""" run_id = run_id or generate_id() @@ -224,7 +224,7 @@ def _add_to_launch_queue( queued_run = launch_add( run_id=run_id, entry_point=entry_point, - params=params, + config=config, uri=_uri, job=_job, project=self._project, diff --git a/wandb/sdk/launch/sweeps/scheduler_sweep.py b/wandb/sdk/launch/sweeps/scheduler_sweep.py index 85aaff7cd88..904364ff61f 100644 --- a/wandb/sdk/launch/sweeps/scheduler_sweep.py +++ b/wandb/sdk/launch/sweeps/scheduler_sweep.py @@ -144,7 +144,7 @@ def _run(self) -> None: _ = self._add_to_launch_queue( run_id=run.id, entry_point=["python", run.program] if run.program else None, - params=run.args, + config={"overrides": {"run_config": run.args}}, ) def _exit(self) -> None: