NevermindNilas / TheAnimeScripter

Welcome to TheAnimeScripter – the ultimate tool for Video Upscaling, Interpolating and many more. Available as a CLI, GUI and Adobe Extension.
GNU Affero General Public License v3.0
83 stars 1 forks source link

Rife-tensort wont work on Nightly TAS_2024_09_05, log says "onnx is not installed" #49

Closed GoldJohnKing closed 4 days ago

GoldJohnKing commented 1 week ago

Hi, I am testing a bug fix of rife-tensorrt on TAS_Nightly_2024_09_05.

However, the program exits soon after it launches, without any process on the input video.

image

Then I read the log, it says "onnx is not installed".

Here is the full log, please see the last section.

============== Command Line Arguments ==============
..\TheAnimeScripter\main.exe --half False --buffer_limit 100 --input F:\Tools\Scripts\input.mp4 --output F:\Tools\Scripts\output.mp4 --upscale --upscale_factor 2 --upscale_method span --scenechange --scenechange_method maxxvit-tensorrt --interpolate --interpolate_factor 2 --interpolate_method rife4.22-tensorrt --custom_encoder=-c:a copy -c:v hevc_nvenc -preset p7 -tune hq -profile:v main -pix_fmt yuv420p -tier high -rc constqp -qp 15

============== Arguments ==============
INPUT: F:\Tools\Scripts\input.mp4
OUTPUT: F:\Tools\Scripts\output.mp4
INPOINT: 0
OUTPOINT: 0
HALF: True
INTERPOLATE: True
INTERPOLATE_FACTOR: 2
INTERPOLATE_METHOD: rife4.22-tensorrt
UPSCALE: True
UPSCALE_FACTOR: 2
UPSCALE_METHOD: span
DEDUP_METHOD: ssim
DEDUP_SENS: 35
SAMPLE_SIZE: 224
SHARPEN_SENS: 0.5
DENOISE_METHOD: scunet
RESIZE_FACTOR: 2
RESIZE_METHOD: bicubic
SEGMENT_METHOD: anime
AUTOCLIP_SENS: 50
SCENECHANGE: True
SCENECHANGE_METHOD: maxxvit-tensorrt
SCENECHANGE_SENS: 50
DEPTH_METHOD: small_v2
DEPTH_QUALITY: high
ENCODE_METHOD: x264
CUSTOM_ENCODER: -c:a copy -c:v hevc_nvenc -preset p7 -tune hq -profile:v main -pix_fmt yuv420p -tier high -rc constqp -qp 15
BUFFER_LIMIT: 100
AUDIO: True
BIT_DEPTH: 8bit

============== System Checker ==============
OS Name: Microsoft Windows 11   ҵ  
CPU: 12th Gen Intel(R) Core(TM) i7-12700KF
RAM: 63.86 GB
Available RAM: 50.38 GB
Graphics Card 0: Meta Virtual Monitor
Graphics Card 1: NVIDIA GeForce RTX 4090

============== Arguments Checker ==============
FFMPEG Path: C:\Users\GoldJohnKing\AppData\Roaming\TheAnimeScripter\ffmpeg\ffmpeg.exe
New dedup sensitivity for ssim is: 0.965
New scenechange sensitivity is: 0.85
Custom encoder specified, use with caution since some functions can make or break the encoding process

============== Video Metadata ==============
Width: 2520
Height: 1080
AspectRatio: 2.33
FPS: 60.0
Number of total frames: 12013
Codec: hevc
Duration: 200.22 seconds
In-Out Duration: 0.0 seconds
Total frames to be processed: 12013
Pixel Format: yuv420p

