This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jina import Executor, Document, DocumentArray | |
encoder = Executor.from_hub('jinahub://TransformerTorchEncoder') | |
da = DocumentArray([ | |
Document(text='Jina is a neural search framework.'), | |
Document(text='Jina relies heavily on multiprocessing.'), | |
Document(text='Jina is backed by Jina AI.')]) | |
encoder.encode(docs=da) | |
for doc in da: | |
print(f'{doc.embedding}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformer_tf_text_encode import TransformerTFTextEncoder | |
from jina import Document, DocumentArray | |
encoder = TransformerTFTextEncoder( | |
pretrained_model_name_or_path='hfl/chinese-legal-electra-small-generator', | |
pooling_strategy='cls' | |
) | |
case_1 = { | |
'query': [ |