Skip to content

Commit

Permalink
Fixed error with sentence-transformers/all-MiniLM-L6-v2 - fixes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 15, 2024
1 parent 40f075a commit 4d98be3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 1.1.1 (unreleased)

- Added `audio-classification` pipeline
- Fixed error with `sentence-transformers/all-MiniLM-L6-v2`

## 1.1.0 (2024-09-17)

Expand Down
5 changes: 3 additions & 2 deletions lib/informers/pipelines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ def call(
if !model_output.nil?
model_options[:output_names] = Array(model_output)
elsif @model.instance_variable_get(:@output_names) == ["token_embeddings"] && pooling == "mean" && normalize
# optimization for sentence-transformers/all-MiniLM-L6-v2
# optimization for previous revision of sentence-transformers/all-MiniLM-L6-v2
model_options[:output_names] = ["sentence_embedding"]
pooling = "none"
normalize = false
Expand Down Expand Up @@ -1402,7 +1402,8 @@ def pipeline(
results = load_items(classes, model, pretrained_options)
results[:task] = task

if model == "sentence-transformers/all-MiniLM-L6-v2"
# for previous revision of sentence-transformers/all-MiniLM-L6-v2
if model == "sentence-transformers/all-MiniLM-L6-v2" && results[:model].instance_variable_get(:@session).outputs.any? { |v| v[:name] == "token_embeddings" }
results[:model].instance_variable_set(:@output_names, ["token_embeddings"])
end

Expand Down

0 comments on commit 4d98be3

Please sign in to comment.