This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Why VSGAN is not supported,...
#1
Okay, since every few month someone asks me why Hybrid does not support VSGAN (https://github.com/rlaPHOENiX/VSGAN) here's the answer:
It would increase Hybrids install size by 5,4 GB.

In case you want to verify it, here's how-to "Create a VSGAN portable version":
  • Download latest Vapoursynth portabe Fatpack (https://github.com/theChaosCoder/vapours...K/releases) and extract it to a folder
  • Delete the links an folders inside the VapourSynth64 aside from VapourSynth64 and the Scripts folder (optional)
  • Open a Windows command prompt and change into the VapourSynth64/VapourSynth64-folder.
  • Call `python.exe -m pip install --upgrade pip" to update pip` to update pip
  • Call `python.exe -m pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html` to install pytorch
    For cuda10 use `python.exe -m pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html` to install pytorch
  • Call `python.exe -m pip install pyd2v pymediainfo vsgan" to install vsgan`
  • Close Windows Command Prompt.
now you got a 6GB folder containing a portable Vapoursynth (~560MB) with VSGAN (~5.4GB).
So adding this to Hybrid would add an additional 5.4GB and this does not include any models (each ~64MB).

In case you want to try out VSGAN:
  • Download some models
  • I went to https://upscale.wiki/wiki/Model_Database and then to Anime Oldies Alternative (https://drive.google.com/drive/folders/1...o6Dnk-svNL) and downloaded the pth files and extract them somewhere.
  • Open VapourSynth64Portable\VapourSynth64\vsedit.exe and write a script like:
    # Imports
    import vapoursynth as vs
    core = vs.get_core()
    # Loading Plugins
    from vsgan import VSGAN

    # Loading F:\TestClips&Co\files/5000frames.mp4 using LWLibavSource
    clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/files/5000frames.mp4", format="YUV420P10", cache=0, prefer_hw=0)
    # making sure input color matrix is set as 470bg
    clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
    # making sure frame rate is set to 25
    clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
    # Setting color range to TV (limited) range.
    clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)

    # creating a VSGAN instance
    vsgan = VSGAN("cuda")
    # setting model
    model = "C:/Users/Selur/Desktop/Vapoursynth64portable/vsgan_models/PSNR Pretrain Models/4xPSNR.pth"
    vsgan.load_model(model)
    # convert clip color space from YUV420P8 to RGB24 for vsgan
    clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
    clip = vsgan.run(clip=clip)

    clip.set_output()
(paths need to be adjusted to your setup)
start the preview.

Cu Selur

Links to pth files:
Reply
#2
Since I now offer an addon for Hybrid here's an updated how to, on how I create it:

What I did to create a portable Vapoursynth with pytorch&co: + additionally I pack the lated vsViewer and a folder named vsgan_models (collection of the models from https://upscale.wiki/wiki/Model_Database) in it.
After that it's ready.

Cu Selur
Reply
#3
when updating basicvsrpp and torch use:
python -m pip install torch===1.10.0+cu111 torchvision===0.11.1 -f https://download.pytorch.org/whl/torch_stable.html
python -m pip install --upgrade https://github.com/HolyWu/vs-basicvsrpp/releases/download/v1.0.0/mmcv_full-1.3.16-cp39-cp39-win_amd64.whl
python -m pip install --upgrade vsbasicvsrpp
python -m vsbasicvsrpp
Reply
#4
btw. Game Upscale Discord has a nice model section with some good models too. Smile

Cu Selur
Reply
#5
Note that since Vapoursynth R58 requires Python 3.8 or 3.10, aside from vsgan, all the other filters do not work since the use Python 3.9.
Reply
#6
vs-basicvsrpp works when using:
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11/index.html
python -m pip install tqdm
python -m pip install opencv-python
python -m pip install --upgrade vsbasicvsrpp
python -m vsbasicvsrpp
see: https://github.com/HolyWu/vs-basicvsrpp/issues/23

Cu Selur
Reply
#7
Hello Selur,

thanks first for qll of your work, and thanks for your step by step guide for creation of VSGAN !


I m currently trying to follow and adapt your guide,  
1. to try by myself to build the "torch addons", with newer vapoursynth and filters version , instead of asking directly to you if i can download your version Smile
2. to familiarize a bit more with the different addons, tools, and also the python and compilation
3. implement the vs real-esrgan and try it, and also understand how to integrate some others models.


I already did several try, i met some issue, that i resolved correctly, or workarounded, and i keep going.

but.. there is a but Sad


i may need some hints and some support from you if you agree of course :

1. i met several issue with the python - vapoursynth - filter  version/support compatibility.
For this point i keep testing, and updating a document with the step by step guide, that i will share once it worked on my side.

But i may win some time if you could share some hints about which version i should avoid (versions you may know it will be issues/conflicts)
-> the scope will stay the tool and filters you indicated in your step by step guide.

2. well , the best thing... the vsviewer : D
For this one, i just tried to use the compiled vsviewer.exe (+provided QT6 files) files provided in the current distribution of Hybrid, but i had some errors that i did not analyse yet , as being busy with the first part of the mission Smile (it was related to some missing functions etc, but i suppose it is related to the fact you said you had to adapt vsviewer code to have it running fine with real-esrgan).
I may later probably need also your support for this part, but after i successfully made the first part.


Then , feel free to support, or share or shoot me if needed Smile

Kr,

Ld
Reply
#8
You might want to check:
https://forum.doom9.org/showthread.php?p...ost1982615
https://forum.doom9.org/showthread.php?p...ost1992302
for more up-to-date instructions.
That said, I have torch&mlrt addons for Hybrid nowadays, see: https://forum.selur.net/thread-2820.html
(drop a post there, that you also would like the addons and I'll send you my current links via pm after work)

If you need further help to build stuff, let me know.
(vsviewer should compile fine, at least with visual studio community installed in the system, which I use)

Cu Selur
Reply
#9
geez you already sent so far in your step by step !
really good links you provided, it helps a lot !


i will rework my side, based on these new details, and keep informed.
Reply
#10
Selur, 
i was able to go farer than your try of 08/10 , following your procedure in the forum
https://forum.doom9.org/showthread.php?p...ost1992302


i changed 3 things :

1. at first step of all , i created an environment variable after the extraction of  CUDA-11.8_cuDNN-8.9.1_TensorRT-8.6.1.6_win64.7z
Quote:CUDA_HOME=path_of_folder_of_extracted_CUDA-11.8_cuDNN-8.9.1_TensorRT-8.6.1.6_win64

1. as the big pack (CUDA-11.8_cuDNN-8.9.1_TensorRT-8.6.1.6_win64)from HolyWu is for cuda 11.8 i changed the package to download
  • installed pytorch using:
python -m pip install torch===2.1.0+cu118 torchvision==0.16.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html

2. i used a different method for installing BasicVSR++

i kept upgrading BasicVSR (it wouln't hurt)
python -m pip install --upgrade vsbasicvsr

then for BasicVSR++ , i also targetted the same cuda compatibility
python -m pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.1.0/index.html
then 
python -m pip install tqdm
python -m pip install --upgrade vsbasicvsrpp
python -m pip install opencv-python

python -m vsbasicvsrpp

on my side everything worked.
I did not use the openmim method.

Another thing : i uninstalled VS2019, and my 2022 installations, and then reinstalled the 2022 community. i saw that after several mix of install and uninstall 1 but not both, i had some strange behavior.
I also used python portable 11.6.

also my vapoursynth folder is 10.5GB.

now i have a full vapoursynth ready, i need now to see what i have to do with Vsviewer. (i hope final thing)

i hope it helps.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)