datasets.load_dataset, or custom download logic. For read-only files in an hf://, s3://, gs://, r2://, or cw:// source, mount them with BDN instead.
Each tab needs the source’s client library in the job’s image: boto3 for Amazon S3, datasets for Hugging Face, and google-cloud-storage for Google Cloud Storage. Use a base_image that includes it, or install it in start_commands before your code runs.
The snippets that set Runtime environment variables go in your job’s config.py, alongside the rest of the job definition described in the quickstart.
To read a bucket without storing a key, mount it with BDN and OIDC instead.
- Amazon S3
- Hugging Face
- Google Cloud Storage
To load data from Amazon S3:
-
Save your AWS credentials as Baseten secrets named
aws_access_key_idandaws_secret_access_key. -
Add this to the job’s
Runtimeinconfig.py: -
Download from S3 in your training script:
The script prints
downloaded <bytes> bytes, where<bytes>is the size of the downloaded file.
Next steps
- Training cache: Keep downloaded data between jobs so later jobs skip the download.
- Load weights and data with BDN: Mount read-only data before your code starts.