| 12345678910111213141516171819 |
- import chromadb
- client = chromadb.HttpClient(host='47.101.198.30',port=8000)
- collection = client.get_or_create_collection(name="tj_de_bge")
- from FlagEmbedding import FlagModel
- model = FlagModel('/Users/zxp/Downloads/test2_encoder_only_base_bge-large-zh-v1.5')
- import json
- with open("name_label", "r") as f:
- content = f.read()
- obj = json.loads(content)
- for entry in obj:
- print(entry)
- sentences = [obj[entry]]
- embeddings = model.encode(sentences)
- collection.add(
- ids=[entry],
- embeddings=embeddings,
- documents=sentences
- )
|