- Newest
- Most votes
- Most comments
Try fix at the following:
- Enable Internet Access in VPC • Attach a NAT Gateway to your VPC. • Ensure your SageMaker subnet routes outbound traffic through the NAT. • Update your security groups and route tables to allow outbound HTTPS (port 443).
- Use Pre-downloaded Models • Download the Hugging Face model files locally:
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("bert-base-uncased", cache_dir="/opt/ml/model")
• Package them with your inference code and upload to S3. • Point your Batch Transform job to the S3 model location. 3. Use Offline Mode • Set environment variable:
TRANSFORMERS_OFFLINE=1
• This forces the Transformers library to use only local files and skip internet access. 4. Use Hugging Face DLC (Deep Learning Container) • If you're using Hugging Face DLC in SageMaker, make sure the container has the model pre-baked or cached.
Hey,
Hope you're keeping well.
Batch Transform jobs in SageMaker run inside your specified VPC settings, so if your subnets don’t have a NAT Gateway or internet-facing route, the container won’t be able to reach Hugging Face. Check the subnet’s route table to ensure 0.0.0.0/0 points to a NAT Gateway, and verify that the security group allows outbound HTTPS traffic. If internet access isn’t possible, download the model files ahead of time, store them in S3, and reference them locally in your job, or set TRANSFORMERS_OFFLINE=1 so the container uses cached files only.
Thanks and regards,
Taz
answered 9 months ago
