Migrate classic GPU workloads to serverless
If you are moving an existing deep learning workload from a classic Databricks cluster (with Databricks Runtime ML) to serverless (with AI Runtime), follow these steps:
- Replace cluster-dependent code. Remove any references to Spark-based distributed training (for example,
TorchDistributor) and replace them with the@distributeddecorator fromserverless_gpu. - Update data loading. Replace direct DBFS paths with Unity Catalog volumes paths (
/Volumes/...). Replace local Spark DataFrame operations with Spark Connect. For streaming file-based data from volumes, useUCVolumeDatasetfromserverless_gpu.data. See Load data on AI Runtime. - Set up your environment. Some Databricks Runtime ML pre-installed libraries aren't available on AI Runtime. Set up a serverless GPU environment and install the packages your workload needs with
%pip install. See Set up your environment. - Update checkpoint paths. Move checkpoints from DBFS or local storage to Unity Catalog volumes (
/Volumes/<catalog>/<schema>/<volume>/...). For distributed checkpointing, useUCVolumeWriterandUCVolumeReaderfromserverless_gpu.data, which stage I/O through local NVMe. See Model checkpointing. - Review your MLflow configuration. On AI Runtime, the
.distributed()API creates MLflow runs automatically. To customize the experiment, set it with an absolute path. To resume interrupted runs, set a run name. See MLflow integration. - Test interactively first. Validate your workload in an interactive notebook before scheduling it as a job.