Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Del Separate Tokenizer Conversion Step for Embeddings Pipeline #2738

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions demos/embeddings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ pip3 install optimum-intel@git+https://github.com/huggingface/optimum-intel.git
Run optimum-cli to download and quantize the model:
```bash
cd demos/embeddings
convert_tokenizer -o models/gte-large-en-v1.5-tokenizer/1 Alibaba-NLP/gte-large-en-v1.5
optimum-cli export openvino --disable-convert-tokenizer --model Alibaba-NLP/gte-large-en-v1.5 --task feature-extraction --weight-format int8 --trust-remote-code --library sentence_transformers models/gte-large-en-v1.5-embeddings/1
rm models/gte-large-en-v1.5-embeddings/1/*.json models/gte-large-en-v1.5-embeddings/1/vocab.txt
optimum-cli export openvino --model Alibaba-NLP/gte-large-en-v1.5 --task feature-extraction --weight-format int8 --trust-remote-code --library sentence_transformers models/gte-large-en-v1.5-embeddings/1
rm models/gte-large-en-v1.5-embeddings/1/*.json models/gte-large-en-v1.5-embeddings/1/vocab.txt
```

> **Note** Change the `--weight-format` to quantize the model to `fp16`, `int8` or `int4` precision to reduce memory consumption and improve performance.

Move the tokenizer to a separate folder to create an embedding pipeline:
```bash
mkdir -p models/gte-large-en-v1.5-tokenizer/1
mv models/gte-large-en-v1.5-embeddings/1/*_tokenizer.* -t models/gte-large-en-v1.5-tokenizer/1
```

You should have a model folder like below:
```bash
tree models/
Expand Down