184.9K 5 months ago

https://huggingface.co/DMetaSoul/Dmeta-embedding-zh

embedding

Models

View all →

Readme

shaw/dmeta-embedding-zh is a Chinese Embedding model with just 100M parameters and supports context length of 1024, compute efficient, and suitable for many task scenarios. It has excellent results on the MTEB benchmark and is especially suitable for semantic vector retrieval, RAG and other LLM applications.

shaw/dmeta-embedding-zh 是一个极其轻量、推理高效的中文向量化模型,参数规模仅 100M 、支持 1K 上下文长度,并且在通用检索、RAG、相似问题检索等场景都有优秀的表现。

Note: This model requires ollama version 0.5.4 or later. This model is an embedding model, meaning it can only be used to generate embeddings.

Note: The compatibility issue with ollama 0.6.x has been fixed, please check FAQ for the solution.(之前社区反馈使用ollama 0.6.x时遇到模型加载报错的问题,现在已经修复,把本地模型删除再重新下载即可,具体参考下文 FAQ)

Usage

You should pull and run model into your computer first as following:

ollama pull shaw/dmeta-embedding-zh

After the above command is done, the model is already running on your computer. Then you can call the ollama embedding api via the following methods.

REST API

New API: The endpoint is /api/embed. The argument input is a single text or a list of text to generate embeddings for.

curl http://localhost:11434/api/embed -d '{
  "model": "shaw/dmeta-embedding-zh",
  "input": "天空是灰色的"
}'

curl http://localhost:11434/api/embed -d '{
  "model": "shaw/dmeta-embedding-zh",
  "input": ["天空是灰色的", "天空是蓝色的"]
}'

Deprecated API: The endpoint is /api/embeddings. The argument prompt is a single text to generate embeddings for.

curl http://localhost:11434/api/embeddings -d '{
  "model": "shaw/dmeta-embedding-zh",
  "prompt": "天空是灰色的"
}'

Python SDK

ollama.embeddings(model='shaw/dmeta-embedding-zh', input='天空是灰色的')

Deprecated API

ollama.embeddings(model='shaw/dmeta-embedding-zh', prompt='天空是灰色的')

Javascript SDK

ollama.embeddings({ model: 'shaw/dmeta-embedding-zh', input: '天空是灰色的' })

Deprecated API

ollama.embeddings({ model: 'shaw/dmeta-embedding-zh', prompt: '天空是灰色的' })

Java SDK

EmbeddingResponse embeddingResponse = embeddingClient.call(
    new EmbeddingRequest(List.of("天空是灰色的", "天空是蓝色的"),
        OllamaOptions.create()
            .withModel("shaw/dmeta-embedding-zh"));

FAQ

1) When i use ollama 0.6 above, get error like {"error":"unable to load model: /Users/my-user-name/.ollama/models/blobs/sha256-26bd607a51eb1f3a0d3beac444b977e03fa745def499add60c996c08c8c2ddcd"}, how to fix it?

The compatibility issue with ollama 0.6.x has been fixed, please delete and re-download the model as following

ollama rm shaw/dmeta-embedding-zh

ollama pull shaw/dmeta-embedding-zh

2) Where can i find more about Ollama api details?

Ollama generate embeddings api

3) How can i downgrade Ollama version?

Please go to the Ollama’s github release page, pick the version you would like, download and install it.

4) Join Us | 加入我们

At the same time, you are welcome to scan the QR code to join our WeChat group and build the AIGC technology ecosystem together!

image.png