Skip to content

Commit bc1b452

Browse files
committed
Improve error message in text embedding when configured output is Axon.None
1 parent 79199e0 commit bc1b452

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/bumblebee/text.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ defmodule Bumblebee.Text do
381381
382382
* `:mean_pooling` - performs a mean across all tokens
383383
384-
* `cls_token_pooling` - takes the embedding for the special CLS token.
384+
* `:cls_token_pooling` - takes the embedding for the special CLS token.
385385
Note that we currently assume that the CLS token is the first token
386386
in the sequence
387387

lib/bumblebee/text/text_embedding.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ defmodule Bumblebee.Text.TextEmbedding do
4242

4343
output =
4444
case output do
45+
%{^output_attribute => %Axon.None{}} ->
46+
keys = output |> Map.keys() |> Enum.sort()
47+
48+
raise ArgumentError,
49+
"key #{inspect(output_attribute)} in the output map has value %Axon.None{}," <>
50+
" make sure this is the correct key and check module documentation incase it is opt-in." <>
51+
" The output map keys are: #{inspect(keys)}"
52+
4553
%{^output_attribute => output} ->
4654
output
4755

0 commit comments

Comments
 (0)