Skip to content

Commit 18d70df

Browse files
committed
add huggingface tei example
1 parent 01acdcd commit 18d70df

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
import sys
3+
sys.path.append(".")
4+
from modelcache.embedding.huggingface_tei import HuggingfaceTEI
5+
6+
'''
7+
run tei server:
8+
text-embeddings-router --model-id BAAI/bge-large-zh-v1.5 --port 8080
9+
'''
10+
11+
def run():
12+
tei_instance = HuggingfaceTEI('http://127.0.0.1:8080/v1/embeddings', 'BAAI/bge-large-zh-v1.5')
13+
print('dimenson', tei_instance.dimension)
14+
print('embedding', tei_instance.to_embeddings('hello'))
15+
16+
if __name__ == '__main__':
17+
run()

0 commit comments

Comments
 (0)