Skip to content

Commit a5cce6d

Browse files
authored
Merge pull request #1657 from vespa-engine/kkraune/move-semantic
Demote stale sample app
2 parents 19d6f5b + 92314ff commit a5cce6d

File tree

22 files changed

+31
-40
lines changed

22 files changed

+31
-40
lines changed

README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</picture>
88

99

10-
# Vespa sample applications
10+
# Vespa Sample Applications
1111
The [Vespa](https://vespa.ai/) sample applications are created to run both self-hosted and on Vespa Cloud.
1212
You can easily deploy the sample applications to Vespa Cloud without changing the files -
1313
just follow the same steps as for
@@ -21,7 +21,7 @@ and see [operations](examples/operations) for operational examples.
2121

2222

2323

24-
## Getting started
24+
## Getting Started
2525
[![logo](/assets/vespa-logomark-tiny.png) Album Recommendations](album-recommendation/) is the intro application to Vespa.
2626
Learn how to configure the schema for simple recommendation and search use cases.
2727

@@ -66,14 +66,10 @@ and searching efficiently over these representations.
6666
[![logo](/assets/vespa-logomark-tiny.png) Managed Vector Search using Vespa Cloud](https://github.com/vespa-cloud/vector-search)
6767
describes how to unlock the full potential of multimodal AI-powered vector representations using Vespa Cloud.
6868

69-
[![logo](/assets/vespa-logomark-tiny.png) Simple Semantic Search](simple-semantic-search/)
70-
demonstrates indexed vector search using [HNSW](https://docs.vespa.ai/en/reference/schema-reference.html#index-hnsw),
71-
creating embedding vectors from a transformer language model inside Vespa, and hybrid text and semantic ranking.
72-
This app also demonstrates using native Vespa embedders.
73-
7469
[![logo](/assets/vespa-logomark-tiny.png) Vespa Multi-Vector Indexing with HNSW](multi-vector-indexing/) and
7570
[![logo](/assets/vespa-logomark-tiny.png) Pyvespa: Multi-vector indexing with HNSW](https://pyvespa.readthedocs.io/en/latest/examples/multi-vector-indexing.html)
7671
demonstrate how to index multiple vectors per document field for semantic search for longer documents.
72+
These are more advanced than the Hybrid Search examples in the Getting Started section.
7773

7874
[![logo](/assets/vespa-logomark-tiny.png) Vector Streaming Search](vector-streaming-search)
7975
uses vector streaming search for naturally partitioned data, see the

custom-embeddings/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ Download a frozen embedding model file, see
6767
<pre data-test="exec">
6868
$ mkdir -p models
6969
$ curl -L -o models/tokenizer.json \
70-
https://raw.githubusercontent.com/vespa-engine/sample-apps/master/simple-semantic-search/model/tokenizer.json
70+
https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json
7171

7272
$ curl -L -o models/frozen.onnx \
73-
https://github.com/vespa-engine/sample-apps/raw/master/simple-semantic-search/model/e5-small-v2-int8.onnx
73+
https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx
7474

7575
$ cp models/frozen.onnx models/tuned.onnx
7676
</pre>

examples/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,16 @@ It is built using [FastHTML](https://www.fastht.ml/) and written in pure Python.
109109

110110

111111
### ONNX Model export and deployment example
112-
Use ![logo](/assets/vespa-logomark-tiny.png) [model-deployment](model-deployment) to generate a model in ONNX format in the models directory,
112+
Use [![logo](/assets/vespa-logomark-tiny.png) model-deployment](model-deployment) to generate a model in ONNX format in the models directory,
113113
by running the ONNXModelExport notebook.
114114
<!-- ToDo: improve this -->
115115

116116

117+
### Model exporting
118+
[![logo](/assets/vespa-logomark-tiny.png) Model exporting](model-exporting)
119+
demonstrates how to export a Huggingface sentence-transformer model to ONNX format.
120+
121+
117122
### Reranker sample application
118123
[![logo](/assets/vespa-logomark-tiny.png) reranker](reranker) is a stateless application which re-ranks results obtained from another Vespa application.
119124
While this does not result in good performance and is not recommended for production,

examples/fasthtml-demo/deploy_app.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@
191191
" Parameter(\n",
192192
" \"transformer-model\",\n",
193193
" {\n",
194-
" \"url\": \"https://github.com/vespa-engine/sample-apps/raw/master/simple-semantic-search/model/e5-small-v2-int8.onnx\"\n",
194+
" \"url\": \"https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx\"\n",
195195
" },\n",
196196
" ),\n",
197197
" Parameter(\n",
198198
" \"tokenizer-model\",\n",
199199
" {\n",
200-
" \"url\": \"https://raw.githubusercontent.com/vespa-engine/sample-apps/master/simple-semantic-search/model/tokenizer.json\"\n",
200+
" \"url\": \"https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json\"\n",
201201
" },\n",
202202
" ),\n",
203203
" ],\n",
File renamed without changes.
File renamed without changes.

simple-semantic-search/README.md examples/model-exporting/README.md

+7-16
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,17 @@
77
<img alt="#Vespa" width="200" src="https://assets.vespa.ai/logos/Vespa-logo-dark-RGB.svg" style="margin-bottom: 25px;">
88
</picture>
99

10-
# Vespa sample applications - Simple semantic search
11-
12-
A minimal semantic search application:
13-
- Query and document text is converted to embeddings by the application using Vespa's [embedder functionality](https://docs.vespa.ai/en/embedding.html#huggingface-embedder).
14-
- Search by embedding or text match and use [reciprocal rank fusion](https://docs.vespa.ai/en/phased-ranking.html#cross-hit-normalization-including-reciprocal-rank-fusion) to fuse
15-
different rankings.
16-
17-
<p data-test="run-macro init-deploy simple-semantic-search">
18-
minimum-required-vespa-version="8.311.28"
19-
</p>
10+
# Vespa sample applications - Model Exporting
11+
This example demonstrates how to export a Huggingface sentence-transformer model to ONNX format.
2012

2113
## To try this application
2214

2315
Follow [Vespa getting started](https://cloud.vespa.ai/en/getting-started)
24-
through the <code>vespa deploy</code> step, cloning `simple-semantic-search` instead of `album-recommendation`.
16+
through the <code>vespa deploy</code> step, using this example instead of `album-recommendation`.
17+
18+
<p data-test="run-macro init-deploy examples/model-exporting">
19+
minimum-required-vespa-version="8.311.28"
20+
</p>
2521

2622
Feed documents (this includes embed inference in Vespa):
2723

@@ -55,11 +51,6 @@ Remove the container after use:
5551
$ docker rm -f vespa
5652
</pre>
5753

58-
## Ready for production
59-
60-
The E5-small-v2 [embedding model](https://huggingface.co/intfloat/e5-small-v2) used in this sample application
61-
is suitable for production use and will produce good results in many domains without fine-tuning,
62-
especially when combined with text match features.
6354

6455
## Model exporting
6556
Transformer-based embedding models have named inputs and outputs that must
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

multi-vector-indexing/services.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<!-- See https://docs.vespa.ai/en/embedding.html#huggingface-embedder -->
99
<component id="e5" type="hugging-face-embedder">
10-
<transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/simple-semantic-search/model/e5-small-v2-int8.onnx"/>
11-
<tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/simple-semantic-search/model/tokenizer.json"/>
10+
<transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx"/>
11+
<tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json"/>
1212
<prepend> <!-- E5 prompt instructions -->
1313
<query>query:</query>
1414
<document>passage:</document>

multilingual-search/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $ vespa clone multilingual-search my-app && cd my-app
6464
This sample app embedder configuration in [services.xml](services.xml) points to a quantized model.
6565

6666
Alternatively, [export your own model](https://docs.vespa.ai/en/onnx.html#onnx-export), see also the
67-
export script in [simple-semantic-search](../simple-semantic-search/README.md).
67+
export script in [simple-semantic-search](/examples/model-exporting/README.md).
6868

6969
Deploy the application :
7070
<pre data-test="exec" data-test-assert-contains="Success">

questions.jsonl

+3-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@
4242
{"update": "id:vespaapps-p:paragraph::vespaapps/multi-vector-indexing/-hybrid-search-and-ranking", "fields": {"questions": {"assign": ["What is hybrid rank-profile?", "What additional features does hybrid rank-profile calculate?", "What is the purpose of second-phase ranking?"]}}}
4343
{"update": "id:vespaapps-p:paragraph::vespaapps/multi-vector-indexing/-hybrid-search-and-filter", "fields": {"questions": {"assign": ["What is hybrid ranking?", "What is filtering?"]}}}
4444
{"update": "id:vespaapps-p:paragraph::vespaapps/multi-vector-indexing/-cleanup", "fields": {"questions": {"assign": ["How to tear down a Docker container?"]}}}
45-
{"update": "id:vespaapps-p:paragraph::vespaapps/simple-semantic-search/-vespa-sample-applications---simple-semantic-search", "fields": {"questions": {"assign": ["What is a semantic search?", "How does Vespa enable semantic search?", "What is the minimum Vespa version needed for semantic search?", "What are the requirements to use Vespa semantic search?", "What is the benefit of using Vespa semantic search over regular text match search?"]}}}
46-
{"update": "id:vespaapps-p:paragraph::vespaapps/simple-semantic-search/-to-try-this", "fields": {"questions": {"assign": ["What is nearestNeighbor in Vespa?", "What is the 'vespa deploy' step?", "What is simple-semantic-search?", "How do you deploy simple-semantic-search?"]}}}
47-
{"update": "id:vespaapps-p:paragraph::vespaapps/simple-semantic-search/-ready-for-production", "fields": {"questions": {"assign": ["What are the domains suited for the model?", "Does the model require fine-tuning?", "What features can improve the model results?"]}}}
48-
{"update": "id:vespaapps-p:paragraph::vespaapps/simple-semantic-search/-model-exporting", "fields": {"questions": {"assign": ["How to export Huggingface model?", "What is onnx format?"]}}}
45+
{"update": "id:vespaapps-p:paragraph::vespaapps/examples/model-exporting/-to-try-this", "fields": {"questions": {"assign": ["What is nearestNeighbor in Vespa?", "What is the 'vespa deploy' step?", "What is simple-semantic-search?", "How do you deploy simple-semantic-search?"]}}}
46+
{"update": "id:vespaapps-p:paragraph::vespaapps/examples/model-exporting/-ready-for-production", "fields": {"questions": {"assign": ["What are the domains suited for the model?", "Does the model require fine-tuning?", "What features can improve the model results?"]}}}
47+
{"update": "id:vespaapps-p:paragraph::vespaapps/examples/model-exporting/-model-exporting", "fields": {"questions": {"assign": ["How to export Huggingface model?", "What is onnx format?"]}}}
4948
{"update": "id:vespaapps-p:paragraph::vespaapps/billion-scale-image-search/-billion-scale-image-search", "fields": {"questions": {"assign": ["What is the image search application?", "What is multimodal AI?", "What is the billion-scale-vector-search application?"]}}}
5049
{"update": "id:vespaapps-p:paragraph::vespaapps/billion-scale-image-search/-the-vector-dataset", "fields": {"questions": {"assign": ["What is LAION 5B?", "What is CLIP?", "What is StableDiffusion?", "What is the use of LAION 5B?", "What does LAION 5B consist of?"]}}}
5150
{"update": "id:vespaapps-p:paragraph::vespaapps/billion-scale-image-search/-use-cases", "fields": {"questions": {"assign": ["What is LAION dataset?", "What is CLIP retrieval?", "What is Vespa's query language?"]}}}

test/_test_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
22

33
urls:
4+
- examples/model-exporting/README.md
45
- splade/README.md
56
- colbert-long/README.md
67
- multi-vector-indexing/README.md
78
- vector-streaming-search/README.md
89
- custom-embeddings/README.md
910
- commerce-product-ranking/README.md
10-
- simple-semantic-search/README.md
1111
- colbert/README.md
1212
- text-image-search/README.md
1313
- text-search/README.md

use-case-shopping/src/main/bash/download_models.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ mkdir -p $DIR
88

99
echo "Downloading encoder model"
1010
curl -L -o $DIR/e5-small-v2-int8.onnx \
11-
https://github.com/vespa-engine/sample-apps/blob/master/simple-semantic-search/model/e5-small-v2-int8.onnx?raw=true
11+
https://github.com/vespa-engine/sample-apps/blob/master/examples/model-exporting/model/e5-small-v2-int8.onnx?raw=true
1212

1313
echo "Downloading vocab"
1414
curl -L -o $DIR/tokenizer.json \
15-
https://raw.githubusercontent.com/vespa-engine/sample-apps/master/simple-semantic-search/model/tokenizer.json
15+
https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json

vector-streaming-search/services.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<!-- See https://docs.vespa.ai/en/embedding.html#huggingface-embedder -->
99
<component id="e5-small-q" type="hugging-face-embedder">
10-
<transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/simple-semantic-search/model/e5-small-v2-int8.onnx"/>
11-
<tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/simple-semantic-search/model/tokenizer.json"/>
10+
<transformer-model url="https://github.com/vespa-engine/sample-apps/raw/master/examples/model-exporting/model/e5-small-v2-int8.onnx"/>
11+
<tokenizer-model url="https://raw.githubusercontent.com/vespa-engine/sample-apps/master/examples/model-exporting/model/tokenizer.json"/>
1212
<!-- E5 prompt instructions -->
1313
<prepend>
1414
<query>query:</query>

0 commit comments

Comments
 (0)