@@ -47,31 +47,30 @@ func TestEmbedAllMiniLML6V2(t *testing.T) {
47
47
}
48
48
}
49
49
50
- //
51
50
// Breaks on GH Actions
52
51
// --- FAIL: TestEmbedBGESmallEN (2.29s)
53
- // fastembed_test.go:63: Expected no error, got The tensor's shape ([1 512]) requires 512 elements, but only 8 were provided
54
52
//
55
- // func TestEmbedBGESmallEN(t *testing.T) {
56
- // // Test with a single input
57
- // fe, err := NewFlagEmbedding(&InitOptions{
58
- // Model: BGESmallEN,
59
- // })
60
- // defer fe.Destroy()
61
- // if err != nil {
62
- // t.Fatalf("Expected no error, got %v", err)
63
- // }
64
- // input := []string{"Is the world doing okay?"}
65
- // result, err := fe.Embed(input, 1)
66
- // if err != nil {
67
- // t.Fatalf("Expected no error, got %v", err)
68
- // }
53
+ // fastembed_test.go:63: Expected no error, got The tensor's shape ([1 512]) requires 512 elements, but only 8 were provided
54
+ func TestEmbedBGESmallEN (t * testing.T ) {
55
+ // Test with a single input
56
+ fe , err := NewFlagEmbedding (& InitOptions {
57
+ Model : BGESmallEN ,
58
+ })
59
+ defer fe .Destroy ()
60
+ if err != nil {
61
+ t .Fatalf ("Expected no error, got %v" , err )
62
+ }
63
+ input := []string {"Is the world doing okay?" }
64
+ result , err := fe .Embed (input , 1 )
65
+ if err != nil {
66
+ t .Fatalf ("Expected no error, got %v" , err )
67
+ }
69
68
70
- // fmt.Printf("result: %v\n", result[0][0:10])
71
- // if len(result) != len(input) {
72
- // t.Errorf("Expected result length %v, got %v", len(input), len(result))
73
- // }
74
- // }
69
+ fmt .Printf ("result: %v\n " , result [0 ][0 :10 ])
70
+ if len (result ) != len (input ) {
71
+ t .Errorf ("Expected result length %v, got %v" , len (input ), len (result ))
72
+ }
73
+ }
75
74
76
75
// A model type "Unigram" is not yet supported by the tokenizer
77
76
// Ref: https://github.com/sugarme/tokenizer/blob/448e79b1ed65947b8c6343bf9aa39e78364f45c8/pretrained/model.go#L152
0 commit comments