Skip to content

【PaddleNLP No.5】 update milvus pir #10397

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

Merged
merged 1 commit into from
Apr 18, 2025
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
10 changes: 10 additions & 0 deletions slm/applications/neural_search/recall/milvus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@

```

下载数据集并解压到当前目录:
```shell
wget https://bj.bcebos.com/v1/paddlenlp/data/literature_search_data.zip
unzip literature_search_data.zip
```

<a name="向量检索"></a>

## 5. 向量检索
Expand Down Expand Up @@ -141,6 +147,10 @@ python milvus_ann_search.py --data_path milvus/milvus_data.csv \
* `search`: 是否检索向量
* `batch_size`: 表示的是一次性插入的向量的数量

也可以运行脚本:
```
sh scripts/feature_extract.sh
```

| 数据量 | 时间 |
| ------------ | ------------ |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

from paddlenlp.data import Pad, Tuple
from paddlenlp.transformers import AutoTokenizer
from paddlenlp.utils.env import (
PADDLE_INFERENCE_MODEL_SUFFIX,
PADDLE_INFERENCE_WEIGHTS_SUFFIX,
)

sys.path.append(".")

Expand Down Expand Up @@ -59,8 +63,8 @@ def __init__(
self.max_seq_length = max_seq_length
self.batch_size = batch_size

model_file = model_dir + "/inference.get_pooled_embedding.pdmodel"
params_file = model_dir + "/inference.get_pooled_embedding.pdiparams"
model_file = model_dir + f"/inference.get_pooled_embedding{PADDLE_INFERENCE_MODEL_SUFFIX}"
params_file = model_dir + f"/inference.get_pooled_embedding{PADDLE_INFERENCE_WEIGHTS_SUFFIX}"
if not os.path.exists(model_file):
raise ValueError("not find model file path {}".format(model_file))
if not os.path.exists(params_file):
Expand Down