light-and-ray / sd-webui-topaz-photo-ai-integration

Topaz Photo AI upscaler inside sd-webui
11 stars 1 forks source link

Error during upscaling #1

Closed AndreyRGW closed 5 months ago

AndreyRGW commented 5 months ago
'C:\\Program Files\\Topaz Labs LLC\\Topaz Photo AI\\tpai.exe' --output C:\Users\RGWyo\AppData\Local\Temp\tmpox33m9gu --override --upscale scale=2 --face_recovery enabled=false C:\Users\RGWyo\AppData\Local\Temp\tmp98qxng2w\file.jpg
Checking if log directory should be pruned. Currently have 11 log files.
Number of logs exceeds max number to keep ( 10 ). Cleaning excess logs.
QObject::moveToThread: Cannot move objects with a parent
Logger initialized
Error | Invalid token structure QList("")
Change the following settings within the preferences panel in the app
Application settings:
  Overwrite Files: 0
  Recurse Directories: 0
  Input File Count: 1
  Output Folder: C:\Users\RGWyo\AppData\Local\Temp\tmpox33m9gu
  Output Format: Preserve
  Jpeg quality: 95
  Png compression level: 2
  Tiff compression: none
  Tiff bit depth: 16
Autopilot settings:
  Auto apply filters: true (Forced)
  Face Detection: auto
  Face Strength: 80
  Face Parts: hair,necks
  Sharpen Model: Auto
  Sharpen Levels: medium,high
  Sharpen Strength: 3
  Upscaling Model: Auto
  Auto Upscaling Type: auto
  Auto Upscaling Factor: 2
  Upscaling Denoise Strength: 3
  Upscaling Deblur Strength: 3
  Resolution Unit: 1
  Resolution: -1
  Denoise (non-RAW) Model: Auto
  Denoise (non-RAW) Levels: medium,high,severe
  Denoise (non-RAW) Strength: 3
  Denoise (RAW) Model: Auto
  Denoise (RAW) Levels: low,medium,high,severe
  Denoise (RAW) Strength: 3
  Denoise vs Sharpen: auto
  Adjust Lighting Strength: 25
  Adjust Lighting RAW Strength: 8
  Balance Color Temperature: 50
  Balance Color Opacity: 100
  Default Subject Type: Subject
ExifTool loaded!
Warning: failed to load Config_git.pl, something strange about this perl...
[ WARN:0@1,164] global matrix_expressions.cpp:1334 cv::MatOp_AddEx::assign OpenCV/MatExpr: processing of multi-channel arrays might be changed in the future: https://github.com/opencv/opencv/issues/16739
Overwriting Autopilot values
Overwriting Face Recovery enabled to true
Overwriting Face Recovery enabled to false
Overwriting Enhance enabled to true
Overwriting Enhance scale to 2
*** Error completing request
*** Arguments: ('task(2fvknpdfv61rd9y)', 0.0, <PIL.Image.Image image mode=RGBA size=1024x1024 at 0x1183EA79600>, None, '', '', True, True, 0.0, 4, 0.0, 512, 512, True, 'Topaz Photo AI - Upscale 2x', 'None', 0, False, False, 'Automatic', -1, -1, -1, False, 'Automatic', -1, -1, False, 1, False, 1, 0, False, 0.5, 0.2, False, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1, False, ['Horizontal'], False, ['Deepbooru'], False, 0.03, 50, False, 'Canon', 'EF 24-70mm f/2.8L II USM', 'Melissa', '4183876', '8678391', '27,1', '32,10', '954,1000', '5127', False, False, 4, None, False, 'A1111', None, False, '0', '0', 'inswapper_128.onnx', 'CodeFormer', 1, True, 'None', 1, 1, 1, 0, 0, 0.5, 'CUDA', False, 0, 'None', '', None, False, False, 0.5, 0, False, False, 8, 'Nearest', False, 1, False, 0) {}
    Traceback (most recent call last):
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 617, in _rmtree_unsafe
        os.unlink(fullname)
    PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\RGWyo\\AppData\\Local\\Temp\\tmpq8ovv9dn\\file.jpg'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 843, in onerror
        _os.unlink(path)
    PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\RGWyo\\AppData\\Local\\Temp\\tmpq8ovv9dn\\file.jpg'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "F:\WBC\automatic1111_dev\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "F:\WBC\automatic1111_dev\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "F:\WBC\automatic1111_dev\modules\postprocessing.py", line 131, in run_postprocessing_webui
        return run_postprocessing(*args, **kwargs)
      File "F:\WBC\automatic1111_dev\modules\postprocessing.py", line 71, in run_postprocessing
        scripts.scripts_postproc.run(initial_pp, args)
      File "F:\WBC\automatic1111_dev\modules\scripts_postprocessing.py", line 198, in run
        script.process(single_image, **process_args)
      File "F:\WBC\automatic1111_dev\scripts\postprocessing_upscale.py", line 152, in process
        upscaled_image = self.upscale(pp.image, pp.info, upscaler1, upscale_mode, upscale_by, max_side_length, upscale_to_width, upscale_to_height, upscale_crop)
      File "F:\WBC\automatic1111_dev\scripts\postprocessing_upscale.py", line 107, in upscale
        image = upscaler.scaler.upscale(image, upscale_by, upscaler.data_path)
      File "F:\WBC\automatic1111_dev\modules\upscaler.py", line 68, in upscale
        img = self.do_upscale(img, selected_model)
      File "F:\WBC\automatic1111_dev\extensions\sd-webui-topaz-photo-ai-integration\scripts\topaz_upscaler.py", line 28, in do_upscale
        return simpleUpscale(img, self.fields.scale)
      File "F:\WBC\automatic1111_dev\extensions\sd-webui-topaz-photo-ai-integration\topaz_photo_ai\main.py", line 8, in simpleUpscale
        return runTopaz(img, '--upscale', f'scale={scale}', '--face_recovery', 'enabled=false')
      File "F:\WBC\automatic1111_dev\extensions\sd-webui-topaz-photo-ai-integration\topaz_photo_ai\tools.py", line 61, in runTopaz
        tmpOutDir.cleanup()
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 873, in cleanup
        self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 855, in _rmtree
        _shutil.rmtree(name, onerror=onerror)
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 749, in rmtree
        return _rmtree_unsafe(path, onerror)
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 619, in _rmtree_unsafe
        onerror(os.unlink, fullname, sys.exc_info())
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 846, in onerror
        cls._rmtree(path, ignore_errors=ignore_errors)
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 855, in _rmtree
        _shutil.rmtree(name, onerror=onerror)
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 749, in rmtree
        return _rmtree_unsafe(path, onerror)
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 600, in _rmtree_unsafe
        onerror(os.scandir, path, sys.exc_info())
      File "C:\Users\RGWyo\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 597, in _rmtree_unsafe
        with os.scandir(path) as scandir_it:
    NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\RGWyo\\AppData\\Local\\Temp\\tmpq8ovv9dn\\file.jpg'

---
light-and-ray commented 5 months ago

Thanks for reporting. I didn't test in on windows. So my script tries to remove temp file while it's still opened in topaz, and windows doesn't allow modification of file opened in other program

light-and-ray commented 5 months ago

Can you updated extension and test?

AndreyRGW commented 5 months ago

Can you updated extension and test?

Sure, one sec

AndreyRGW commented 5 months ago

Can you updated extension and test?

It works now, thanks!