Skip to content

Commit 4bc89ad

Browse files
committed
Add test for Microsoft Phi-4 mini instruct tokenizer
1 parent 94bdcea commit 4bc89ad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test_autotokenizer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ def print_prime(n):
128128
self.assertEqual(len(ids["input_ids"].shape), len(actual_ids.shape))
129129
np.testing.assert_array_equal(ids["input_ids"], actual_ids)
130130

131+
def test_microsoft_phi4(self):
132+
tokenizer = AutoTokenizer.from_pretrained(
133+
"microsoft/phi-4-mini-instruct", torch_dtype="auto",use_fast=False)
134+
code = 'This is a sample Code'
135+
136+
ids = tokenizer(code, return_tensors="np")
137+
ort_tok, _ = gen_processing_models(tokenizer, pre_kwargs={})
138+
actual_ids, *_ = ort_inference(ort_tok, [code])
139+
self.assertEqual(len(ids["input_ids"].shape), len(actual_ids.shape))
140+
np.testing.assert_array_equal(ids["input_ids"], actual_ids)
131141

132142
if __name__ == '__main__':
133143
unittest.main()

0 commit comments

Comments
 (0)