https://docs.python.org/3/tutorial/venv.html
source tutorial-env/bin/activate
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('/root/.cache/huggingface/moka-ai/m3e-small')
# 准备一些测试文本,用于生成文本向量
sentences = [
'* Moka 此文本嵌入模型由 MokaAI 训练并开源,训练脚本使用 uniem'
]
# 调用模型生成文本向量
embeddings = model.encode(sentences)
# 打印向量计算结果
for sentence, embedding in zip(sentences, embeddings):
print("文本内容:", sentence)
print("文本向量:", embedding)
print("")
yum install git-lfs
pip install sentence-transformers -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
https://docs.trychroma.com/js_reference/Collection
https://www.cnblogs.com/rude3knife/p/chroma_tutorial.html
curl -H "Content-Type:application/json" -X POST --data '{"doc_list": ["Hello","world"]}' http://127.0.0.1:5000/embedding
python -m venv tutorial-env
source tutorial-env/bin/activate
pip install Flask -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install gevent -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
python main.py