From 518c0b8737a1f57a53f0b9cba13d106e769a9f46 Mon Sep 17 00:00:00 2001 From: Jael Gu Date: Thu, 7 Apr 2022 17:27:07 +0800 Subject: [PATCH] Update README Signed-off-by: Jael Gu --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d4dfc04..85afa8d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ *author: Jael Gu* - +
## Desription @@ -10,12 +10,14 @@ A text embedding operator takes a sentence, paragraph, or document in string as and output an embedding vector in ndarray which captures the input's core semantic elements. This operator is implemented with pretrained models from [Huggingface Transformers](https://huggingface.co/docs/transformers). +
+ ## Code Example Use the pretrained model 'distilbert-base-cased' to generate a text embedding for the sentence "Hello, world.". - *Write the pipeline*: +*Write the pipeline*: ```python from towhee import dc @@ -26,6 +28,8 @@ dc.stream(["Hello, world."]) \ .to_list() ``` +
+ ## Factory Constructor Create the operator via the following factory method @@ -34,11 +38,12 @@ 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. You can get the list of supported model names by calling `get_model_list` from [auto_transformers.py](https://towhee.io/text-embedding/transformers/src/branch/main/auto_transformers.py). +
## Interface @@ -49,15 +54,14 @@ 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. +The text embedding extracted by model.