HolyWu / vs-rife

RIFE function for VapourSynth
MIT License
98 stars 7 forks source link

Issue running #55

Closed Logi-Ca1 closed 1 month ago

Logi-Ca1 commented 2 months ago

Hi HolyWu,

Thanks for your hard work, but after many hours troubleshooting I have no choice but to ask for help. I hope that's ok.

My script throws an error, and after troubleshooting, I narrowed it down to torch_tensorrt. This is what happens when I try to import torch_tensorrt in Python:

Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import torch_tensorrt Traceback (most recent call last): File "", line 1, in File "C:\Python34\Lib\site-packages\torch_tensorrt__init.py", line 127, in from torch_tensorrt import ts File "C:\Python34\Lib\site-packages\torch_tensorrt\ts\init__.py", line 1, in from torch_tensorrt.ts._compile_spec import TensorRTCompileSpec # noqa: F401 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_tensorrt\ts_compile_spec.py", line 7, in import torch_tensorrt._C.ts as _ts_C ImportError: DLL load failed while importing _C: The specified procedure could not be found. exit()

I know the folder says Python34, but I assure you I have Python 3.12 installed.

Here is my pip list:

tensorrt 10.0.1 tensorrt-cu12 10.2.0.post1 tensorrt-cu12_bindings 10.0.1 tensorrt-cu12_libs 10.0.1 TIVTC 2 torch 2.5.0.dev20240802+cu124 torch_tensorrt 2.5.0.dev20240722+cu124 torchaudio 2.4.0.dev20240802+cu124 torchvision 0.20.0.dev20240802+cu124 tqdm 4.66.1 TTempSmooth 4.1 typing_extensions 4.8.0 tzlocal 1.5.1 urllib3 2.2.2 VapourSynth 69 virtualenv 16.6.1 virtualenv-clone 0.5.3 vsbasicvsr 1.0.0 vsgan 1.2.1 vsrealesrgan 1.0.0 vsrife 5.2.0 Waifu2x_NCNN_Vulkan 5 Waifu2x_NCNN_Vulkan_models 0.1 whichcraft 0.6.0 yapf 0.31.0 ZNEDI3 2.1

Am I doing something wrong?

HolyWu commented 2 months ago

It's probably caused by version mismatch. Try installing the latest nightly build by pip install --pre -U torch torchvision torch_tensorrt --index-url https://download.pytorch.org/whl/nightly/cu124 --extra-index-url https://pypi.nvidia.com

Logi-Ca1 commented 1 month ago

Thank you, after running the pip command you provided, I am able to import torch_tensorrt without any issues now. However, I get the following error now:

Script Error

Python exception: 'NoneType' object has no attribute 'isatty'

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information

Traceback (most recent call last): File "src\cython\vapoursynth.pyx", line 3374, in vapoursynth._vpy_evaluate File "src\cython\vapoursynth.pyx", line 3375, in vapoursynth._vpy_evaluate File "P:\Test\Work.vpy", line 28, in clip = rife(clip, trt=True, model="4.18") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context return func(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\vsrife__init.py", line 319, in rife exported_program = torch.export.export(flownet, example_tensors, dynamic_shapes=dynamic_shapes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export\init__.py", line 173, in export return _export( ^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export_trace.py", line 1069, in wrapper raise e File "C:\Python34\Lib\site-packages\torch\export_trace.py", line 1042, in wrapper ep = fn(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export\exported_program.py", line 96, in wrapper return fn(args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export_trace.py", line 2035, in _export export_artifact = export_func( # type: ignore[operator] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export_trace.py", line 1276, in _strict_export return _strict_export_lower_to_aten_ir( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export_trace.py", line 1304, in _strict_export_lower_to_aten_ir gm_torch_level = _export_to_torch_ir( ^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\export_trace.py", line 552, in _export_to_torch_ir gm_torchlevel, = torch._dynamo.export( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\eval_frame.py", line 1429, in inner result_traced = opt_f(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\eval_frame.py", line 463, in _fn return fn(*args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\nn\modules\module.py", line 1736, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch\nn\modules\module.py", line 1747, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 1237, in call return self._torchdynamo_orig_callable( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 513, in call return _compile( ^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 928, in _compile raise InternalTorchDynamoError(str(e)).with_traceback( File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 901, in _compile guarded_code = compile_inner(code, one_graph, hooks, transform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 652, in compile_inner return _compile_inner(code, one_graph, hooks, transform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_utils_internal.py", line 85, in wrapper_function return StrobelightCompileTimeProfiler.profile_compile_time( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_strobelight\compile_time_profiler.py", line 129, in profile_compile_time return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 685, in _compile_inner out_code = transform_code_object(code, transform) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\bytecode_transformation.py", line 1322, in transform_code_object transformations(instructions, code_options) File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 207, in _fn return fn(args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\convert_frame.py", line 621, in transform tracer.run() File "C:\Python34\Lib\site-packages\torch_dynamo\symbolic_convert.py", line 2723, in run super().run() File "C:\Python34\Lib\site-packages\torch_dynamo\symbolic_convert.py", line 958, in run while self.step(): ^^^^^^^^^^^ File "C:\Python34\Lib\site-packages\torch_dynamo\symbolic_convert.py", line 870, in step self.dispatch_table[inst.opcode](self, inst) File "C:\Python34\Lib\site-packages\torch_dynamo\symbolic_convert.py", line 2914, in RETURN_VALUE self._return(inst) File "C:\Python34\Lib\site-packages\torch_dynamo\symbolic_convert.py", line 2899, in _return self.output.compile_subgraph( File "C:\Python34\Lib\site-packages\torch_dynamo\output_graph.py", line 1109, in compile_subgraph self.compile_and_call_fx_graph(tx, list(reversed(stack_values)), root) File "C:\Python34\Lib\site-packages\torch_dynamo\output_graph.py", line 1309, in compile_and_call_fx_graph insert_deferred_runtime_asserts( File "C:\Python34\Lib\site-packages\torch\fx\passes\runtime_assert.py", line 113, in insert_deferred_runtime_asserts lazy_format_graph_code( File "C:\Python34\Lib\site-packages\torch\fx_utils.py", line 23, in lazy_format_graph_code if "colored" in kwargs and not sys.stdout.isatty(): ^^^^^^^^^^^^^^^^^ torch._dynamo.exc.InternalTorchDynamoError: 'NoneType' object has no attribute 'isatty'

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information

HolyWu commented 1 month ago

I have a feeling that your Python environment is broken, as there is no reason for sys.stdout to be None.

Jobus0 commented 4 days ago

I had the same issue with sys.stdout being None, and worked around it by setting it to os.devnull instead.

To do that, put this at the top of your vapoursynth script:

import sys
import os

if sys.stdout is None:
    sys.stdout = open(os.devnull, 'w')  # Redirect to /dev/null (no output)