WeichenXu123 commented on code in PR #40724:
URL: https://github.com/apache/spark/pull/40724#discussion_r1162236929
##########
python/pyspark/ml/torch/distributor.py:
##########
@@ -744,7 +814,99 @@ def run(self, train_object: Union[Callable, str], *args:
Any) -> Optional[Any]:
TorchDistributor._run_training_on_pytorch_function # type:
ignore
)
if self.local_mode:
- output = self._run_local_training(framework_wrapper_fn,
train_object, *args)
+ output = self._run_local_training(framework_wrapper_fn,
train_object, *args, **kwargs)
else:
- output = self._run_distributed_training(framework_wrapper_fn,
train_object, *args)
+ output = self._run_distributed_training(
+ framework_wrapper_fn, train_object, None, *args, **kwargs
+ )
return output
+
+ def train_on_dataframe(self, train_function, spark_dataframe, *args,
**kwargs):
Review Comment:
The main reason that I create a new API instead of adding new argument to
`TorchDistributor.run` is:
`TorchDistributor.run` argument list ends with `*args` (args are arguments
that passed to train_object), so that we have no way to add new argument
without breaking change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]