REAL-Video-Enhancer icon indicating copy to clipboard operation
REAL-Video-Enhancer copied to clipboard

[Feature Request] SwinIR and DAT

Open Rand0Pers0n opened this issue 11 months ago • 6 comments

No idea if even possible but would love to be able to use SwinIR and DAT models. I can use chaiNNer and while it works with everything I have tried is very slow. Like with rplksr which this supports could take 2 hours in chaiNNer vs 20-30min in RVE.

Rand0Pers0n avatar Dec 15 '25 22:12 Rand0Pers0n

You can add custom models in settings

TNTwise avatar Dec 15 '25 22:12 TNTwise

You can add custom models in settings

TNTwise avatar Dec 15 '25 22:12 TNTwise

Ok, ill try in settings I was just copying them to the custom_models folder. They start to run but error out. Though are fine in chaiNNer. Once I get to a testing point in my training I'll try again and post logs, to see if anything could be done.

Rand0Pers0n avatar Dec 15 '25 22:12 Rand0Pers0n

Try enabling tiling, as they are heavy models. Other than that, I haven't tested those architectures so they could very well be broken

TNTwise avatar Dec 15 '25 22:12 TNTwise

Ok, tried tiling, no change. Here are the logs if wanted or anything could be done in the future.

['G:\REAL-Video-Enhancer-2.3.7\python\python\python.exe', '-W', 'ignore', 'G:\REAL-Video-Enhancer-2.3.7\backend\rve-backend.py', '-i', 'C:/Users/CDL/Documents/Junk2/Junk/KOTH Upscale Test File 540p.mov', '-o', 'C:/Users/CDL/Desktop\KOTH Upscale Test File 540p_net_g_15512.pth_24.0fps_1440x1080.mkv', '-b', 'tensorrt', '--precision', 'auto', '--custom_encoder', ' -color_primaries bt709 -color_trc bt709 -colorspace smpte170m -c:v prores_ks -profile:v 2 -pix_fmt yuv422p -c:a copy ', '--tensorrt_opt_profile', '3', '--pause_shared_memory_id', '/paused_state14544', '--ncnn_gpu_id', '0', '--pytorch_gpu_id', '0', '--cwd', 'G:\REAL-Video-Enhancer-2.3.7', '--upscale_model', 'G:\REAL-Video-Enhancer-2.3.7\custom_models\net_g_15512.pth', '--override_upscale_scale', '2', '--tilesize', '512', '--preview_shared_memory_id', '/image_preview14544', '--scene_detect_method', 'pyscenedetect', '--scene_detect_threshold', '3.5'] BACKEND: Getting Input Video Properties BACKEND: Getting Input Video Properties BACKEND: Using backend: tensorrt BACKEND: Setting up Upscale BACKEND: No module named 'rife_ncnn_vulkan_python' Using Device: NVIDIA GeForce RTX 4090 Building TensorRT engine net_g_15512.pth_fp16_NVIDIA GeForce RTX 4090_trt-10.12.0.36_torch_tensorrt-2.8.0+cu129_opt-3_532x532.engine_2.3.7-dev10.engine. This may take a while... Duration: 95.92916666666666 seconds Total Frames: 2300 Color Space: smpte170m Color Transfer: bt709 Color Primaries: bt709 Pixel Format: yuv420p Video Codec: h264 Video Bitrate: 10328 kbps Is HDR: False Bit Depth: 8 Test inf failed Traceback (most recent call last): File "G:\REAL-Video-Enhancer-2.3.7\backend\src\pytorch\UpscaleTorch.py", line 242, in load trt_engine = trtHandler.build_engine( File "G:\REAL-Video-Enhancer-2.3.7\backend\src\pytorch\TensorRTHandler.py", line 156, in build_engine exported_program = nnmodule_to_dynamo(model, example_inputs, dynamic_shapes=dynamic_shapes) File "G:\REAL-Video-Enhancer-2.3.7\backend\src\pytorch\TensorRTHandler.py", line 53, in nnmodule_to_dynamo return torch.export.export( File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_init.py", line 319, in export raise e File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_init_.py", line 286, in export return _export( File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1164, in wrapper raise e File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1130, in wrapper ep = fn(*args, **kwargs) File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export\exported_program.py", line 123, in wrapper return fn(*args, **kwargs) File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 2176, in _export ep = _export_for_training( File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1164, in wrapper raise e File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1130, in wrapper ep = fn(*args, **kwargs) File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export\exported_program.py", line 123, in wrapper return fn(*args, **kwargs) File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 2037, in _export_for_training export_artifact = export_func( File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1979, in _non_strict_export aten_export_artifact = _to_aten_func( # type: ignore[operator] File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1770, in _export_to_aten_ir_make_fx gm, graph_signature = transform(_make_fx_helper)( File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1900, in _aot_export_non_strict gm, sig = aot_export(wrapped_mod, args, kwargs=kwargs, **flags) File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\export_trace.py", line 1684, in _make_fx_helper with ctx, override_getattribute_for_subclasses(flat_args): File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\contextlib.py", line 144, in exit next(self.gen) File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch_functorch\aot_autograd.py", line 1729, in _detect_attribute_assignment raise ValueError( ValueError: The tensor attribute self.mean was assigned during export. Such attributes must be registered as buffers using the register_buffer API (https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.register_buffer). During handling of the above exception, another exception occurred: Traceback (most recent call last): File "G:\REAL-Video-Enhancer-2.3.7\backend\rve-backend.py", line 506, in HandleApplication() File "G:\REAL-Video-Enhancer-2.3.7\backend\rve-backend.py", line 38, in init self.renderVideo() File "G:\REAL-Video-Enhancer-2.3.7\backend\rve-backend.py", line 118, in renderVideo Render( File "G:\REAL-Video-Enhancer-2.3.7\backend\src\RenderVideo.py", line 181, in init self.setupUpscale() File "G:\REAL-Video-Enhancer-2.3.7\backend\src\RenderVideo.py", line 439, in setupUpscale self.upscaleOption = self.upscalePytorchObject(self.upscaleModel) File "G:\REAL-Video-Enhancer-2.3.7\backend\src\RenderVideo.py", line 387, in upscalePytorchObject return UpscalePytorch( File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\utils_contextlib.py", line 120, in decorate_context return func(*args, **kwargs) File "G:\REAL-Video-Enhancer-2.3.7\backend\src\pytorch\UpscaleTorch.py", line 118, in init self._load() File "G:\REAL-Video-Enhancer-2.3.7\python\python\Lib\site-packages\torch\utils_contextlib.py", line 120, in decorate_context return func(*args, **kwargs) File "G:\REAL-Video-Enhancer-2.3.7\backend\src\pytorch\UpscaleTorch.py", line 283, in _load raise RuntimeError( RuntimeError: Failed to build TensorRT engine: The tensor attribute self.mean was assigned during export. Such attributes must be registered as buffers using the register_buffer API (https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.register_buffer). No read memory 'UpdateGUIThread' object has no attribute 'shm' No read memory 'UpdateGUIThread' object has no attribute 'shm' Some render processes failed: Error code: [1]

Rand0Pers0n avatar Dec 15 '25 23:12 Rand0Pers0n

It works with Cuda though very slow at 1fps but will use it until something better comes along or I find something that can use TensorRT.

Rand0Pers0n avatar Dec 15 '25 23:12 Rand0Pers0n