Support token embeddings in bert

This commit is contained in:
mudler
2023-05-12 14:11:00 +02:00
parent 98d5c2a830
commit aa9df08809
2 changed files with 2 additions and 2 deletions

View File

@@ -68,7 +68,7 @@ func ModelEmbedding(s string, tokens []int, loader *model.ModelLoader, c Config)
case *bert.Bert:
fn = func() ([]float32, error) {
if len(tokens) > 0 {
return nil, fmt.Errorf("embeddings endpoint for this model supports only string")
return model.TokenEmbeddings(tokens, bert.SetThreads(c.Threads))
}
return model.Embeddings(s, bert.SetThreads(c.Threads))
}