End-to-end: load a real LFM2-Audio model and run one short prediction.
(self)
| 63 | @unittest.skipUnless(os.environ.get("LIQUID_AUDIO_MODEL_ID"), |
| 64 | "Set LIQUID_AUDIO_MODEL_ID to run an end-to-end inference smoke test") |
| 65 | def test_inference(self): |
| 66 | """End-to-end: load a real LFM2-Audio model and run one short prediction.""" |
| 67 | stub = self._stub() |
| 68 | model_id = os.environ["LIQUID_AUDIO_MODEL_ID"] |
| 69 | result = stub.LoadModel( |
| 70 | backend_pb2.ModelOptions( |
| 71 | Model=model_id, |
| 72 | Options=["mode:chat"], |
| 73 | ), |
| 74 | timeout=600, |
| 75 | ) |
| 76 | self.assertTrue(result.success, msg=result.message) |
| 77 | reply = stub.Predict( |
| 78 | backend_pb2.PredictOptions( |
| 79 | Prompt="Hello!", |
| 80 | Tokens=8, |
| 81 | Temperature=0.0, |
| 82 | ), |
| 83 | timeout=120, |
| 84 | ) |
| 85 | self.assertGreater(len(reply.message), 0) |
| 86 | |
| 87 | |
| 88 | if __name__ == "__main__": |