warmshao / FasterLivePortrait

Bring portraits to life in Real Time!onnx/tensorrt support!实时肖像驱动!
455 stars 42 forks source link

AttributeError: 'WarpingSpadeModel' object has no attribute 'predictor' in newest (Windows package) #65

Closed LuckyNES closed 1 month ago

LuckyNES commented 1 month ago

I am using this windows package: FasterLivePortrait-windows-20240810.zip I get the following error when trying to start camera.bat. A previous version works. Before there was a package error that was fixed, but now we have a code error.

D:\Tools\FasterLivePortrait>camera.bat source image: [assets\examples\source\s12.jpg] load Human Model >>> loading model: warping_spade {'name': 'WarpingSpadeModel', 'predict_type': 'trt', 'model_path': './checkpoints/liveportrait_onnx/warping_spade-fix.trt'} Traceback (most recent call last): File "D:\Tools\FasterLivePortrait\run.py", line 47, in pipe = FasterLivePortraitPipeline(cfg=infer_cfg, is_animal=args.animal) File "D:\Tools\FasterLivePortrait\src\pipelines\faster_live_portrait_pipeline.py", line 27, in init self.init(kwargs) File "D:\Tools\FasterLivePortrait\src\pipelines\faster_live_portrait_pipeline.py", line 31, in init self.init_models(kwargs) File "D:\Tools\FasterLivePortrait\src\pipelines\faster_live_portrait_pipeline.py", line 51, in init_models self.model_dict[model_name] = getattr(models, self.cfg.models[model_name]["name"])( File "D:\Tools\FasterLivePortrait\src\models\warping_spade_model.py", line 20, in init super(WarpingSpadeModel, self).init(kwargs) File "D:\Tools\FasterLivePortrait\src\models\base_model.py", line 13, in init self.predictor = get_predictor(self.kwargs) File "D:\Tools\FasterLivePortrait\src\models\predictor.py", line 257, in get_predictor return TensorRTPredictor(**kwargs) File "D:\Tools\FasterLivePortrait\src\models\predictor.py", line 58, in init with open(engine_path, "rb") as f, trt.Runtime(self.logger) as runtime: FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/liveportrait_onnx/warping_spade-fix.trt' Exception ignored in: <function TensorRTPredictor.del at 0x00000144231C57E0> Traceback (most recent call last): File "D:\Tools\FasterLivePortrait\src\models\predictor.py", line 166, in del del self.engine AttributeError: engine Exception ignored in: <function BaseModel.del at 0x00000144231C5E10> Traceback (most recent call last): File "D:\Tools\FasterLivePortrait\src\models\base_model.py", line 48, in del if self.predictor is not None: AttributeError: 'WarpingSpadeModel' object has no attribute 'predictor'

tivikoff commented 1 month ago

You have not converted the ONNX model to the TRT model. Please double-click the 'all_onnx2trt.bat' to perform the conversion, and refer to the README for detailed instructions on how to use it. https://github.com/warmshao/FasterLivePortrait/issues/62

LuckyNES commented 1 month ago

Ah yes you are right I forgot that step. Can you add an error that says this? But thank you. I am silly.

warmshao commented 1 month ago

No such file or directory: './checkpoints/liveportrait_onnx/warping_spade-fix.trt'

The log has indicated: "No such file or directory: './checkpoints/liveportrait_onnx/warping_spade-fix.trt', and you should first refer to the tutorial in the readme.