AkarinVS / vapoursynth-plugin

My experimental VapourSynth plugin: (1) an enhanced LLVM-based std.Expr (aka lexpr), Select, PropExpr, Text and Tmpl. (2) DLISR. (3) DLVFX (4) CAMBI.
GNU Lesser General Public License v3.0
37 stars 8 forks source link

DLVFX option to set model_path? #18

Closed Selur closed 1 year ago

Selur commented 1 year ago

Hi, I'm trying to get akatin.DLVFX working in a portable Vapoursynth/Python setup, using:

# load akarin plugin
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/Akarin/akarin.dll")

# add akarin-folder to PATH (folder includes akarin.dll and all dlls and models from nvidia_video_effects_sdk_installer_ada)
path = 'i:/Hybrid/64bit/vsfilters/Support/Akarin'
os.environ["PATH"] += os.pathsep + path

# set MODEL_DIR for akarin (seemingly without effect)
path = 'i:/Hybrid/64bit/vsfilters/Support/Akarin/models'
os.environ["MODEL_DIR"] = path

clip = core.akarin.DLVFX(clip, op=0, strength=0.5)

full script used: https://pastebin.com/cW3Bg4BV

But end up :

MODEL_DIR = C:\Program Files\NVIDIA Corporation\NVIDIA Video Effects\models
Cannot load model "AR-con-89.engine"
ERROR: Loading TRTModel failed in Artifact Removal
failed VFX call NvVFX_Load(d->vfx): fffffff3 (The file could not be found)

So seems like the MODEL_DIR is not taken from the environment, but from somewhere else.

=> Would it be possible to add another parameter to DLVFX to overwrite the 'MODEL_DIR'-variable or do you know another way to get this working?

AkarinVS commented 1 year ago

MODEL_DIR is taken from environment variable MODEL_DIR. https://github.com/AkarinVS/vapoursynth-plugin/blob/359930cdbac9fffa9924d8d5e3fde01741c9764a/vfx/vfx.cc#L239

And assignment to os.environ should set the environment variable, so I'm not sure what's going on.

AkarinVS commented 1 year ago

Please try this build https://github.com/AkarinVS/vapoursynth-plugin/releases/download/v0.96/akarin-release-lexpr-amd64-v0.96.7z that introduces a model_dir parameter to DLVFX.

(That build also includes other enhancements, but those are not yet ready for production. Better to ignore them.)

Selur commented 1 year ago

Just ,tested:

path = 'i:/Hybrid/64bit/vsfilters/Support/Akarin/models'



clip = core.akarin.DLVFX(clip, op=0, strength=0.5,model_dir=path)

and it works. :) Thanks. :)

AkarinVS commented 1 year ago

Thanks for confirmation.