From 02f4413273be27c35afa5092c986250f96f6cd53 Mon Sep 17 00:00:00 2001 From: Nicholas Zhan Date: Sat, 8 Jun 2024 11:34:18 +0800 Subject: [PATCH] docs(onnx): add additional info for configuration properties and note for ONNX transformer. --- .../antora/modules/ROOT/pages/api/embeddings/onnx.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc index 286f2d8fa..a57d6f23d 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/onnx.adoc @@ -134,6 +134,7 @@ The complete list of supported properties are: | spring.ai.embedding.transformer.cache.enabled | Enable remote Resource caching. | true | spring.ai.embedding.transformer.cache.directory | Directory path to cache remote resources, such as the ONNX models | ${java.io.tmpdir}/spring-ai-onnx-model | spring.ai.embedding.transformer.onnx.modelUri | Existing, pre-trained ONNX model. | onnx/all-MiniLM-L6-v2/model.onnx +| spring.ai.embedding.transformer.onnx.modelOutputName | The ONNX model's output node name, which we'll use for embedding calculation. | last_hidden_state | spring.ai.embedding.transformer.onnx.gpuDeviceId | The GPU device ID to execute on. Only applicable if >= 0. Ignored otherwise. | -1 | spring.ai.embedding.transformer.metadataMode | Specifies what parts of the Documents content and metadata will be used for computing the embeddings. | NONE |=== @@ -143,3 +144,9 @@ NOTE: If you see an error like `Caused by: ai.onnxruntime.OrtException: Supplied ---- spring.ai.embedding.transformer.tokenizer.options.padding=true ---- + +NOTE: If you get an error like `Exception in thread "main" java.lang.IllegalArgumentException: The generative output names doesn't contain expected: last_hidden_state`, you need to set the model output name to a correct value per your models. For example: + +---- +spring.ai.embedding.transformer.onnx.modelOutputName=token_embeddings +---- \ No newline at end of file