How to compile weights into model?

I have weights from …\yolov3\runs\train\exp6\weights, but when i used best.pt in imageAI code, i get this error: “ModuleNotFoundError: No module named ‘models’” How cain build a model from weights?

You cannot build a model architecture just from its parameters alone and would need the model definition.
Could you also explain your use case in more detail as it seems that the models class is currently undefined so maybe just an import is missing.