styler00dollar / VSGAN-tensorrt-docker

Using VapourSynth with super resolution and interpolation models and speeding them up with TensorRT.
BSD 3-Clause "New" or "Revised" License
286 stars 30 forks source link

Illegal instruction (core dumped) #48

Closed chinrw closed 1 year ago

chinrw commented 1 year ago

When I try to render the video by your docker image, it gave me this error

[in#1 @ 0x55d6426a5400] Error opening input: Invalid data found when processing input
Error opening input file pipe:.
Error opening input files: Invalid data found when processing input
Illegal instruction (core dumped)

Use the default config

    os.system(
        f"vspipe -c y4m inference_batch.py --arg source='{f}' - | ffmpeg -y -i '{f}' -thread_queue_size 100 -i pipe: -map 1 -map 0 -map -0:v -max_interleave_delta 0 -scodec copy -crf 10 -preset slow '{mux_path}'"
    )

Only updated the engine path, and the code doesn't execute this far, it looks failed at clip = core.ffms2.Source(source=video_path, cache=False)

    clip = core.trt.Model(
        clip,
        engine_path="/workspace/tensorrt/sudo_RealESRGAN2x_Dropout_3.799.042_opset16_fp16.engine",
        # tilesize=[854, 480],
        overlap=[0, 0],
        num_streams=4,
    )

Here is the complete log.

root@07db24560f0e:/workspace/tensorrt# python main.py
Processing /workspace/tensorrt/input/test2.mp4
ffmpeg version N-112456-g90d327d607 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --extra-cflags='-fopenmp -lcrypto -lz -ldl -static-libgcc -I/opt/cuda/include' --extra-cxxflags='-fopenmp -lcrypto -lz -ldl -static-libgcc' --extra-ldflags='-fopenmp -lcrypto -lz -ldl -static-libgcc -L/opt/cuda/lib64' --extra-libs='-lstdc++ -lcrypto -lz -ldl -static-libgcc' --pkg-config-flags=--static --toolchain=hardened --disable-debug --disable-shared --disable-ffplay --enable-static --enable-gpl --enable-gray --enable-nonfree --enable-openssl --enable-iconv --enable-libxml2 --enable-libmp3lame --enable-libfdk-aac --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvpx --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libaom --enable-libvidstab --enable-libkvazaar --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libsoxr --enable-libopenjpeg --enable-libdav1d --enable-librav1e --enable-libsrt --enable-libsvtav1 --enable-libdavs2 --enable-libxavs2 --enable-libvmaf --enable-cuda-nvcc --enable-vapoursynth --enable-libopenh264 --enable-optimizations --enable-cuda-llvm --enable-nvdec --enable-nvenc --enable-cuvid --enable-cuda --enable-pthreads --enable-runtime-cpudetect --enable-lto
  libavutil      58. 27.100 / 58. 27.100
  libavcodec     60. 30.102 / 60. 30.102
  libavformat    60. 15.100 / 60. 15.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/workspace/tensorrt/input/test2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:09.98, start: 0.000000, bitrate: 28709 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 28521 kb/s, 59.94 fps, 59.94 tbr, 979001.00 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id       : [0][0][0][0]

[in#1 @ 0x55d6426a5400] Error opening input: Invalid data found when processing input
Error opening input file pipe:.
Error opening input files: Invalid data found when processing input
Illegal instruction (core dumped)
Anon1337Elite commented 1 year ago

Just wanna mention it is prolly not on ur side i have the Same without the core dumped msg, It is most likely an issue on how the docker image was compiled. I tried complying it on my own but it errors so it might be outdated.

styler00dollar commented 1 year ago

This error message suggests that you use an outdated cpu with not all instruction sets needed. Rebuild the image from scratch with DOCKER_BUILDKIT=1 docker build --no-cache -t styler00dollar/vsgan_tensorrt:latest . instead of downloading it and it will most likely resolve cpu related compatibility issues. I use a 7950x to compile the depenencies in docker and it seems like lacking avx support on other cpus is the reason. On my side, Arch and Windows 10 work fine.

Since I don't know what dependency throws that error and have no way to verify or recreate this problem myself, I will not support it. I need at least one confirmation that rebuilding the docker image from scratch works properly, then I can just close the issue.

chinrw commented 1 year ago

OK, since I'm using the "outdated" i3900k which doesn't support AVX 512, I tried to build the docker image myself. And the original Dockerfile doesn't work due to some updated package versions. I have created a new pr for this.

styler00dollar commented 1 year ago

I was suspecting some sort of AVX instruction set, but this seems to confirm AVX512 then.

due to some updated package versions.

Yeah, that happens all the time. I often do adjustments prior to building since versions can change. That's why I like to upload my docker images to dockerhub so others don't have to bother.

I have created a new pr for this.

My pc is currently not in a working state due to boot problems so I can't test it myself right now, but it looks good, thanks. I will just merge it in.

Does this mean you got it working by rebuilding the docker from scratch? If yes, would you mind to upload the image to dockerhub? I would then link it in the readme while I don't have a way to build it myself. Building the docker on a cpu that does not support AVX512 should be the easiest way to disable it for now. I could try to build the image on my steam deck or some other hardware I don't usually use, but I will need to see if it will work.

chinrw commented 1 year ago

Hi, it works if I rebuild the docker from scratch. And here is the dockerhub link https://hub.docker.com/r/chin39/vsgan_tensorrt/.

Anon1337Elite commented 1 year ago

Hi, it works if I rebuild the docker from scratch. And here is the dockerhub link https://hub.docker.com/r/chin39/vsgan_tensorrt/.

Could u link the docker file u used to build or did u use the github one styler updated ? Cause i get to a point at around 70/176 and it crashes. Retrying now from scratch will see if it works.

ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends cuda-12-1 cuda-cudart-12-1 cuda-compat-12-1 && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100

chinrw commented 1 year ago

@Anon1337Elite Hi, I am using the https://github.com/styler00dollar/VSGAN-tensorrt-docker/blob/main/Dockerfile since my PR has been merged. Does it have more error messages above? It should have some details rather than just exit code.

BTW, "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends cuda-12-1 cuda-cudart-12-1 cuda-compat-12-1 && rm -rf /var/lib/apt/lists/*" may be affected by your network, could you try to rerun again?

Anon1337Elite commented 1 year ago

@Anon1337Elite Hi, I am using the https://github.com/styler00dollar/VSGAN-tensorrt-docker/blob/main/Dockerfile since my PR has been merged. Does it have more error messages above? It should have some details rather than just exit code.

BTW, "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends cuda-12-1 cuda-cudart-12-1 cuda-compat-12-1 && rm -rf /var/lib/apt/lists/*" may be affected by your network, could you try to rerun again?

Thanks it worked the 3rd time.

styler00dollar commented 1 year ago

Added relevant information into readme. Thanks.

styler00dollar commented 10 months ago

Tried to build the docker on an old intel quad-core cpu and it worked. I will try to keep avx and non-avx docker images updated.