@ -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.
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).
This operator is implemented with pretrained models from [Huggingface Transformers](https://huggingface.co/docs/transformers).
<br/>
## Code Example
## Code Example
Use the pretrained model 'distilbert-base-cased'
Use the pretrained model 'distilbert-base-cased'
to generate a text embedding for the sentence "Hello, world.".
to generate a text embedding for the sentence "Hello, world.".
*Write the pipeline*:
*Write the pipeline*:
```python
```python
from towhee import dc
from towhee import dc
@ -26,6 +28,8 @@ dc.stream(["Hello, world."]) \
.to_list()
.to_list()
```
```
<br/>
## Factory Constructor
## Factory Constructor
Create the operator via the following factory method
Create the operator via the following factory method
@ -34,11 +38,12 @@ Create the operator via the following factory method
**Parameters:**
**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).
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).
<br/>
## Interface
## Interface
@ -49,15 +54,14 @@ and then return text embedding in ndarray.