MCPcopy Create free account
hub / github.com/ml-explore/mlx-examples / test_text_tokenizer

Method test_text_tokenizer

clip/test.py:51–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

49 self.assertTrue(mx.allclose(mx_data, hf_data, atol=1e-5))
50
51 def test_text_tokenizer(self):
52 texts = ["a photo of a cat", "a photo of a dog"]
53 for txt in texts:
54 self.assertTrue(
55 np.array_equal(
56 self.mx_tokenizer.tokenize(txt)[None, :],
57 self.hf_tokenizer(txt, return_tensors="np")["input_ids"],
58 ),
59 )
60
61 def test_text_encoder(self):
62 texts = ["a photo of a cat", "a photo of a dog"]

Callers

nothing calls this directly

Calls 1

tokenizeMethod · 0.45

Tested by

no test coverage detected