Git Product home page Git Product logo

Comments (3)

jianhai0527 avatar jianhai0527 commented on July 18, 2024

您好,不好意思,这个是我们SDK的bug,预计在2月中旬版本修复发布;
具体原因是:inference的时候,model没有设置eval模式,导致带有随机性,只影响get_sentence_embedding方法;
当前可使用如下代码获得句向量表示:

from modelscope.preprocessors import Preprocessor
from modelscope.models import Model

model = Model.from_pretrained('damo/nlp_structbert_faq-question-answering_chinese-base')
preprocessor = Preprocessor.from_pretrained(model.model_dir)

inputs = ['如何使用优惠券', '今天有免费的10元无门槛吗', '购物评级怎么看']

inputs_processed = preprocessor.batch_encode(inputs, max_length=30)

model.eval()

sentence_vecs = model.forward_sentence_embedding(inputs_processed)

from modelscope.

github-actions avatar github-actions commented on July 18, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

from modelscope.

github-actions avatar github-actions commented on July 18, 2024

This issue was closed because it has been stalled for 5 days with no activity.

from modelscope.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.