Asd-g / avs-mlrt

ML Runtimes for AviSynth+.
GNU General Public License v3.0
19 stars 0 forks source link

Is there rife for motion interpolation like vs-mlrt yet? #12

Closed Usulyre closed 4 months ago

Usulyre commented 6 months ago

Hi,

Is there rife for motion interpolation like vs-mlrt yet?

Like the example here but for avs-mlrt:

https://github.com/AmusementClub/vs-mlrt/issues/47

Asd-g commented 6 months ago

Not, yet. Running RIFE with avs-mlrt requires some additional work.

Asd-g commented 4 months ago

Added.

Usulyre commented 1 month ago

Added.

Just wondering when a new release will come out with the above ?

Asd-g commented 1 month ago

Sorry for the delay. Later I will create a new release.

Asd-g commented 1 month ago

@Usulyre, until I create release, you can download these scripts - https://github.com/Asd-g/avs-mlrt/blob/main/scripts/mlrt_common.avsi and https://github.com/Asd-g/avs-mlrt/blob/main/scripts/mlrt_RIFE.avsi. Open mlrt_RIFE.avsi and read the info. You can download models from here. Take a note of the location of of the models. Use the latest mlrt_ov/mlrt_ort - https://github.com/Asd-g/avs-mlrt/releases/tag/r63

Usulyre commented 1 month ago

@Usulyre, until I create release, you can download these scripts - https://github.com/Asd-g/avs-mlrt/blob/main/scripts/mlrt_common.avsi and https://github.com/Asd-g/avs-mlrt/blob/main/scripts/mlrt_RIFE.avsi. Open mlrt_RIFE.avsi and read the info. You can download models from here. Take a note of the location of of the models. Use the latest mlrt_ov/mlrt_ort - https://github.com/Asd-g/avs-mlrt/releases/tag/r63

Hi, after following your steps and getting past some errors, it seems to work.

However, gpu usage is nearly 0% and my cpu is using almost 100%?

I must have configured something wrong or not at all.

Usulyre commented 1 month ago

I have avisynth+ 3.7.3 and a GTX 1060

Steps:

Downloaded https://github.com/Asd-g/avs-mlrt/blob/main/scripts/mlrt_common.avsi and put in my avisynth+ plugins64+ folder.

Downloaded https://github.com/Asd-g/avs-mlrt/blob/main/scripts/mlrt_RIFE.avsi and put in my avisynth+ plugins64+ folder.

Downloaded avsresize

https://web.archive.org/web/20230215081928if_/https://files.videohelp.com/u/223002/avsresize_r21.7z

extracted x64 dll and put into in my avisynth+ plugins64+ folder

Downloaded framesel

https://web.archive.org/web/20200526164026if_/https://files.videohelp.com/u/223002/FrameSel_x86_ x64_dll_v2-20_20180420.zip

Extracted avisynth+ 64, FrameSel_x64.dll and put into in my avisynth+ plugins64+ folder.

Donwloaded a couple of models from:

https://github.com/AmusementClub/vs-mlrt/releases/tag/external-models

rife_v4.22.7z and rife_v4.17_lite.7z

Extracted files and put into avisynth+ plugins64+ folder as

"or implementation=1: models must be placed in folder "models/rife_mlrt/rife" where the root folder "models" must be in the same location as mlrt_xxx.dll."

"or implementation=2: models must be placed in folder "models/rife_mlrt/rife_v2" where the root folder "models" must be in the same location as mlrt_xxx.dll."

According to https://github.com/Asd-g/avs-mlrt/blob/main/mlrt_ort/README.md

Downloaded

mlrt_ort-1.0.1.7z and extracted/put mlrt_ort.dll and mlrt.avsi into avisynth+ plugins64+ folder.

Created folder mlrt_ort_rt and put onnxruntime.dll and DirectML.dll and all the files in cuda_dll.7 z into that folder which i put into avisynth+ plugins64+ folder.

Had to edit in the file mlrt_RIFE.avsi line 105

Assert(model >= 0 && model <= 19, "mlrt_RIFE: model must be between 0..19.") into

Assert(model >= 0 && model <= 26, "mlrt_RIFE: model must be between 0..26.")

I used the newer models like 4.17 and 4.22 and I got an error so I changed it to 26 since 19 is model 4.16

Also had to change for example "rife_v4.22.onnx" to "rife_v4_22.onnx" because I also got an error.

Sample script:

AvsFilterSource() SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE) Threads=2 SR(320,320) FDecimate2(24, chroma=false) ConvertBits(32).ConvertToPlanarRGB(matrix="Rec601") mlrt_RIFE(1, factor_num=2, factor_den=1, model=26, backend=["ort", "fp16=true"], ensemble=false) ConvertBits(8).ConvertToYV12(matrix="Rec601") Prefetch(Threads)

Do i need to change something to get it to use my gpu?

Like in mlrt_ort ?

Does mlrt_ort need it's own script as well?

Asd-g commented 1 month ago

Try with mlrt_RIFE(1, factor_num=2, factor_den=1, model=26, backend=["ort", """provider="cuda"""", "fp16=true"], ensemble=false).

Remove mlrt.avsi. It's obsolete. The functions from it are now in own scripts (mlrt_DPIR.avsi, mlrt_RIFE.avsi...).

Usulyre commented 4 weeks ago

Try with mlrt_RIFE(1, factor_num=2, factor_den=1, model=26, backend=["ort", """provider="cuda"""", "fp16=true"], ensemble=false).

Remove mlrt.avsi. It's obsolete. The functions from it are now in own scripts (mlrt_DPIR.avsi, mlrt_RIFE.avsi...).

That works now, thanks.

Will you be adding (if possible) a parameter like this:

fps_num, fps_den

for specifying an exact frame rate, like what AviSynthPlus-RIFE has already?

Asd-g commented 4 weeks ago

Try the latest version of mlrt_RIFE.avsi.

Btw what's the speed diff between mlrt_RIFE and RIFE with your NVIDIA card?

Usulyre commented 4 weeks ago

Try the latest version of mlrt_RIFE.avsi.

Btw what's the speed diff between mlrt_RIFE and RIFE with your NVIDIA card?

Thanks for that.

How would I go about testing the speed difference between the two?

Asd-g commented 4 weeks ago

You can use AVSMeter.

Usulyre commented 4 weeks ago

You can use AVSMeter.

Ok, not sure I did it right but here are the two logs:

mlrt_RIFE:

mlrt_rife.log

RIFE:

rife.log

Asd-g commented 3 weeks ago

Thanks. RIFE is faster than mlrt_RIFE in this test (55.8 fps vs 45.10).