============== Processing Outputs ==============
Upscaling to 5040x2160
Interpolating from 60.000fps to 120.000fps
UHD and fp16 for rife are not compatible due to flickering issues, defaulting to fp32
Something went wrong: Module onnx is not installed!
Traceback (most recent call last):
  File "torch\onnx\_internal\onnx_proto_utils.py", line 215, in _add_onnxscript_fn
    import onnx
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "onnx\__init__.py", line 77, in <module>
ImportError: DLL load failed while importing onnx_cpp2py_export:   ̬   ӿ (DLL)  ʼ      ʧ ܡ 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 227, in start
  File "src\initializeModels.py", line 332, in initializeModels
    interpolate_process = RifeTensorRT(
                          ^^^^^^^^^^^^^
  File "src\unifiedInterpolate.py", line 255, in __init__
    self.handleModel()
  File "src\unifiedInterpolate.py", line 387, in handleModel
    torch.onnx.export(
  File "torch\onnx\__init__.py", line 377, in export
    export(
  File "torch\onnx\utils.py", line 502, in export
    _export(
  File "torch\onnx\utils.py", line 1640, in _export
    proto = onnx_proto_utils._add_onnxscript_fn(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "torch\onnx\_internal\onnx_proto_utils.py", line 217, in _add_onnxscript_fn
    raise errors.OnnxExporterError("Module onnx is not installed!") from e
torch.onnx.errors.OnnxExporterError: Module onnx is not installed!

Here are search results of "onnx" in my TAS folder:

image

NevermindNilas commented 1 week ago

Hi,

I could indeed reproduce those issues,

Nightly seems a bit of a mess for now and I will try to rework it.

In the meantime, if you have python3.12 installed on your system and some 15GB to spare, it's easier to run python ./build.py

That seems to work on my end.

GoldJohnKing commented 1 week ago

Hi,

I could indeed reproduce those issues,

Nightly seems a bit of a mess for now and I will try to rework it.

In the meantime, if you have python3.12 installed on your system and some 15GB to spare, it's easier to run python ./build.py

That seems to work on my end.

python ./build.py finished successfully without error.

rife-tensorrt wont work, log still says "onnx not installed".

span wont work either, log says: "NameError: name 'name' is not defined".

============== Command Line Arguments ==============
..\TheAnimeScripter\main.exe --half False --buffer_limit 100 --input F:\Tools\Scripts\input.mp4 --output F:\Tools\Scripts\output.mp4 --upscale --upscale_factor 2 --upscale_method span --custom_encoder=-c:a copy -c:v hevc_nvenc -preset p7 -tune hq -profile:v main -pix_fmt yuv420p -tier high -rc constqp -qp 15

============== Arguments ==============
INPUT: F:\Tools\Scripts\input.mp4
OUTPUT: F:\Tools\Scripts\output.mp4
INPOINT: 0
OUTPOINT: 0
HALF: True
INTERPOLATE_FACTOR: 2
INTERPOLATE_METHOD: rife
UPSCALE: True
UPSCALE_FACTOR: 2
UPSCALE_METHOD: span
DEDUP_METHOD: ssim
DEDUP_SENS: 35
SAMPLE_SIZE: 224
SHARPEN_SENS: 0.5
DENOISE_METHOD: scunet
RESIZE_FACTOR: 2
RESIZE_METHOD: bicubic
SEGMENT_METHOD: anime
AUTOCLIP_SENS: 50
SCENECHANGE_METHOD: maxxvit-directml
SCENECHANGE_SENS: 50
DEPTH_METHOD: small_v2
DEPTH_QUALITY: high
ENCODE_METHOD: x264
CUSTOM_ENCODER: -c:a copy -c:v hevc_nvenc -preset p7 -tune hq -profile:v main -pix_fmt yuv420p -tier high -rc constqp -qp 15
BUFFER_LIMIT: 100
AUDIO: True
BIT_DEPTH: 8bit

============== System Checker ==============
OS Name: Microsoft Windows 11 ÆóÒµ°æ
CPU: 12th Gen Intel(R) Core(TM) i7-12700KF
RAM: 63.86 GB
Available RAM: 54.06 GB
Graphics Card 0: Meta Virtual Monitor
Graphics Card 1: Microsoft Remote Display Adapter
Graphics Card 2: NVIDIA GeForce RTX 4090

============== Arguments Checker ==============
FFMPEG Path: C:\Users\GoldJohnKing\AppData\Roaming\TheAnimeScripter\ffmpeg\ffmpeg.exe
New dedup sensitivity for ssim is: 0.965
New scenechange sensitivity is: 0.85
Custom encoder specified, use with caution since some functions can make or break the encoding process

============== Video Metadata ==============
Width: 2520
Height: 1080
AspectRatio: 2.33
FPS: 60.0
Number of total frames: 12013
Codec: hevc
Duration: 200.22 seconds
In-Out Duration: 0.0 seconds
Total frames to be processed: 12013
Pixel Format: yuv420p

============== Processing Outputs ==============
Something went wrong: name 'name' is not defined
Traceback (most recent call last):
  File "main.py", line 227, in start
  File "src\initializeModels.py", line 187, in initializeModels
    from src.unifiedUpscale import UniversalPytorch
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "src\unifiedUpscale.py", line 5, in <module>
    from spandrel import ImageModelDescriptor, ModelLoader
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "spandrel\__init__.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "spandrel\__helpers\loader.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "spandrel\__helpers\main_registry.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "spandrel\architectures\DAT\__init__.py", line 13, in <module>
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "spandrel\architectures\DAT\arch\DAT.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "einops\layers\torch.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "einops\_torch_specific.py", line 128, in <module>
  File "einops\_torch_specific.py", line 107, in allow_ops_in_compiled_graph
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "torch\_dynamo\__init__.py", line 3, in <module>
    from . import convert_frame, eval_frame, resume_execution
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "torch\_dynamo\convert_frame.py", line 31, in <module>
    from torch._dynamo.utils import CompileTimeInstructionCounter
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "torch\_dynamo\utils.py", line 89, in <module>
    import torch._numpy as tnp
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "torch\_numpy\__init__.py", line 7, in <module>
    from ._ndarray import (
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "torch\_numpy\_ndarray.py", line 12, in <module>
    from . import _dtypes, _dtypes_impl, _funcs, _ufuncs, _util
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "torch\_numpy\_ufuncs.py", line 235, in <module>
    vars()[name] = deco_binary_ufunc(ufunc)
           ^^^^
NameError: name 'name' is not defined

Looks like a dependency issue, I will see if I can solve it.

Meanwhile, I will revert back to v1.9.4 and wait for your fix. 😅

NevermindNilas commented 1 week ago

That's funny,

It works well on my PC. 😂😂😂

I will have to try in a VM or something I guess. Maybe I have some dependencies that don't get picked up by Pyinstaller in a " blank " environment.

Thanks for notifying me about it.

NevermindNilas commented 6 days ago

Hi,

Can you test this nightly build of TAS.

image

For me it seems to work 🥇

GoldJohnKing commented 5 days ago

Hi,

Can you test this nightly build of TAS.

image

For me it seems to work 🥇

Nope, it still says "ImportError: DLL load failed while importing onnx_cpp2py_export".

I googled a bit, looks like a onnx has an issue on Windows, and setting onnx version <= 1.16.1 solves the issue.

Reference: https://github.com/onnx/onnx/issues/6267

Besides, I also tried installing Python 3.12 and without any Python on my system, neither helps with the issue.

NevermindNilas commented 5 days ago

Ok, just to be sure I have downgraded onnx to 1.16.0 which I remember using in the past.

Might be worth giving it a try with nightly now.

GoldJohnKing commented 4 days ago

Ok, just to be sure I have downgraded onnx to 1.16.0 which I remember using in the past.

Might be worth giving it a try with nightly now.

Great! It works now! 😄