From 3ee542df3e580c6109328fbfd9d9828c15e22136 Mon Sep 17 00:00:00 2001 From: Jael Gu Date: Thu, 7 Apr 2022 17:33:06 +0800 Subject: [PATCH] Update README Signed-off-by: Jael Gu --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a4f2a10..16d74c8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ *author: Kyle He* - +
## Desription @@ -23,12 +23,14 @@ where embeddings are learned from a small number of questions and passages by a [2].https://arxiv.org/abs/2004.04906 +
+ ## Code Example Use the pretrained model "facebook/dpr-ctx_encoder-single-nq-base" to generate a text embedding for the sentence "Hello, world.". - *Write the pipeline*: +*Write the pipeline*: ```python from towhee import dc @@ -39,6 +41,7 @@ dc.stream(["Hello, world."]) \ .to_list() ``` +
## Factory Constructor @@ -48,12 +51,13 @@ Create the operator via the following factory method **Parameters:** -​ ***model_name***: *str* +***model_name***: *str* -​ The model name in string. +The model name in string. The default value is "facebook/dpr-ctx_encoder-single-nq-base". You can get the list of supported model names by calling `get_model_list` from [dpr.py](https://towhee.io/text-embedding/dpr/src/branch/main/dpr.py). +
## Interface @@ -63,14 +67,13 @@ and then return text embedding in ndarray. **Parameters:** -​ ***text***: *str* - -​ The text in string. +***text***: *str* +The text in string. **Returns**: -​ *numpy.ndarray* +*numpy.ndarray* -​ The text embedding extracted by model. \ No newline at end of file +The text embedding extracted by model. \ No newline at end of file