Skip to content

SentenceTransformer加载模型的错误警告和输出精度问题 #1815

Closed
@ResDream

Description

@ResDream

Describe the bug/ 问题描述 (Mandatory / 必填)
在使用SentenceTransformer时,正确下载并加载了模型,仍然弹出警告:No sentence-transformers model found with name BAAI/bge-large-zh-v1.5. Creating a new one with MEAN pooling
与PyTorch相比输出差别有点大

  • Hardware Environment(Ascend/GPU/CPU) / 硬件环境:
    ascend和CPU都存在这个问题

  • Software Environment / 软件环境 (Mandatory / 必填):
    -- MindSpore version: 2.4.0和2.3.1
    -- Python version: 3.10
    -- OS platform and distribution: Linux和Windows

To Reproduce / 重现步骤 (Mandatory / 必填)

from mindnlp.sentence import SentenceTransformer
model = SentenceTransformer('BAAI/bge-large-zh-v1.5')
sentences_1 = "The weather is lovely today."
sentences_2 = "It's so sunny outside!"
embeddings_1 = model.encode(sentences_1, normalize_embeddings=True)
embeddings_2 = model.encode(sentences_2, normalize_embeddings=True)
similarity = embeddings_1 @ embeddings_2.T
print(similarity)
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('BAAI/bge-large-zh-v1.5')
sentences_1 = "The weather is lovely today."
sentences_2 = "It's so sunny outside!"
embeddings_1 = model.encode(sentences_1, normalize_embeddings=True)
embeddings_2 = model.encode(sentences_2, normalize_embeddings=True)
similarity = embeddings_1 @ embeddings_2.T
print(similarity)

Expected behavior / 预期结果 (Mandatory / 必填)
A clear and concise description of what you expected to happen.

Screenshots/ 日志 / 截图 (Mandatory / 必填)
If applicable, add screenshots to help explain your problem.
97d0d0b6565a5fff0751a9c25519bafe

Additional context / 备注 (Optional / 选填)
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions