Introducing the Hugging Face Embedding Container for Amazon SageMaker
The Hugging Face Embedding Container for Amazon SageMaker, built on Text Embedding Inference (TEI), is now generally available for deploying open embedding models such as Snowflake Arctic Embed and BGE. TEI uses token-based dynamic batching, Flash Attention and Candle, and ships separate CPU and GPU images. A walkthrough with the sagemaker Python SDK covers retrieving the image URI, deploying snowflake-arctic-embed-m-v1.5 and load testing it. In the test, embedding ~1M tokens took about 841s (~5 req/s, 2s latency) on a ~$150/month CPU instance versus about 30s (~130 req/s, 4ms latency) on an ml.g5.xlarge A10G GPU at $1.408/hour. The recommendation is GPUs for bulk embedding and CPUs for low-cost endpoints.
Related posts
- Deploy Embedding Models with Hugging Face Inference Endpoints
Hugging Face mediumAdeptOpen-source embedding models such as BAAI/bge-base-en-v1.5 can be deployed on Hugging Face Inference Endpoints using Text Embeddings Inference (TEI), which offers token-based dynamic batching, Flash Attention, Candle and cuBLASLt kernels, safetensors loading, small images for fast boot, and OpenTelemetry/Prometheus support. Deployment is click-through: pick a model, cloud, region and instance, such as an Nvidia A10G instead of the suggested CPU instance. Batch requests are sent over HTTP with `truncate: true`, because TEI does not truncate inputs by default. A benchmark at sequence length 512 and batch size 32 reached 450+ req/sec, about $0.00000156 per 1k tokens, which Hugging Face says is 64x cheaper than OpenAI embeddings.
- Introducing the Hugging Face LLM Inference Container for Amazon SageMaker
Hugging Face mediumAdeptHugging Face's LLM Inference Deep Learning Container for Amazon SageMaker is built on Text Generation Inference (TGI), which provides tensor parallelism, continuous batching, flash-attention, bitsandbytes quantization, safetensors loading and SSE token streaming. The walkthrough deploys the 12B Pythia Open Assistant model on an ml.g5.12xlarge instance (4 A10G GPUs) using the sagemaker Python SDK, with environment variables for GPU count and token limits. It then covers TGI generation parameters such as temperature, top_p, stop sequences and repetition penalty, and builds a Gradio chatbot on top of the endpoint. For a cheaper setup, a g5.2xlarge with int8 quantization is suggested.
- Hugging Face Text Generation Inference available for AWS Inferentia2
Hugging Face mediumAdeptText Generation Inference (TGI) is now generally available on AWS Inferentia2 through Amazon SageMaker, offering an alternative to GPUs for serving open LLMs such as Llama and Mistral. A walkthrough deploys Zephyr 7B on an ml.inf2.8xlarge using the TGI Neuronx container. Because Inferentia2 lacks dynamic shapes, batch size, sequence length, core count and cast type must be fixed at compile time. A neuron model cache provides pre-compiled configurations; compiling an uncached one with optimum-cli can take up to 45 minutes. The deployment environment variables (HF_NUM_CORES, HF_BATCH_SIZE, HF_SEQUENCE_LENGTH, MAX_TOTAL_TOKENS) must match those compile-time settings.
- Deploy Hugging Face models easily with Amazon SageMaker
Hugging Face mediumAdeptHugging Face Inference Deep Learning Containers and the SageMaker Hugging Face Inference Toolkit let Transformers models be deployed as SageMaker endpoints with a few lines of Python, using transformers pipelines for zero-code pre- and post-processing. Models can be deployed straight after a SageMaker training job via the Estimator, from a model.tar.gz in S3 via HuggingFaceModel's model_data, or directly from the Model Hub by setting the HF_MODEL_ID and HF_TASK environment variables. Requests use an `inputs` key plus optional pipeline `parameters`, and custom inference code can override the defaults when needed.
- How to deploy and fine-tune DeepSeek models on AWS
Hugging Face mediumAdeptDeepSeek-R1's distilled Llama and Qwen models can be deployed on AWS through Hugging Face Inference Endpoints, Bedrock Marketplace, SageMaker with Hugging Face LLM DLCs (TGI v3) on GPUs or Neuron, and EC2 Inferentia via the Hugging Face Neuron AMI. The guide includes SageMaker Python SDK code and a recommended instance table (e.g. ml.g6.48xlarge with 8 GPUs for the 70B distill), plus Neuron settings such as 24 cores, bf16, batch size 4 and 4096 total tokens using pre-compiled models. The full R1 runs on Inference Endpoints as an Unsloth GGUF quantization for about $8.3/hour, while full-R1 SageMaker deployment and all fine-tuning paths are still marked as coming soon.