SageMaker Endpoints Embeddings 类。如果您在 SageMaker 上托管例如您自己的 Hugging Face 模型,可以使用该类。
有关如何执行此操作的说明,请参见 SageMaker 上使用 Hugging Face 进行自定义推理。
注意:为了处理批量请求,您需要调整自定义 inference.py 脚本中 predict_fn() 函数内的返回行:
从
return {"vectors": sentence_embeddings[0].tolist()}
改为:
return {"vectors": sentence_embeddings.tolist()}。
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

