No public description
PiperOrigin-RevId: 551914786
This commit is contained in:
parent
9edb059d9f
commit
3f7752561b
|
@ -140,7 +140,7 @@ public class TextEmbedderTest {
|
||||||
TextEmbedder.cosineSimilarity(
|
TextEmbedder.cosineSimilarity(
|
||||||
result0.embeddingResult().embeddings().get(0),
|
result0.embeddingResult().embeddings().get(0),
|
||||||
result1.embeddingResult().embeddings().get(0));
|
result1.embeddingResult().embeddings().get(0));
|
||||||
assertThat(similarity).isWithin(DOUBLE_DIFF_TOLERANCE).of(0.3477488707202946);
|
assertThat(similarity).isWithin(DOUBLE_DIFF_TOLERANCE).of(0.3565317439544432);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -37,7 +37,7 @@ _TEST_DATA_DIR = 'mediapipe/tasks/testdata/text'
|
||||||
# Tolerance for embedding vector coordinate values.
|
# Tolerance for embedding vector coordinate values.
|
||||||
_EPSILON = 1e-4
|
_EPSILON = 1e-4
|
||||||
# Tolerance for cosine similarity evaluation.
|
# Tolerance for cosine similarity evaluation.
|
||||||
_SIMILARITY_TOLERANCE = 1e-6
|
_SIMILARITY_TOLERANCE = 1e-3
|
||||||
|
|
||||||
|
|
||||||
class ModelFileType(enum.Enum):
|
class ModelFileType(enum.Enum):
|
||||||
|
@ -287,7 +287,7 @@ class TextEmbedderTest(parameterized.TestCase):
|
||||||
|
|
||||||
@parameterized.parameters(
|
@parameterized.parameters(
|
||||||
# TODO: The similarity should likely be lower
|
# TODO: The similarity should likely be lower
|
||||||
(_BERT_MODEL_FILE, 0.980880),
|
(_BERT_MODEL_FILE, 0.98077),
|
||||||
(_USE_MODEL_FILE, 0.780334),
|
(_USE_MODEL_FILE, 0.780334),
|
||||||
)
|
)
|
||||||
def test_embed_with_different_themes(self, model_file, expected_similarity):
|
def test_embed_with_different_themes(self, model_file, expected_similarity):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user