@@ -28,6 +28,7 @@ def launch_job(
28
28
mode : str ,
29
29
workspace : str = DEFAULT_WORKSPACE ,
30
30
username : str | None = None ,
31
+ gpus : int = 1 ,
31
32
) -> None :
32
33
"""Launch training for the specified config on Beaker.
33
34
@@ -37,6 +38,7 @@ def launch_job(
37
38
mode: Mode to run the model ('fit', 'validate', 'test', or 'predict').
38
39
workspace: the Beaker workspace to run the job in.
39
40
username: optional W&B username to associate with the W&B run for this job.
41
+ gpus: number of GPUs to use.
40
42
"""
41
43
project_id , experiment_id = launcher_lib .get_project_and_experiment (config_path )
42
44
launcher_lib .upload_code (project_id , experiment_id )
@@ -105,7 +107,7 @@ def launch_job(
105
107
),
106
108
],
107
109
env_vars = env_vars ,
108
- resources = TaskResources (gpu_count = 1 ),
110
+ resources = TaskResources (gpu_count = gpus ),
109
111
)
110
112
unique_id = str (uuid .uuid4 ())[0 :8 ]
111
113
beaker .experiment .create (f"{ project_id } _{ experiment_id } _{ unique_id } " , spec )
@@ -142,7 +144,17 @@ def launch_job(
142
144
help = "Associate a W&B user with this run in W&B" ,
143
145
default = None ,
144
146
)
147
+ parser .add_argument (
148
+ "--gpus" ,
149
+ type = int ,
150
+ help = "Number of GPUs" ,
151
+ default = 1 ,
152
+ )
145
153
args = parser .parse_args ()
146
154
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 ,
148
160
)
0 commit comments