hzwer / ECCV2022-RIFE

ECCV2022 - Real-Time Intermediate Flow Estimation for Video Frame Interpolation
MIT License
4.42k stars 438 forks source link

Select GPU to use #227

Closed blazini36 closed 1 year ago

blazini36 commented 2 years ago

Sorry if I'm missing it but I don't see any way to select which GPU is being used. I'm not sure if this can run in parallel but if possible it would also be quite useful to run on multiple GPU's. If not it would still be nice to run 2 instances each on it's own GPU.

hzwer commented 2 years ago

For model inference, I have not implemented the relevant code because most users only have one GPU. For model training, the default is 4 GPUs: https://github.com/hzwer/arXiv2020-RIFE#training-and-reproduction

blazini36 commented 2 years ago

Is implementing the code for multiple GPUs something you plan on doing? Given the current state of the GPU market and the fact that AI stuff starting to get pretty mainstream use I'd expect alot more people may run multiple GPU than you'd expect.

I run 2 1080ti's because I refuse to pay more than MSRP for a current card which means I won't be getting one anytime soon. On average it takes about 2 hours to 2x a <30min video, but that's with the GPU the rest of my system is using, I have another one just sitting there.

AIVFI commented 2 years ago

I am the author of issue - RIFE Optimisation for GeForce RTX 3090 and future GeForce RTX 4090: https://github.com/hzwer/arXiv2020-RIFE/issues/217

My main focus is using RIFE for real-time interpolation. In this application, any action to interpolate more frames in real time is a gold

So I join the request to have the possibility to use two GPUs at the same time.

blazini36, I will have a huge request to you too. Buying 2 graphics cards is no small expense these days. Not many people are happy owners of such a setup, and even less owners are interested in innovations like RIFE. However, if hzwer would implement such functionality then I would seriously consider buying 2 graphics cards. It's a not small expense, so I'd like to make sure that I can actually use 2 graphics cards to speed up interpolation. Therefore I would need someone who already has 2 cards and could verify this.

If hzwer implements such functionality then obviously this project will work fine. But for realtime interpolation I need a RIFE filter for VapourSynth: https://github.com/HolyWu/vs-rife As soon as this functionality is implemented here I will ask HolyWu to implement it in vs-rife. As soon as HolyWu implements it I will create a thread here: https://github.com/HolyWu/vs-rife/issues with a request that someone tests interpolation on two GPUs and confirm how much performance increases compared to a single GPU. Hence my request blazini36, could you please test interpolation on two GPUs on vs-rife in the future?

For the filter for VapourSynth it is probably possible to use two GPUs simultaneously: https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Waifu2x-caffe/issues/9 However, perhaps the appropriate code for model inference will give a much better effect. As I stressed early on for my RIFE application every, even the smallest fraction of a second is of colossal importance. I believe that hzwer and HolyWu can create something that will make RIFE run on two GPUs like a rocket!

blazini36 commented 2 years ago

I don't even know what vapoursynth does. If multiGPU gets implemented for this then obviously I'll test it.

AIVFI commented 2 years ago

Thanks!

vs-rife simplifies the use of the RIFE project in software which supports VapourSynth plugins and scripts. This makes it possible for example with players like mpv or VLC to view RIFE interpolated video files in real time without re-encoding. Of course, with the support of VapourSynth, hundreds of other plugins and scripts can be used: https://vsdb.top/stats

I am only comfortable with GUI software, so I prefer SVP + mpv + vs-rife. Here is an instruction how it works all together, the use of vs-rife is described at the bottom: https://www.svp-team.com/wiki/RIFE_AI_interpolation more details here: https://www.svp-team.com/forum/viewtopic.php?pid=79695#p79695

If one prefers only open source software then probably also mpv + vs-rife or VLC + vs-rife can be used. If someone knows how to do this in the easiest way and would like to make such a manual it would be very welcome here or even better on the project page of vs-rife: https://github.com/HolyWu/vs-rife/issues

I think there are still a lot of people who do not know that the RIFE interpolation algorithm based on machine learning can be used to watch movies in real time. And for those who know there is no simple instruction how to do it.

On the other hand, support for two GPUs should further increase the performance and the number of people interested in RIFE in all applications.

mirh commented 1 year ago

In #101 it is argued RIFE-Colab supports SLI.

wlmqslch commented 1 year ago

对于模型推理,我没有实现相关代码,因为大多数用户只有一个 GPU。对于模型训练,默认是 4 个 GPU:https ://github.com/hzwer/arXiv2020-RIFE#training-and-reproduction

您好,想请问一下,在多卡训练过程中,在local_rank不等于0的进程中会报错,local variable 'writer_val' referenced before assignment,导致无法进行evaluate,该如何解决?

hzwer commented 1 year ago

@wlmqslch 我修了一下 https://github.com/megvii-research/ECCV2022-RIFE/commit/58f23dc85a7f573157fa0a5447cee38742353c7e