Skip to content

Commit eb3f1df

Browse files
fix: Minor fix
Signed-off-by: Abhijeet Dhumal <[email protected]>
1 parent 417e382 commit eb3f1df

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

kubeflow/trainer/backends/kubernetes/backend.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,7 @@ def _get_trainjob_spec(
606606
if isinstance(trainer, (types.CustomTrainer, types.CustomTrainerContainer)):
607607
if runtime.trainer.trainer_type != types.TrainerType.CUSTOM_TRAINER:
608608
raise ValueError(f"CustomTrainer can't be used with {runtime} runtime")
609-
trainer_cr = utils.get_trainer_cr_from_custom_trainer(
610-
runtime, trainer, trainer_overrides
611-
)
609+
trainer_cr = utils.get_trainer_cr_from_custom_trainer(runtime, trainer)
612610

613611
# If users choose to use a builtin trainer for post-training.
614612
elif isinstance(trainer, types.BuiltinTrainer):

kubeflow/trainer/backends/kubernetes/utils.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,15 @@ def get_command_using_train_func(
347347
def get_trainer_cr_from_custom_trainer(
348348
runtime: types.Runtime,
349349
trainer: Union[types.CustomTrainer, types.CustomTrainerContainer],
350-
trainer_overrides: Optional[dict[str, Any]] = None,
351350
) -> models.TrainerV1alpha1Trainer:
352351
"""
353352
Get the Trainer CR from the custom trainer.
354353
355354
Args:
356355
runtime: The runtime configuration.
357356
trainer: The custom trainer or container configuration.
358-
trainer_overrides: Optional overrides for image, command, or args from options.
359357
"""
360358
trainer_cr = models.TrainerV1alpha1Trainer()
361-
trainer_overrides = trainer_overrides or {}
362359

363360
# Add number of nodes to the Trainer.
364361
if trainer.num_nodes:
@@ -370,14 +367,13 @@ def get_trainer_cr_from_custom_trainer(
370367

371368
if isinstance(trainer, types.CustomTrainer):
372369
# If CustomTrainer is used, generate command from function.
373-
if trainer.func is not None:
374-
trainer_cr.command = get_command_using_train_func(
375-
runtime,
376-
trainer.func,
377-
trainer.func_args,
378-
trainer.pip_index_urls,
379-
trainer.packages_to_install,
380-
)
370+
trainer_cr.command = get_command_using_train_func(
371+
runtime,
372+
trainer.func,
373+
trainer.func_args,
374+
trainer.pip_index_urls,
375+
trainer.packages_to_install,
376+
)
381377
else:
382378
# Alternatively, set the Trainer image.
383379
trainer_cr.image = trainer.image

0 commit comments

Comments
 (0)