How to generate .engine?

I have Python code[use keras,yolov3]----
How to generate .engine?

You can convert keras -> ONNX -> TRT, please refer to below link for more details:

Importing ONNX in TRT:

You can also user trtexec command to generate TRT file:

You can also refer to below sample for Yolo to TRT conversion: