Skip to content

Commit c71f6e8

Browse files
committed
add --gpus when launching beaker job
1 parent a07d3e7 commit c71f6e8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

rslp/launch_beaker.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def launch_job(
2828
mode: str,
2929
workspace: str = DEFAULT_WORKSPACE,
3030
username: str | None = None,
31+
gpus: int = 1,
3132
) -> None:
3233
"""Launch training for the specified config on Beaker.
3334
@@ -37,6 +38,7 @@ def launch_job(
3738
mode: Mode to run the model ('fit', 'validate', 'test', or 'predict').
3839
workspace: the Beaker workspace to run the job in.
3940
username: optional W&B username to associate with the W&B run for this job.
41+
gpus: number of GPUs to use.
4042
"""
4143
project_id, experiment_id = launcher_lib.get_project_and_experiment(config_path)
4244
launcher_lib.upload_code(project_id, experiment_id)
@@ -105,7 +107,7 @@ def launch_job(
105107
),
106108
],
107109
env_vars=env_vars,
108-
resources=TaskResources(gpu_count=1),
110+
resources=TaskResources(gpu_count=gpus),
109111
)
110112
unique_id = str(uuid.uuid4())[0:8]
111113
beaker.experiment.create(f"{project_id}_{experiment_id}_{unique_id}", spec)
@@ -142,7 +144,17 @@ def launch_job(
142144
help="Associate a W&B user with this run in W&B",
143145
default=None,
144146
)
147+
parser.add_argument(
148+
"--gpus",
149+
type=int,
150+
help="Number of GPUs",
151+
default=1,
152+
)
145153
args = parser.parse_args()
146154
launch_job(
147-
args.config_path, args.mode, workspace=args.workspace, username=args.username
155+
args.config_path,
156+
args.mode,
157+
workspace=args.workspace,
158+
username=args.username,
159+
gpus=args.gpus,
148160
)

0 commit comments

Comments
 (0)