Sometimes the error mentioned in the title occurs, after which the server stops processing images and keeps giving this error.
If the server is manually restarted, it starts working correctly, continuing to process images.
Is it possible to make it restart automatically when such an error occurs?
127.0.0.1 - - [29/Jul/2024 13:14:13] "POST /colorize-image-data HTTP/1.1" 200 -
127.0.0.1 - - [29/Jul/2024 13:14:55] "OPTIONS /colorize-image-data HTTP/1.1" 200 -
[+] [D2FZ7T3G] Requested image: 684f4f37-e95d-44e2-88c1-730889db4114, Width: 1125, Height: 1600
[+] [D2FZ7T3G] Colorize: True, Upscale: True(x4), Denoise: True
[*] [D2FZ7T3G] Denoising image...
[!] [D2FZ7T3G] Error: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
127.0.0.1 - - [29/Jul/2024 13:14:56] "POST /colorize-image-data HTTP/1.1" 200 -
[+] [4NF2I4X9] Requested image: c2dce404-1793-4c99-8dd4-e1cb2adb02cd, Width: 1125, Height: 1600
[+] [4NF2I4X9] Colorize: True, Upscale: True(x4), Denoise: True
[*] [4NF2I4X9] Denoising image...
[!] [4NF2I4X9] Error: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.
127.0.0.1 - - [29/Jul/2024 13:14:56] "POST /colorize-image-data HTTP/1.1" 200 -
(venv) h:\Manga-Colorizer-revamp>app-stream.py
H:\Manga-Colorizer-revamp\colorizator.py:22: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state_dict = torch.load(config.colorizer_path, map_location=self.device)
H:\Manga-Colorizer-revamp\denoising\denoiser.py:42: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state_dict = torch.load(weights_path, map_location=torch.device('cpu'))
H:\Manga-Colorizer-revamp\upscalator.py:19: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
model = torch.load(config.upscaler_path, map_location=self.device)
C:\Python312\Lib\site-packages\torch\serialization.py:1189: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
C:\Python312\Lib\site-packages\torch\serialization.py:1189: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
C:\Python312\Lib\site-packages\torch\serialization.py:1189: SourceChangeWarning: source code of class 'torch.nn.modules.activation.LeakyReLU' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
* Serving Flask app 'app-stream'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on https://127.0.0.1:5000
* Running on https://192.168.0.3:5000
Press CTRL+C to quit
127.0.0.1 - - [29/Jul/2024 13:15:53] "OPTIONS /colorize-image-data HTTP/1.1" 200 -
[+] [7YLY6313] Requested image: 4c1ed87e-1587-43cf-8e83-45794973117c, Width: 1013, Height: 1440
[+] [7YLY6313] Colorize: True, Upscale: True(x4), Denoise: True
[*] [7YLY6313] Denoising image...
H:\Manga-Colorizer-revamp\denoising\functions.py:40: UserWarning: The torch.cuda.*DtypeTensor constructors are no longer recommended. It's best to use methods such as torch.tensor(data, dtype=*, device='cuda') to create tensors. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\tensor\python_tensor.cpp:80.)
downsampledfeatures = torch.cuda.FloatTensor(N, Cout, Hout, Wout).fill_(0)
[+] [7YLY6313] Denoised image [1440, 1013, 4]->[1200, 844, 3] in 0.52 seconds.
[*] [7YLY6313] Colorizing image...
[+] [7YLY6313] Colorized image [1200, 844, 3]->[819, 576, 3] in 0.37 seconds.
[*] [7YLY6313] Upscaling image...
[+] [7YLY6313] Upscaled image (x4) [819, 576, 3]->[3276, 2304, 3] in 0.54 seconds.
127.0.0.1 - - [29/Jul/2024 13:15:57] "POST /colorize-image-data HTTP/1.1" 200 -
[+] [CY1F6KS6] Requested image: 5556783d-16ab-4d7f-b9eb-dcc15427a8ee, Width: 1125, Height: 1600
[+] [CY1F6KS6] Colorize: True, Upscale: True(x4), Denoise: True
[*] [CY1F6KS6] Denoising image...
[+] [CY1F6KS6] Denoised image [1600, 1125, 4]->[1200, 843, 3] in 0.23 seconds.
[*] [CY1F6KS6] Colorizing image...
[+] [CY1F6KS6] Colorized image [1200, 843, 3]->[820, 576, 3] in 0.29 seconds.
[*] [CY1F6KS6] Upscaling image...
[+] [CY1F6KS6] Upscaled image (x4) [820, 576, 3]->[3280, 2304, 3] in 0.55 seconds.
127.0.0.1 - - [29/Jul/2024 13:16:01] "POST /colorize-image-data HTTP/1.1" 200 -
127.0.0.1 - - [29/Jul/2024 13:16:20] "OPTIONS /colorize-image-data HTTP/1.1" 200 -
[+] [3RV2N4KH] Requested image: f5bde9bf-315d-45ff-8ecd-f069b24be781, Width: 1125, Height: 1600
[+] [3RV2N4KH] Colorize: True, Upscale: True(x4), Denoise: True
[*] [3RV2N4KH] Denoising image...
[+] [3RV2N4KH] Denoised image [1600, 1125, 4]->[1200, 843, 3] in 0.39 seconds.
[*] [3RV2N4KH] Colorizing image...
[+] [3RV2N4KH] Colorized image [1200, 843, 3]->[820, 576, 3] in 0.19 seconds.
[*] [3RV2N4KH] Upscaling image...
[+] [3RV2N4KH] Upscaled image (x4) [820, 576, 3]->[3280, 2304, 3] in 0.59 seconds.
127.0.0.1 - - [29/Jul/2024 13:16:23] "POST /colorize-image-data HTTP/1.1" 200 -