Get Your CertDatabricks Certified Machine Learning ProfessionalPlayCompete
‹ All Databricks Certified Machine Learning Professional questions

Databricks ML Professional Practice Question 23: Torch Distributor Multi Node

Databricks Certified Machine Learning Professional · Test 3 · question 3 of 10

Scaling and Tuninghard

A PyTorch image model takes about 30 hours to train on one GPU. The cluster has four GPU workers. The team wants to train a *single* model across all four GPUs, keep their existing single-node train() function largely intact, and have the run tracked in MLflow.

What should they use?

Select one answer
Show answer and explanation

Answer:

  • C. TorchDistributor(num_processes=4, local_mode=False, use_gpu=True).run(train_fn, ...), which runs the function across the workers with PyTorch distributed data parallel

TorchDistributor is the Spark-native launcher for PyTorch's own distributed training. It starts one process per GPU across the workers, wires up the coordination that DistributedDataParallel needs, and invokes the existing training function, so the code changes are largely confined to wrapping the model in DDP and using a distributed sampler. All four GPUs contribute gradients to one set of weights, which is what "a single model across four GPUs" requires, and MLflow tracking works from within the run.

Option A produces four independent models, one per shard, and never combines them. That is the right tool for training many small per-group models, which is the opposite of this requirement.

Option B discards the architecture. MultilayerPerceptronClassifier is a simple feed-forward network and cannot express an image model, so this is a rewrite into a strictly less capable model.

Option D keeps training on a single GPU. A larger driver instance may shorten the 30 hours somewhat, but it uses one device and leaves the cluster's other GPUs idle.

Reference: Distributed training with TorchDistributor

Practice Test 3 ›

Study guides for Databricks Certified Machine Learning Professional