xinntao / facexlib

FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods.
MIT License
833 stars 146 forks source link

facexlib without CUDA #5

Closed nihirv closed 3 years ago

nihirv commented 3 years ago

Hey,

I'm using this because I'm interested in testing out the GFPGAN repo. However I'd like to run this on a CPU version of torch only. Since we're performing inference and not training, would you be able to support this?

Thanks for the fantastic work though btw :)

nihirv commented 3 years ago

Hmm, I made the change in utils/face_restoration_helper.py > FaceRestoreHelper > __init__, and was planning on opening a pr, but it seems that the basicsr library needs CUDA drivers too. Still, it's only a one line change and those who want to use facexlib without GPU might benefit from it, so I'll open a pr

xinntao commented 3 years ago
  1. The current GFPGAN requires GPU, so it may not available for CPU inference. We may add a CPU-support model later.
  2. I think BasicSR can support CPU only. (if we do not use those cuda extensions.)
  3. Thanks, it is better to add an option for supporting CPU
nihirv commented 3 years ago
  1. Yes please - that'd be great. Is it the StyleGAN part which needs the GPU?
  2. I'm getting a: "OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root." through basicsr\ops\dcn\deform_conv.py", line 14 inside the if BASICSR_JIT == 'True': flag
  3. PR opened (it's not a flag, just a device check): https://github.com/xinntao/facexlib/pull/6
xinntao commented 3 years ago

@nihirv

  1. The StyleGAN needs customized CUDA(with GPU) extensions. So the original model requires GPU. I have updated a new version which does not require such CUDA extensions. So the GFPGAN can be run with CPU/ or run on windows. See the updates in : https://github.com/TencentARC/GFPGAN
  2. I have merged the PR. Thanks. :-)