Deep-Live-Cam icon indicating copy to clipboard operation
Deep-Live-Cam copied to clipboard

why using whole tensorflow library just to get number of gpus? aren't there alternatives?

Open tikendraw opened this issue 1 year ago • 4 comments

Installing a big library such as tensorflow just for gpu count seems overkill.

./requirements.txt
18:tensorflow==2.13.0rc1; sys_platform == 'darwin'
19:tensorflow==2.12.1; sys_platform != 'darwin'

./modules/core.py
6:# reduce tensorflow log level
16:import tensorflow
130:    # prevent tensorflow memory leak
131:    gpus = tensorflow.config.experimental.list_physical_devices('GPU')
133:        tensorflow.config.experimental.set_memory_growth(gpu, True)

tikendraw avatar Aug 12 '24 19:08 tikendraw

as i know, tensorflow doesnt just get the count of the GPUs, but also optimizes itself, its looking for supported GPUs. So this may be the reason. I tried changing tensorflow and using another method, such as pynvml, pytorch and pycuda, but because of i have no nvidia GPUs, i didnt get a clear result but yeah, as i know tensorflow is different.

i can may be wrong too, but this is what i know. Have a good day.

MYusufY avatar Aug 30 '24 05:08 MYusufY

If you find an alternative, feel free to push to the code to help everyone out on this. ☺️

hacksider avatar Aug 30 '24 05:08 hacksider

Of course ☺️ only thing is as i said i dont have enouh GPUs to check if it works so i didnt want to contribute, but if theres no problem, i can ☺️

MYusufY avatar Aug 30 '24 06:08 MYusufY

Hi @hacksider, i created a PR to use CUPY instead of Tensorflow in core.py:

  • #505

I accidentally didnt write description while creating PR :) But here are some notes: I didnt be able to test it as i said. I have not enough GPUs unfotunately! :)

So i pushed it to the experimental branch, hope it works and helps everyone. Thanks :)

MYusufY avatar Aug 30 '24 06:08 MYusufY