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

[paddle-pipelines] Update offline ann #8353

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion pipelines/utils/offline_ann.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import argparse
import time

from pipelines.document_stores import (
BaiduElasticsearchDocumentStore,
Expand Down Expand Up @@ -139,7 +140,12 @@ def offline_ann(index_name, doc_dir):
use_gpu=use_gpu,
embed_title=args.embed_title,
)

# Writing docs may take a while. so waitting until writing docs to be completed.
document_count = document_store.get_document_count()
while document_count == 0:
time.sleep(1)
print("Waiting for writing docs to be completed.")
document_count = document_store.get_document_count()
# 建立索引库
document_store.update_embeddings(retriever)

Expand Down
8 changes: 7 additions & 1 deletion pipelines/utils/offline_ann_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import argparse
import os
import time

from pipelines.document_stores import ElasticsearchDocumentStore, MilvusDocumentStore
from pipelines.nodes import MultiModalRetriever
Expand Down Expand Up @@ -93,7 +94,12 @@ def offline_ann(index_name, doc_dir):
query_type="image",
document_embedding_models={"text": args.document_embedding_model},
)

# Writing docs may take a while. so waitting until writing docs to be completed.
document_count = document_store.get_document_count()
while document_count == 0:
time.sleep(1)
print("Waiting for writing docs to be completed.")
document_count = document_store.get_document_count()
# 建立索引库
document_store.update_embeddings(retriever_mm)

Expand Down
Loading