@@ -71,8 +71,8 @@ def test_mock_add_custom_models():
71
71
source = ModelSource (hf = "artificial" )
72
72
73
73
num_tokens = 10
74
- dummy_pooled_embedding = np .random .random ((1 , dim )). astype ( np . float32 )
75
- dummy_token_embedding = np .random .random ((1 , num_tokens , dim )). astype ( np . float32 )
74
+ dummy_pooled_embedding = np .random .random ((1 , dim ))
75
+ dummy_token_embedding = np .random .random ((1 , num_tokens , dim ))
76
76
dummy_attention_mask = np .ones ((1 , num_tokens )).astype (np .int64 )
77
77
78
78
dummy_token_output = OnnxOutputContext (
@@ -91,15 +91,11 @@ def test_mock_add_custom_models():
91
91
expected_output = {
92
92
f"{ PoolingType .MEAN .lower ()} -normalized" : normalize (
93
93
mean_pooling (dummy_token_embedding , dummy_attention_mask )
94
- ).astype (np .float32 ),
95
- f"{ PoolingType .MEAN .lower ()} " : mean_pooling (dummy_token_embedding , dummy_attention_mask ),
96
- f"{ PoolingType .CLS .lower ()} -normalized" : normalize (dummy_token_embedding [:, 0 ]).astype (
97
- np .float32
98
94
),
95
+ f"{ PoolingType .MEAN .lower ()} " : mean_pooling (dummy_token_embedding , dummy_attention_mask ),
96
+ f"{ PoolingType .CLS .lower ()} -normalized" : normalize (dummy_token_embedding [:, 0 ]),
99
97
f"{ PoolingType .CLS .lower ()} " : dummy_token_embedding [:, 0 ],
100
- f"{ PoolingType .DISABLED .lower ()} -normalized" : normalize (dummy_pooled_embedding ).astype (
101
- np .float32
102
- ),
98
+ f"{ PoolingType .DISABLED .lower ()} -normalized" : normalize (dummy_pooled_embedding ),
103
99
f"{ PoolingType .DISABLED .lower ()} " : dummy_pooled_embedding ,
104
100
}
105
101
0 commit comments