somanchiu / ReSwapper

ReSwapper aims to reproduce the implementation of inswapper. This repository provides code for training, inference, and includes pretrained weights.
GNU Affero General Public License v3.0
12 stars 2 forks source link

Use CUDA for FaceAnalysis #3

Closed henryruhs closed 1 day ago

henryruhs commented 1 week ago

The insightface dependency has to go in my opinion as this causes lot of issues like:

libstdc++.so.6: version `GLIBCXX_3.4.32' not found

For the moment, I suggest to use cuda to speed up training:

FaceAnalysis(device='cuda') # edit: it turns out to be providers

and for inswapper just:

providers = ['CUDAExecutionProvider']
somanchiu commented 6 days ago

Based on my testing in both Windows and Linux, insightface has no issues. Do you use a Python virtual environment?

As for FaceAnalysis, CUDA has been supported in the code for both training and inference.

henryruhs commented 6 days ago

I couldn't find a related commit, so I opened this issue because it's missing in some areas.

somanchiu commented 6 days ago

It has always been supported. By default, FaceAnalysis will use CUDA.

henryruhs commented 1 day ago

Correct, the providers args can be removed FaceAnalysis - there is a lack of proper argument typing.

Still, there is one InferenceSession missing providers in INSwapper.py:

self.session = onnxruntime.InferenceSession(self.model_file, providers=['CUDAExecutionProvider'])

I close that issue as we aligned via Discord.