From 0a584f0dc2483ef9ad0741c8598998e489b64726 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Fri, 10 Nov 2023 08:05:47 +0100 Subject: [PATCH] Transformers embedding Readme clarifications --- embedding-clients/transformers-embedding/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/embedding-clients/transformers-embedding/README.md b/embedding-clients/transformers-embedding/README.md index 1e03a7eb2c0..a7a2b88dcbe 100644 --- a/embedding-clients/transformers-embedding/README.md +++ b/embedding-clients/transformers-embedding/README.md @@ -59,6 +59,7 @@ TransformersEmbeddingClient embeddingClient = new TransformersEmbeddingClient(); // (optional) defaults to classpath:/onnx/all-MiniLM-L6-v2/tokenizer.json embeddingClient.setTokenizerResource("classpath:/onnx/all-MiniLM-L6-v2/tokenizer.json"); + // (optional) defaults to classpath:/onnx/all-MiniLM-L6-v2/model.onnx embeddingClient.setModelResource("classpath:/onnx/all-MiniLM-L6-v2/model.onnx"); @@ -68,11 +69,14 @@ embeddingClient.setResourceCacheDirectory("/tmp/onnx-zoo"); embeddingClient.afterPropertiesSet(); -List> embeddings = - embeddingClient.embed(List.of("Hello world", "World is big")); +List> embeddings = embeddingClient.embed(List.of("Hello world", "World is big")); ``` +The first `embed()` call downloads the the large ONNX model and caches it on the local file system. +Therefore the first call might take longer than usual. +Use the `#setResourceCacheDirectory()` to set the local folder where the ONNX models as stored. +The default cache folder is `${java.io.tmpdir}/spring-ai-onnx-model`.