WeichenXu123 commented on code in PR #40607:
URL: https://github.com/apache/spark/pull/40607#discussion_r1156563413
##########
python/pyspark/ml/torch/distributor.py:
##########
@@ -578,19 +600,23 @@ def _run_distributed_training(
)
self._check_encryption()
self.logger.info(
- f"Started distributed training with {self.num_processes} executor
proceses"
+ f"Started distributed training with {self.num_processes} executor
processes"
)
try:
- result = (
- self.sc.parallelize(range(self.num_tasks), self.num_tasks)
- .barrier()
- .mapPartitions(spark_task_function)
- .collect()[0]
+ rows = (
+ self.spark.range(start=0, end=self.num_tasks, step=1,
numPartitions=self.num_tasks)
+ .mapInPandas(func=spark_task_function, schema="chunk binary",
barrier=True)
+ .collect()
)
+ output_bytes = b""
+ for row in rows:
+ output_bytes += row.chunk
Review Comment:
Did you test the performance of concat them ?
@HyukjinKwon Do you have better approach to concat them with better
performance ?
--
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]