runpod.NetworkVolume: Storage in a single data center. Resources that mount it run in that data center. Works with GPU and CPU compute.runpod.GlobalVolume(beta): Storage that isn’t tied to a data center. Requires GPU compute.
Attach a volume
Declare the volume once, then attach it to resources withmounts, which maps a path on the worker to a volume:
evaluate can read the checkpoint that train wrote. The SDK places both tasks in the volume’s data center.
Volume references
Both volume types take a name or an ID:- If no volume with that name or ID exists, the SDK creates it the first time it provisions a resource that mounts it. Set
create=Falseto require an existing volume instead. sizeis the size in GB for a new network volume. Global volumes grow with your data, so they don’t take a size.datacenterpins a new network volume to a data center. If you leave it unset, the SDK picks a data center that supports network storage and has hardware for every resource that shares the volume, respecting anydatacentersetting on those resources. If you pin a data center that doesn’t support network storage, provisioning fails before the volume is created.- An existing volume keeps its ID and data center. Every resource that mounts it must be able to run in that data center.
Mount rules
Global volumes require GPU compute for both tasks and endpoints.
Read the mount path in your code
Inside a remote function,volume.path returns the path where the volume is mounted on that worker:
- Read
.pathinside remote functions, not at the top level of a module. The SDK imports your modules locally to discover resources, and the volume isn’t mounted there. - Accessing
.pathraises an error if the volume isn’t mounted on the current worker, or if it’s mounted more than once. fn.local()runs your function on your machine without mounting remote storage.
Cache model weights
To load a Hugging Face model without managing a volume yourself, use themodel parameter instead. Runpod stages the weights on the host before the worker starts. See model.
Billing
Next steps
- Compare network and global volumes.
- Build an app that shares checkpoints between tasks.