Fixed merge conflicts
This commit is contained in:
parent
42a916ad4f
commit
b0725b46fb
|
@ -69,12 +69,14 @@ TEST(TextEmbedderTest, SucceedsWithCosineSimilarity) {
|
||||||
std::string model_path = GetFullPath(kTestBertModelPath);
|
std::string model_path = GetFullPath(kTestBertModelPath);
|
||||||
TextEmbedderOptions options = {
|
TextEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ model_path.c_str()},
|
/* model_asset_path= */ model_path.c_str()},
|
||||||
/* embedder_options= */
|
/* embedder_options= */
|
||||||
{/* l2_normalize= */ false,
|
{/* l2_normalize= */ false,
|
||||||
/* quantize= */ false}};
|
/* quantize= */ false}};
|
||||||
|
|
||||||
void* embedder = text_embedder_create(&options);
|
void* embedder = text_embedder_create(&options,
|
||||||
|
/* error_msg */ nullptr);
|
||||||
EXPECT_NE(embedder, nullptr);
|
EXPECT_NE(embedder, nullptr);
|
||||||
|
|
||||||
// Extract both embeddings.
|
// Extract both embeddings.
|
||||||
|
@ -89,7 +91,7 @@ TEST(TextEmbedderTest, SucceedsWithCosineSimilarity) {
|
||||||
&similarity);
|
&similarity);
|
||||||
double expected_similarity = 0.98077;
|
double expected_similarity = 0.98077;
|
||||||
EXPECT_LE(abs(similarity - expected_similarity), kPrecision);
|
EXPECT_LE(abs(similarity - expected_similarity), kPrecision);
|
||||||
text_embedder_close(embedder);
|
text_embedder_close(embedder, /* error_msg */ nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TextEmbedderTest, ErrorHandling) {
|
TEST(TextEmbedderTest, ErrorHandling) {
|
||||||
|
|
|
@ -63,6 +63,7 @@ TEST(ImageEmbedderTest, ImageModeTest) {
|
||||||
const std::string model_path = GetFullPath(kModelName);
|
const std::string model_path = GetFullPath(kModelName);
|
||||||
ImageEmbedderOptions options = {
|
ImageEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ model_path.c_str()},
|
/* model_asset_path= */ model_path.c_str()},
|
||||||
/* running_mode= */ RunningMode::IMAGE,
|
/* running_mode= */ RunningMode::IMAGE,
|
||||||
/* embedder_options= */
|
/* embedder_options= */
|
||||||
|
@ -98,6 +99,7 @@ TEST(ImageEmbedderTest, SucceedsWithCosineSimilarity) {
|
||||||
const std::string model_path = GetFullPath(kModelName);
|
const std::string model_path = GetFullPath(kModelName);
|
||||||
ImageEmbedderOptions options = {
|
ImageEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ model_path.c_str()},
|
/* model_asset_path= */ model_path.c_str()},
|
||||||
/* running_mode= */ RunningMode::IMAGE,
|
/* running_mode= */ RunningMode::IMAGE,
|
||||||
/* embedder_options= */
|
/* embedder_options= */
|
||||||
|
@ -152,6 +154,7 @@ TEST(ImageEmbedderTest, VideoModeTest) {
|
||||||
const std::string model_path = GetFullPath(kModelName);
|
const std::string model_path = GetFullPath(kModelName);
|
||||||
ImageEmbedderOptions options = {
|
ImageEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ model_path.c_str()},
|
/* model_asset_path= */ model_path.c_str()},
|
||||||
/* running_mode= */ RunningMode::VIDEO,
|
/* running_mode= */ RunningMode::VIDEO,
|
||||||
/* embedder_options= */
|
/* embedder_options= */
|
||||||
|
@ -210,6 +213,7 @@ TEST(ImageEmbedderTest, LiveStreamModeTest) {
|
||||||
|
|
||||||
ImageEmbedderOptions options = {
|
ImageEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ model_path.c_str()},
|
/* model_asset_path= */ model_path.c_str()},
|
||||||
/* running_mode= */ RunningMode::LIVE_STREAM,
|
/* running_mode= */ RunningMode::LIVE_STREAM,
|
||||||
/* embedder_options= */
|
/* embedder_options= */
|
||||||
|
@ -244,6 +248,7 @@ TEST(ImageEmbedderTest, InvalidArgumentHandling) {
|
||||||
// It is an error to set neither the asset buffer nor the path.
|
// It is an error to set neither the asset buffer nor the path.
|
||||||
ImageEmbedderOptions options = {
|
ImageEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ nullptr},
|
/* model_asset_path= */ nullptr},
|
||||||
/* embedder_options= */ {},
|
/* embedder_options= */ {},
|
||||||
};
|
};
|
||||||
|
@ -261,6 +266,7 @@ TEST(ImageEmbedderTest, FailedEmbeddingHandling) {
|
||||||
const std::string model_path = GetFullPath(kModelName);
|
const std::string model_path = GetFullPath(kModelName);
|
||||||
ImageEmbedderOptions options = {
|
ImageEmbedderOptions options = {
|
||||||
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
/* base_options= */ {/* model_asset_buffer= */ nullptr,
|
||||||
|
/* model_asset_buffer_count= */ 0,
|
||||||
/* model_asset_path= */ model_path.c_str()},
|
/* model_asset_path= */ model_path.c_str()},
|
||||||
/* running_mode= */ RunningMode::IMAGE,
|
/* running_mode= */ RunningMode::IMAGE,
|
||||||
/* embedder_options= */
|
/* embedder_options= */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user