ankane / informers

Fast transformer inference for Ruby
Apache License 2.0
505 stars 10 forks source link

Invalid output name: sentence_embedding #9

Closed mkchoi212 closed 4 hours ago

mkchoi212 commented 5 hours ago

Hey @ankane, thanks for your wonderful work on transformers.rb and neighbors :) Been a happy user of neighbors especially!

Trying to get the basic example working with the provided sample code in the README

sentences = ["This is an example sentence", "Each sentence is converted"]

model = Informers.pipeline("embedding", "sentence-transformers/all-MiniLM-L6-v2")
embeddings = model.(sentences)

but currently getting the following error

OnnxRuntime::Error: Invalid output name: sentence_embedding
from /Users/mike/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/onnxruntime-0.9.2-arm64-darwin/lib/onnxruntime/inference_session.rb:472:in `check_status'
mkchoi212 commented 5 hours ago

Seems like

model = Informers.pipeline("embedding", "Xenova/all-MiniLM-L6-v2", quantized: true)

works though. For reference, I'm on an M1 Macbook

ankane commented 4 hours ago

Hi @mkchoi212, thanks for reporting. Looks like the model was updated a few days ago to have different outputs. Fixed in the commit above.

mkchoi212 commented 4 hours ago

ur amazing thank you!

ankane commented 4 hours ago

No problem, just pushed version 1.1.1.