Load weights and data with BDN
Use theweights parameter on
TrainingJob to mount model weights and
training data into your container through BDN. BDN mirrors your data once and
serves it from multi-tier caches, so subsequent jobs start faster.
BDN mirrors your weights to Baseten storage during the
CREATED state, before any compute is provisioned.
This mirroring step is not billed.
Once the job enters DEPLOYING, compute billing begins. This includes the time BDN takes to mount cached weights into your container.
Cached weights mount faster than first-time downloads, reducing billable deploy time on subsequent jobs.mount_location. No
download code needed in your training script.
Hugging Face and S3 example
Load model weights from Hugging Face and training data from S3, mounted into the training container before your code runs:config.py
train.py
Supported sources
BDN supports these URI schemes:| Scheme | Example | Description |
|---|---|---|
hf:// | hf://meta-llama/Llama-3.1-8B@main | Hugging Face Hub. |
s3:// | s3://my-bucket/path/to/data | Amazon S3. |
gs:// | gs://my-bucket/path/to/data | Google Cloud Storage. |
azure:// | azure://account/container/path | Azure Blob Storage. |
r2:// | r2://account_id.bucket/path | Cloudflare R2. |
https:// | https://example.com/model.bin | Direct URL download. |
@revision suffix (branch, tag, or commit SHA).
Authentication
Private or gated sources require authentication. Add anauth block to your WeightsSource:
- Hugging Face
- S3 (IAM credentials)
- S3 (OIDC)
Store a Hugging Face token as a Baseten secret:
Filtering files
Useallow_patterns and ignore_patterns to download only the files you need:
Storage types overview
Baseten Training provides three types of storage:| Storage type | Persistence | Use case |
|---|---|---|
| Training cache | Persistent between jobs | Large model downloads, preprocessed datasets, shared artifacts. |
| Checkpointing | Backed up to cloud storage | Model checkpoints, training artifacts you want to deploy or download. |
| Ephemeral storage | Cleared after job completes | Temporary files, intermediate outputs. |
Ephemeral storage
Ephemeral storage is cleared when your job completes. Use it for:- Temporary files during training.
- Intermediate outputs that don’t need to persist.
- Scratch space for data processing.
Ephemeral storage is typically limited to a few GBs and cannot affect other containers on the same node.
Loading data in your training script
When data isn’t available through a BDN-supported URI scheme, download it directly in your training script. This works well for datasets loaded from framework-specific libraries or custom download logic.- Amazon S3
- Hugging Face
- Google Cloud Storage
Use Baseten secrets to authenticate to your S3 bucket.
- Add your AWS credentials as secrets in your Baseten account.
-
Reference the secrets in your job configuration:
-
Download from S3 in your training script:
Data size and limits
| Size | Description |
|---|---|
| Small | A few GBs. |
| Medium | Up to 1 TB (most common). |
| Large | 1-10 TB. |
Data security
Data transfer happens within Baseten’s VPC using secure connections. Baseten doesn’t share customer data across tenants and maintains a zero data retention policy. For self-hosted deployments, training can use storage buckets in your own AWS or GCP account.Storage performance
Read and write speeds vary by cluster and storage configuration:| Storage type | Write speed | Read speed |
|---|---|---|
| Node storage | 1.2-1.8 GB/s | 1.7-2.1 GB/s |
| Training cache | 340 MB/s - 1.0 GB/s | 470 MB/s - 1.6 GB/s |
Next steps
- BDN configuration reference: Full list of weight source options, authentication methods, and supported URI schemes.
- Cache: Persist data between jobs and speed up training iterations.
- Checkpointing: Save and manage model checkpoints during training.
- Multinode training: Scale training across multiple nodes with shared cache access.