You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import (
"bufio"
"context"
"fmt"
"io"
"os"
"github.com/nlpodyssey/cybertron/pkg/models/bert"
"github.com/nlpodyssey/cybertron/pkg/tasks"
"github.com/nlpodyssey/cybertron/pkg/tasks/textencoding"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
const limit = 10 // number of dimensions to show
// https://github.com/nlpodyssey/cybertron/tree/main/examples/textencoding
func main() {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
modelsDir := "llms"
modelName := "nomic-ai/nomic-embed-text-v1.5"
m, err := tasks.Load[textencoding.Interface](&tasks.Config{ModelsDir: modelsDir, ModelName: modelName})
if err != nil {
log.Fatal().Err(err).Send()
}
fn := func(text string) error {
result, err := m.Encode(context.Background(), text, int(bert.MeanPooling))
if err != nil {
return err
}
fmt.Println(result.Vector.Data().F64()[:limit])
return nil
}
err = ForEachInput(os.Stdin, fn)
if err != nil {
log.Fatal().Err(err).Send()
}
}
// ForEachInput calls the given callback function for each line of input.
func ForEachInput(r io.Reader, callback func(text string) error) error {
scanner := bufio.NewScanner(r)
for {
fmt.Print("> ")
scanner.Scan()
text := scanner.Text()
if text == "" {
break
}
if err := callback(text); err != nil {
return err
}
}
return nil
}
Logs
{"level":"debug","file":"llms/nomic-ai/nomic-embed-text-v1.5/config.json","time":"2024-10-31T16:21:52-03:00","message":"model file already exists, skipping download"}
{"level":"fatal","error":"unsupported model type for download: \"nomic_bert\"","time":"2024-10-31T16:21:52-03:00"}
However, it is giving an error, I don't understand very well.
thank you for your attention
The text was updated successfully, but these errors were encountered:
Hello everyone, how are you?
Cybertron is compatible with the nomic-ai/nomic-embed-text-v1.5 model. Does anyone have an example of how I can use it?
I adapted this example to use the model
Logs
However, it is giving an error, I don't understand very well.
thank you for your attention
The text was updated successfully, but these errors were encountered: