Skip to content

Commit

Permalink
changed random input of text clip model with a real input
Browse files Browse the repository at this point in the history
  • Loading branch information
okus-hubx committed Mar 10, 2025
1 parent 6623a7b commit 60c51d2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test_examples/test_clip_mlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,16 @@ def test_clip_text_model(self, backend_type):
pm = ml.compile(
m_model,
backend=backend,
shapes={"input": (1, 77)},
shapes={"input": (2, 77)},
data_keys={"input"},
use_short_namings=False,
)

params = load_weights(pm.shapes, o_model, backend)
torch_input_ids = torch.randint(0, 49408, size=(1, 77))
input = backend.array(torch_input_ids.clone().numpy())
expected_result = o_model(torch_input_ids).pooler_output
text = ["a photo of a cat", "a photo of a dog"]
tokens = cliptorch.tokenize(text)
input = backend.array(torch.tensor(tokens).clone().numpy())
expected_result = o_model(torch.tensor(input)).pooler_output

outs = pm(params, {"input": input})

Expand Down

0 comments on commit 60c51d2

Please sign in to comment.