MCPcopy Create free account
hub / github.com/Lightning-AI/LitServe / test_simple_pytorch_api_without_server

Function test_simple_pytorch_api_without_server

tests/unit/test_examples.py:65–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64@pytest.mark.asyncio
65async def test_simple_pytorch_api_without_server():
66 api = ls.test_examples.SimpleTorchAPI()
67 api.setup("cpu")
68 assert api.model is not None, "Model should be loaded after setup"
69 assert isinstance(api.model, torch.nn.Module)
70 assert api.decode_request({"input": 4}) == 4, "Request should be decoded"
71 assert api.predict(torch.Tensor([4])).cpu() == 9, "Model should be able to predict"
72 assert api.encode_response(9) == {"output": 9}, "Response should be encoded"
73
74
75@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

setupMethod · 0.95
decode_requestMethod · 0.95
predictMethod · 0.95
encode_responseMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…