TokenizeString should return a non-empty token list for a known prompt.
(self)
| 241 | |
| 242 | |
| 243 | def test_tokenize_string(self): |
| 244 | """TokenizeString should return a non-empty token list for a known prompt.""" |
| 245 | try: |
| 246 | self.setUp() |
| 247 | with grpc.insecure_channel("localhost:50051") as channel: |
| 248 | stub = backend_pb2_grpc.BackendStub(channel) |
| 249 | response = stub.LoadModel( |
| 250 | backend_pb2.ModelOptions(Model="mlx-community/Llama-3.2-1B-Instruct-4bit") |
| 251 | ) |
| 252 | self.assertTrue(response.success) |
| 253 | resp = stub.TokenizeString(backend_pb2.PredictOptions(Prompt="Hello, world")) |
| 254 | self.assertGreater(resp.length, 0) |
| 255 | self.assertEqual(len(list(resp.tokens)), resp.length) |
| 256 | except Exception as err: |
| 257 | print(err) |
| 258 | self.fail("TokenizeString service failed") |
| 259 | finally: |
| 260 | self.tearDown() |
| 261 | |
| 262 | def test_free(self): |
| 263 | """Free should release the model and not crash on subsequent calls.""" |
nothing calls this directly
no test coverage detected