weights parameter on
TrainingJob to mount model weights and
training data into your container through the Baseten Delivery Network (BDN). BDN mirrors your data once and
serves it from multi-tier caches, so subsequent jobs start faster.
Each weight source specifies a remote URI and a local mount path. When your
container starts, the data is already available at the mount_location.
BDN mirrors your weights to Baseten storage during the
CREATED state, before any compute is provisioned. Once your job is scheduled on a node, BDN places the weights on local disk before your start_commands run. Weight delivery never overlaps with workload execution, so BDN has no effect on training throughput. The only difference between a cache hit and a cache miss is how long the deploy phase takes.Mount weights and a dataset
AddWeightsSource entries to the weights list of an existing TrainingJob in your job’s config.py. To create the file from scratch, see the quickstart.
This example mounts model weights from Hugging Face and training data from S3 into the container before your code runs:
config.py
train.py
data files:.
Supported sources
BDN supports these URI schemes:
For Hugging Face sources, pin to a specific revision with the
@revision suffix (branch, tag, or commit SHA).
For R2, add the jurisdiction between the account ID and the bucket when your bucket isn’t in the default one: r2://<account_id>.<jurisdiction>.<bucket>/path/to/data.
Authentication
Private or gated sources require authentication. Add anauth block to your
WeightsSource. For AWS, use OIDC (recommended) or
AWS AssumeRole to avoid storing long-lived
credentials in Baseten.
The role ARN, region, service account, and workload identity provider values aren’t credentials, so you can commit them to your repository.
- Hugging Face
- S3 (AWS OIDC)
- S3 (AWS AssumeRole)
- S3 (IAM credentials)
- GCS (GCP OIDC)
To read a private or gated repository:
-
Store a Hugging Face access token as a Baseten secret named
hf_access_token. -
Add this source to the job’s
weightslist:
Filter files
allow_patterns and ignore_patterns take glob patterns. A pattern such as *.safetensors matches only files at the top level of the source, so use **/*.safetensors to match files in subdirectories.
Add both lists to a source in the job’s weights:
How BDN serves training jobs
When you submit a training job, BDN compares yourweights config to what’s already in Baseten storage and pulls anything missing from the upstream source. It then stages the full set on the node before your start_commands run.
Data delivery happens entirely during the CREATED and DEPLOYING phases.
Two cache tiers sit in front of Baseten’s mirror:
- Cluster-local cache: shared across nodes in a GPU cluster. Populated the first time a job in that cluster pulls a given set of files.
- Node-local cache: lives on the node itself. Populated when a job lands on that node.
Weight access across jobs
A training job reads only the weight sources it declares in its config. Private sources like S3, GCS, R2, and CoreWeave stay within your organization. Within your organization, jobs that reference the same unchanged source pull from the upstream once instead of once per job. For example, running many jobs against the same S3 dataset egresses from your bucket a single time, regardless of which user launched them.Next steps
- BDN configuration reference: Every weight source option, authentication method, and URI scheme.
- Download data in your training script: Load data with a library’s own loader or custom code.
- Storage overview: Compare BDN with the training cache, checkpoints, and scratch space.