メインコンテンツへスキップ
見出し画像

DataTypeConverter

    DataTypeConverter

    最初から身も蓋もない事を書きますが、当ノードの必要性が何処まで普遍的なものか…極論すれば私以外のユーザーに対しても有効性及び必要性が生じるものか、判断できませんし、検証している時間的余力もありません。
    (Cursorの解説によれば普遍的に起こりうるエラーだが)

    要するに、自分には必要だったから作った、只それだけです。

    発端はUltimate SD Upscaleのエラーです。エラー文は超絶長いので割愛しますが、ある意味衝撃的で、このノードはSD1.5以来あらゆるケースに対応する、超絶安定しているノードだからです。

    こいつがエラー起こす処は、ほとんど見た事がないです。それがコケたのでね、ある意味斬新でした。

    作成したcustom_nodesは以下の様に、前に置きます。

    画像

    Cursor先生曰く以下ですが、Pytorch2.8.0+cu129更新でいきなりこうはなっていません。ComfyUI本体の更新によるとしか解釈できませんが、そもそも普遍的に起こりうるものか…も判断できません。

    とにかく、己の目の前にエラーがあるからには、何とかするしかねえだろうがって話です。

    …

    DataTypeConverterノードが必要になった背景を詳しく解説します。

    import torch
    import numpy as np
    
    class ImageToFloat32:
        """画像テンソルをfloat32型に変換するノード"""
        
        @classmethod
        def INPUT_TYPES(cls):
            return {
                "required": {
                    "image": ("IMAGE",),
                },
            }
        
        RETURN_TYPES = ("IMAGE",)
        FUNCTION = "convert_to_float32"
        CATEGORY = "image/converters"
    
        def convert_to_float32(self, image):
            # テンソルがdouble型(float64)の場合はfloat32に変換
            if image.dtype == torch.float64:
                image = image.float()
            elif image.dtype == torch.float16:
                image = image.float()
            
            return (image,)
    
    class ImageToFloat64:
        """画像テンソルをfloat64型に変換するノード"""
        
        @classmethod
        def INPUT_TYPES(cls):
            return {
                "required": {
                    "image": ("IMAGE",),
                },
            }
        
        RETURN_TYPES = ("IMAGE",)
        FUNCTION = "convert_to_float64"
        CATEGORY = "image/converters"
    
        def convert_to_float64(self, image):
            # テンソルをfloat64型に変換
            if image.dtype != torch.float64:
                image = image.double()
            
            return (image,)
    
    class ImagePrecisionConverter:
        """画像テンソルの精度を選択可能なノード"""
        
        @classmethod
        def INPUT_TYPES(cls):
            return {
                "required": {
                    "image": ("IMAGE",),
                    "precision": (["float32", "float64", "float16"], {"default": "float32"}),
                },
            }
        
        RETURN_TYPES = ("IMAGE",)
        FUNCTION = "convert_precision"
        CATEGORY = "image/converters"
    
        def convert_precision(self, image, precision):
            if precision == "float32":
                if image.dtype != torch.float32:
                    image = image.float()
            elif precision == "float64":
                if image.dtype != torch.float64:
                    image = image.double()
            elif precision == "float16":
                if image.dtype != torch.float16:
                    image = image.half()
            
            return (image,)
    
    class UltimateSDUpscaleFix:
        """UltimateSDUpscale専用の修正ノード"""
        
        @classmethod
        def INPUT_TYPES(cls):
            return {
                "required": {
                    "image": ("IMAGE",),
                },
            }
        
        RETURN_TYPES = ("IMAGE",)
        FUNCTION = "fix_for_ultimate_sd"
        CATEGORY = "image/converters"
    
        def fix_for_ultimate_sd(self, image):
            # データ型をfloat32に統一
            if image.dtype != torch.float32:
                image = image.float()
            
            # 値の範囲を0-1に正規化(必要に応じて)
            if image.max() > 1.0 or image.min() < 0.0:
                image = torch.clamp(image, 0.0, 1.0)
            
            return (image,)
    
    # ノードの登録
    NODE_CLASS_MAPPINGS = {
        "ImageToFloat32": ImageToFloat32,
        "ImageToFloat64": ImageToFloat64,
        "ImagePrecisionConverter": ImagePrecisionConverter,
        "UltimateSDUpscaleFix": UltimateSDUpscaleFix,
    }
    
    NODE_DISPLAY_NAME_MAPPINGS = {
        "ImageToFloat32": "Image → Float32",
        "ImageToFloat64": "Image → Float64",
        "ImagePrecisionConverter": "Image Precision Converter",
        "UltimateSDUpscaleFix": "UltimateSD Upscale Fix",
    }

    技術的背景

    1. PyTorch 2.8.0の重大な変更

    以前のPyTorch(2.7.x以前):

    • データ型の暗黙的変換が許容されていた

    • `double`型(float64)と`float`型(float32)の混在が自動的に処理された

    • 型の不一致があっても警告程度で動作していた

    PyTorch 2.8.0での変更:

    • データ型の厳格なチェックが導入された

    • 暗黙的変換が禁止され、明示的な変換が必要になった

    • 型の不一致でエラーが発生するようになった

    2. ComfyUI 0.3.51の内部変更

    テンソル処理の更新:

    • 内部で使用されるテンソルのデータ型が変更された

    • 一部のノードで`double`型が使用されるようになった

    • 画像処理パイプラインでの型の一貫性が重要になった

    具体的な問題の発生メカニズム

    1. UltimateSDUpscaleの問題

    エラーの詳細:

    Input type (double) and bias type (float) should be the same

    発生原因:

    1. 入力画像が`double`型(float64)で渡される

    2. UltimateSDUpscaleの内部モデルが`float`型(float32)を期待

    3. PyTorch 2.8.0で型の不一致がエラーとして検出される

    技術的詳細:

    • アップスケールモデルの重み(bias)が`float32`で定義されている

    • 入力テンソルが`float64`の場合、計算時に型の不一致が発生

    • 以前は自動的に`float32`に変換されていたが、2.8.0では明示的な変換が必要

    2. RES4LYFノードの問題

    エラーの詳細:

    can't convert cuda:0 device type tensor to numpy

    発生原因:

    1. CUDAデバイス上のテンソルを直接numpyに変換しようとする

    2. PyTorch 2.8.0でCUDAテンソルの処理が厳格になった

    3. `.cpu()`による明示的なデバイス移動が必要になった

    なぜ今まで動いていたのか

    1. 暗黙的変換の許容

    • PyTorch 2.7.x以前では、型の不一致があっても自動的に変換されていた

    • 開発者が意識しなくても動作していた

    2. 緩い型チェック

    • 実行時の型チェックが緩かった

    • 警告は出るが、エラーにはならなかった

    3. 後方互換性の維持

    • 古いコードでも動作するよう配慮されていた

    • 2.8.0でこの配慮が削除された

    解決策の技術的根拠

    1. 明示的な型変換の必要性

    # 修正前(エラー発生)
    rgb = image[:, :, 0:3].numpy()
    
    # 修正後(正常動作)
    rgb = image[:, :, 0:3].cpu().numpy()

    2. データ型の統一

    # UltimateSDUpscaleFixノードの処理
    if image.dtype != torch.float32:
        image = image.float()  # 明示的にfloat32に変換

    3. デバイス管理の重要性

    • CUDAテンソルはCPUに移動してからnumpy変換

    • メモリ効率とパフォーマンスの両立

    今後の影響と対策

    1. 他のカスタムノードへの影響

    • 同様の問題が他のノードでも発生する可能性

    • データ型を扱うノードは要注意

    2. 開発者への影響

    • カスタムノード開発時に型の管理が重要になった

    • 明示的な型変換の実装が必要

    3. ユーザーへの影響

    • 既存のワークフローが動作しなくなる可能性

    • ノードの追加や設定変更が必要

    まとめ

    DataTypeConverterノードは、PyTorch 2.8.0とComfyUI 0.3.51の更新による「型安全性の向上」という技術的進歩に対応するための解決策です。これは後退ではなく、より堅牢なシステムへの移行過程で発生した一時的な互換性問題であり、明示的な型管理により、より安定した動作が期待できます。

    …

    Ultimate SD Upscaleだけでなく、他でも出ますね。以下は、Image Sharpenノードで出ました。

    
    # ComfyUI Error Report
    ## Error Details
    - **Node ID:** 161
    - **Node Type:** ImageSharpen
    - **Exception Type:** RuntimeError
    - **Exception Message:** expected scalar type Double but found Float
    
    ## Stack Trace
    ```
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 496, in execute
        output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 315, in get_output_data
        return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 289, in _async_map_node_over_list
        await process_inputs(input_dict, i)
    
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 277, in process_inputs
        result = f(**inputs)
                 ^^^^^^^^^^^
    
      File "D:\USERFILES\ComfyUI\ComfyUI\comfy_extras\nodes_post_processing.py", line 242, in sharpen
        sharpened = F.conv2d(tensor_image, kernel, padding=center, groups=channels)[:,:,sharpen_radius:-sharpen_radius, sharpen_radius:-sharpen_radius]
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    ```
    ## System Information
    - **ComfyUI Version:** 0.3.51
    - **Arguments:** D:\USERFILES\ComfyUI\ComfyUI\run_comfyui_with_patch.py --use-sage-attention --windows-standalone-build --output-directory D:\USERFILES\A1111\outputs\ComfyUI --log-stdout
    - **OS:** nt
    - **Python Version:** 3.12.10 (tags/v3.12.10:0cc8128, Apr  8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]
    - **Embedded Python:** true
    - **PyTorch Version:** 2.8.0+cu129
    ## Devices
    
    - **Name:** cuda:0 NVIDIA GeForce RTX 5060 Ti : cudaMallocAsync
      - **Type:** cuda
      - **VRAM Total:** 17102864384
      - **VRAM Free:** 15802040320
      - **Torch VRAM Total:** 0
      - **Torch VRAM Free:** 0
    
    ## Logs
    ```
    2025-08-21T18:18:35.781855 - [A2025-08-21T18:18:35.793258 - SageAttention kernel is being used for this generation.2025-08-21T18:18:35.793258 - 
    2025-08-21T18:18:35.793258 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:18:35.793258 - 
    2025-08-21T18:18:36.354709 - 
    2025-08-21T18:18:36.354709 - 
     10%|████████▎                                                                          | 1/10 [00:00<00:05,  1.75it/s]2025-08-21T18:18:36.355714 - [A2025-08-21T18:18:36.859799 - 
    2025-08-21T18:18:36.859799 - 
     20%|████████████████▌                                                                  | 2/10 [00:01<00:04,  1.88it/s]2025-08-21T18:18:36.860800 - [A2025-08-21T18:18:37.421156 - 
    2025-08-21T18:18:37.421156 - 
     30%|████████████████████████▉                                                          | 3/10 [00:01<00:03,  1.83it/s]2025-08-21T18:18:37.421156 - [A2025-08-21T18:18:37.940867 - 
    2025-08-21T18:18:37.940867 - 
     40%|█████████████████████████████████▏                                                 | 4/10 [00:02<00:03,  1.87it/s]2025-08-21T18:18:37.940867 - [A2025-08-21T18:18:38.507081 - 
    2025-08-21T18:18:38.507081 - 
     50%|█████████████████████████████████████████▌                                         | 5/10 [00:02<00:02,  1.83it/s]2025-08-21T18:18:38.507081 - [A2025-08-21T18:18:39.558868 - 
    2025-08-21T18:18:39.558868 - 
     60%|█████████████████████████████████████████████████▊                                 | 6/10 [00:03<00:02,  1.39it/s]2025-08-21T18:18:39.559872 - [A2025-08-21T18:18:40.079244 - 
    2025-08-21T18:18:40.079244 - 
     70%|██████████████████████████████████████████████████████████                         | 7/10 [00:04<00:01,  1.53it/s]2025-08-21T18:18:40.079244 - [A2025-08-21T18:18:40.642193 - 
    2025-08-21T18:18:40.642193 - 
     80%|██████████████████████████████████████████████████████████████████▍                | 8/10 [00:04<00:01,  1.60it/s]2025-08-21T18:18:40.643197 - [A2025-08-21T18:18:41.695009 - 
    2025-08-21T18:18:41.695009 - 
     90%|██████████████████████████████████████████████████████████████████████████▋        | 9/10 [00:05<00:00,  1.32it/s]2025-08-21T18:18:41.695009 - [A2025-08-21T18:18:42.748902 - 
    2025-08-21T18:18:42.748902 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:06<00:00,  1.18it/s]2025-08-21T18:18:42.748902 - [A2025-08-21T18:18:42.748902 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:06<00:00,  1.44it/s]2025-08-21T18:18:42.748902 - 
    2025-08-21T18:18:42.748902 - Restoring initial comfy attention2025-08-21T18:18:42.749902 - 
    2025-08-21T18:18:42.749902 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:18:42.749902 - 
    2025-08-21T18:18:43.232563 - 
    USDU: 100%|██████████████████████████████████████████████████████████████████████████| 25/25 [04:02<00:00,  8.34s/tile]2025-08-21T18:18:44.438667 - 
    USDU: 100%|██████████████████████████████████████████████████████████████████████████| 25/25 [04:03<00:00,  9.75s/tile]2025-08-21T18:18:44.438667 - 
    2025-08-21T18:18:45.951869 - GPU memory cleared2025-08-21T18:18:45.951869 - 
    2025-08-21T18:18:46.503245 - CPU memory cleared2025-08-21T18:18:46.503245 - 
    2025-08-21T18:18:47.030479 - Forced garbage collection completed2025-08-21T18:18:47.030479 - 
    2025-08-21T18:18:47.031480 - Virtual memory reset failed: Expected a cuda device, but got: cpu2025-08-21T18:18:47.031480 - 
    2025-08-21T18:18:47.031480 - Original functions restored2025-08-21T18:18:47.031480 - 
    2025-08-21T18:18:47.031480 - Comprehensive memory management completed2025-08-21T18:18:47.031480 - 
    2025-08-21T18:18:54.419905 - Prompt executed in 572.30 seconds
    2025-08-21T18:28:19.400911 - HTTP Request: GET http://127.0.0.1:11434/api/tags "HTTP/1.1 200 OK"
    2025-08-21T18:28:25.962612 - got prompt
    2025-08-21T18:28:26.076648 - Failed to validate prompt for output 165:
    2025-08-21T18:28:26.077646 - * UNETLoader 99:
    2025-08-21T18:28:26.077646 -   - Value not in list: unet_name: 'gonzalomoXLFluxPony_v10FluxSAIO.safetensors' not in (list of length 61)
    2025-08-21T18:28:26.077646 - Output will be ignored
    2025-08-21T18:28:26.077646 - Failed to validate prompt for output 105:
    2025-08-21T18:28:26.077646 - Output will be ignored
    2025-08-21T18:28:26.077646 - Failed to validate prompt for output 159:
    2025-08-21T18:28:26.077646 - Output will be ignored
    2025-08-21T18:28:26.077646 - Failed to validate prompt for output 162:
    2025-08-21T18:28:26.077646 - Output will be ignored
    2025-08-21T18:28:26.077646 - Failed to validate prompt for output 144:
    2025-08-21T18:28:26.077646 - Output will be ignored
    2025-08-21T18:28:26.077646 - Failed to validate prompt for output 145:
    2025-08-21T18:28:26.078646 - Output will be ignored
    2025-08-21T18:28:26.078646 - Failed to validate prompt for output 160:
    2025-08-21T18:28:26.078646 - Output will be ignored
    2025-08-21T18:28:26.078646 - Failed to validate prompt for output 98:
    2025-08-21T18:28:26.078646 - Output will be ignored
    2025-08-21T18:28:26.078646 - Failed to validate prompt for output 151:
    2025-08-21T18:28:26.078646 - Output will be ignored
    2025-08-21T18:28:29.138602 - gguf qtypes: F16 (1331)
    2025-08-21T18:28:29.177006 - model weight dtype torch.float16, manual cast: None
    2025-08-21T18:28:29.178006 - model_type FLOW
    2025-08-21T18:28:29.427024 - Requested to load WanTEModel
    2025-08-21T18:28:29.436136 - loaded completely 9.5367431640625e+25 10835.4765625 True
    2025-08-21T18:28:42.802880 - SELECTED: input1
    2025-08-21T18:28:42.885740 - SELECTED: input1
    2025-08-21T18:28:51.252319 - Requested to load WAN21_Vace
    2025-08-21T18:28:57.167347 - loaded partially 9594.49450845215 9594.488403320312 862
    2025-08-21T18:28:57.178759 - Patching comfy attention to use sageattn2025-08-21T18:28:57.178759 - 
    2025-08-21T18:28:57.178759 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:28:57.178759 - 
    2025-08-21T18:28:57.183760 - Restoring initial comfy attention2025-08-21T18:28:57.183760 - 
    2025-08-21T18:28:57.183760 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:28:57.183760 - 
    2025-08-21T18:28:59.298962 - loaded partially 12433.361287973632 12431.480590820312 0
    2025-08-21T18:28:59.309064 - Patching comfy attention to use sageattn2025-08-21T18:28:59.309064 - 
    2025-08-21T18:28:59.309064 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:28:59.309064 - 
    2025-08-21T18:28:59.312924 - (RES4LYF) rk_type: res_2s2025-08-21T18:28:59.312924 - 
    2025-08-21T18:28:59.322022 - 
      0%|                                                                                            | 0/6 [00:00<?, ?it/s]2025-08-21T18:28:59.618612 - SageAttention kernel is being used for this generation.2025-08-21T18:28:59.619611 - 
    2025-08-21T18:28:59.619611 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:28:59.619611 - 
    2025-08-21T18:30:28.893780 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 6/6 [01:29<00:00, 12.58s/it]2025-08-21T18:30:34.587783 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 6/6 [01:35<00:00, 15.88s/it]2025-08-21T18:30:34.587783 - 
    2025-08-21T18:30:34.596965 - Restoring initial comfy attention2025-08-21T18:30:34.596965 - 
    2025-08-21T18:30:34.596965 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:30:34.596965 - 
    2025-08-21T18:30:36.174266 - Requested to load WanVAE
    2025-08-21T18:30:39.822435 - 0 models unloaded.
    2025-08-21T18:30:40.253000 - loaded partially 128.0 127.9998779296875 0
    2025-08-21T18:30:42.047983 - Requested to load WAN21_Vace
    2025-08-21T18:30:42.147357 - 0 models unloaded.
    2025-08-21T18:30:42.281969 - loaded partially 128.0 114.7559814453125 808
    2025-08-21T18:30:42.292115 - Patching comfy attention to use sageattn2025-08-21T18:30:42.292115 - 
    2025-08-21T18:30:42.292115 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:30:42.292115 - 
    2025-08-21T18:30:42.304853 - Restoring initial comfy attention2025-08-21T18:30:42.304853 - 
    2025-08-21T18:30:42.304853 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:30:42.304853 - 
    2025-08-21T18:30:45.812898 - loaded partially 8066.096957772217 8061.1583251953125 0
    2025-08-21T18:30:45.822908 - Patching comfy attention to use sageattn2025-08-21T18:30:45.822908 - 
    2025-08-21T18:30:45.822908 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:30:45.822908 - 
    2025-08-21T18:30:45.831920 - (RES4LYF) rk_type: res_2s2025-08-21T18:30:45.831920 - 
    2025-08-21T18:30:45.839328 - 
      0%|                                                                                            | 0/3 [00:00<?, ?it/s]2025-08-21T18:30:46.005213 - SageAttention kernel is being used for this generation.2025-08-21T18:30:46.005213 - 
    2025-08-21T18:30:46.005213 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:30:46.005213 - 
    2025-08-21T18:32:43.073283 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [01:57<00:00, 38.87s/it]2025-08-21T18:33:02.392094 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [02:16<00:00, 45.52s/it]2025-08-21T18:33:02.392094 - 
    2025-08-21T18:33:02.428446 - Restoring initial comfy attention2025-08-21T18:33:02.428446 - 
    2025-08-21T18:33:02.428446 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:33:02.428446 - 
    2025-08-21T18:33:03.033241 - Requested to load WanVAE
    2025-08-21T18:33:03.495922 - 0 models unloaded.
    2025-08-21T18:33:03.515502 - loaded partially 128.0 127.9998779296875 0
    2025-08-21T18:33:10.888502 - Prompt executed in 284.80 seconds
    2025-08-21T18:33:37.986512 - got prompt
    2025-08-21T18:34:01.384694 - Requested to load WAN21_Vace
    2025-08-21T18:34:03.974350 - loaded partially 9594.49450845215 9594.488403320312 862
    2025-08-21T18:34:03.994412 - Patching comfy attention to use sageattn2025-08-21T18:34:03.994412 - 
    2025-08-21T18:34:03.994412 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:34:03.995411 - 
    2025-08-21T18:34:03.999446 - Restoring initial comfy attention2025-08-21T18:34:03.999446 - 
    2025-08-21T18:34:03.999446 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:34:03.999446 - 
    2025-08-21T18:34:04.787935 - loaded partially 12433.361287973632 12431.480590820312 0
    2025-08-21T18:34:04.799000 - Patching comfy attention to use sageattn2025-08-21T18:34:04.799000 - 
    2025-08-21T18:34:04.799000 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:34:04.799000 - 
    2025-08-21T18:34:04.800999 - (RES4LYF) rk_type: res_2s2025-08-21T18:34:04.800999 - 
    2025-08-21T18:34:04.803067 - 
      0%|                                                                                            | 0/6 [00:00<?, ?it/s]2025-08-21T18:34:04.884243 - SageAttention kernel is being used for this generation.2025-08-21T18:34:04.884243 - 
    2025-08-21T18:34:04.884243 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:34:04.884243 - 
    2025-08-21T18:35:09.670032 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 6/6 [01:04<00:00, 10.79s/it]2025-08-21T18:35:14.991061 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 6/6 [01:10<00:00, 11.70s/it]2025-08-21T18:35:14.991061 - 
    2025-08-21T18:35:14.994209 - Restoring initial comfy attention2025-08-21T18:35:14.994209 - 
    2025-08-21T18:35:14.995210 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:35:14.995210 - 
    2025-08-21T18:35:15.562283 - Requested to load WanVAE
    2025-08-21T18:35:15.920549 - 0 models unloaded.
    2025-08-21T18:35:15.944841 - loaded partially 128.0 127.9998779296875 0
    2025-08-21T18:35:17.676971 - model weight dtype torch.float8_e4m3fn, manual cast: torch.bfloat16
    2025-08-21T18:35:17.678977 - model_type FLOW
    2025-08-21T18:35:52.855495 - Requested to load WAN21_Vace
    2025-08-21T18:35:53.063216 - 0 models unloaded.
    2025-08-21T18:35:53.358109 - loaded partially 128.0 114.7559814453125 808
    2025-08-21T18:35:53.380494 - Patching comfy attention to use sageattn2025-08-21T18:35:53.381497 - 
    2025-08-21T18:35:53.383003 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:35:53.383003 - 
    2025-08-21T18:35:53.417621 - Restoring initial comfy attention2025-08-21T18:35:53.417621 - 
    2025-08-21T18:35:53.418622 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:35:53.418622 - 
    2025-08-21T18:36:05.543453 - loaded partially 8066.096957772217 8061.1583251953125 0
    2025-08-21T18:36:05.556479 - Patching comfy attention to use sageattn2025-08-21T18:36:05.557053 - 
    2025-08-21T18:36:05.557053 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:36:05.557053 - 
    2025-08-21T18:36:05.572567 - (RES4LYF) rk_type: res_2s2025-08-21T18:36:05.572567 - 
    2025-08-21T18:36:05.598374 - 
      0%|                                                                                            | 0/3 [00:00<?, ?it/s]2025-08-21T18:36:05.993823 - SageAttention kernel is being used for this generation.2025-08-21T18:36:05.993823 - 
    2025-08-21T18:36:05.993823 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:36:05.994341 - 
    2025-08-21T18:38:26.801588 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [02:21<00:00, 44.13s/it]2025-08-21T18:38:45.853125 - 
    100%|████████████████████████████████████████████████████████████████████████████████████| 3/3 [02:40<00:00, 53.42s/it]2025-08-21T18:38:45.853125 - 
    2025-08-21T18:38:45.946428 - Restoring initial comfy attention2025-08-21T18:38:45.946428 - 
    2025-08-21T18:38:45.946428 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:38:45.946428 - 
    2025-08-21T18:38:49.528464 - Requested to load WanVAE
    2025-08-21T18:38:59.376455 - 0 models unloaded.
    2025-08-21T18:38:59.498377 - loaded partially 128.0 127.9998779296875 0
    2025-08-21T18:39:08.317723 - 
    2025-08-21T18:39:08.906262 - 0: 640x640 1 face, 32.0ms
    2025-08-21T18:39:08.906262 - Speed: 10.3ms preprocess, 32.0ms inference, 398.6ms postprocess per image at shape (1, 3, 640, 640)
    2025-08-21T18:39:10.083595 - CLIP: [Japanese idol, perfectly beautiful face, big eyes,female child,]
    2025-08-21T18:39:28.891163 - Detailer: force inpaint
    2025-08-21T18:39:28.892749 - Detailer: segment upscale for ((np.float32(264.38037), np.float32(381.8825))) | crop region (793, 1145) x 1.0 -> (793, 1145)
    2025-08-21T18:39:28.988440 - Requested to load AutoencodingEngine
    2025-08-21T18:39:29.940127 - loaded completely 10331.23043346405 159.87335777282715 True
    2025-08-21T18:39:30.251248 - [Impact Pack] vae encoded in 1.3s
    2025-08-21T18:39:30.285778 - Requested to load Flux
    2025-08-21T18:39:49.855580 - loaded completely 12688.478488731384 11340.311584472656 True
    2025-08-21T18:39:49.865207 - Patching comfy attention to use sageattn2025-08-21T18:39:49.866211 - 
    2025-08-21T18:39:49.867209 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = True2025-08-21T18:39:49.867209 - 
    2025-08-21T18:39:49.871587 - 
      0%|                                                                                           | 0/12 [00:00<?, ?it/s]2025-08-21T18:39:49.922431 - SageAttention kernel is being used for this generation.2025-08-21T18:39:49.922431 - 
    2025-08-21T18:39:49.922431 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:39:49.922431 - 
    2025-08-21T18:39:57.734878 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 12/12 [00:07<00:00,  1.24it/s]2025-08-21T18:39:57.734878 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 12/12 [00:07<00:00,  1.53it/s]2025-08-21T18:39:57.734878 - 
    2025-08-21T18:39:57.734878 - Restoring initial comfy attention2025-08-21T18:39:57.735878 - 
    2025-08-21T18:39:57.735878 - Patching torch settings: torch.backends.cuda.matmul.allow_fp16_accumulation = False2025-08-21T18:39:57.735878 - 
    2025-08-21T18:39:58.051472 - Requested to load AutoencodingEngine
    2025-08-21T18:39:59.539061 - HTTP Request: GET http://127.0.0.1:11434/api/tags "HTTP/1.1 200 OK"
    2025-08-21T18:40:01.795620 - loaded completely 731.6279859542847 159.87335777282715 True
    2025-08-21T18:40:02.174557 - [Impact Pack] vae decoded in 4.1s
    2025-08-21T18:40:12.814739 - # of Detected SEGS: 1
    2025-08-21T18:40:12.982361 - # of Detected SEGS: 1
    2025-08-21T18:40:13.916445 - LOAD LORA: Body\DetailedEyes_V3.safetensors: 1.0, 1.0, LBW=None, A=None, B=None, LOADER=None
    2025-08-21T18:40:14.282224 - CLIP: [, detailed eyes,]
    2025-08-21T18:40:14.288734 - Requested to load SDXLClipModel
    2025-08-21T18:40:14.300240 - loaded completely 9.5367431640625e+25 1560.802734375 True
    2025-08-21T18:40:16.664975 - Detailer: segment upscale for ((69, 35)) | crop region (207, 105) x 4.947046612568409 -> (1024, 519)
    2025-08-21T18:40:16.675824 - Requested to load AutoencoderKL
    2025-08-21T18:40:17.494095 - loaded completely 11881.245326042175 159.55708122253418 True
    2025-08-21T18:40:17.671123 - [Impact Pack] vae encoded in 1.0s
    2025-08-21T18:40:17.678703 - Requested to load SDXL
    2025-08-21T18:40:39.693395 - loaded completely 12669.155332374572 4897.0483474731445 True
    2025-08-21T18:40:39.703487 - Patching comfy attention to use sageattn2025-08-21T18:40:39.703487 - 
    2025-08-21T18:40:39.710611 - 
      0%|                                                                                           | 0/20 [00:00<?, ?it/s]2025-08-21T18:40:40.020904 - SageAttention kernel is being used for this generation.2025-08-21T18:40:40.020904 - 
    2025-08-21T18:40:40.020904 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:40:40.020904 - 
    2025-08-21T18:40:41.115567 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 15.81it/s]2025-08-21T18:40:41.115567 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 14.24it/s]2025-08-21T18:40:41.115567 - 
    2025-08-21T18:40:41.116567 - Restoring initial comfy attention2025-08-21T18:40:41.116567 - 
    2025-08-21T18:40:41.338614 - [Impact Pack] vae decoded in 0.2s
    2025-08-21T18:40:41.378662 - LOAD LORA: Body\DetailedEyes_V3.safetensors: 1.0, 1.0, LBW=None, A=None, B=None, LOADER=None
    2025-08-21T18:40:41.512979 - CLIP: [, detailed eyes,]
    2025-08-21T18:40:41.513980 - Requested to load SDXLClipModel
    2025-08-21T18:40:41.528108 - loaded completely 9.5367431640625e+25 1560.802734375 True
    2025-08-21T18:40:41.942892 - Detailer: segment upscale for ((69, 34)) | crop region (207, 102) x 4.947139972447111 -> (1024, 504)
    2025-08-21T18:40:42.084009 - [Impact Pack] vae encoded in 0.1s
    2025-08-21T18:40:42.112118 - Requested to load SDXL
    2025-08-21T18:40:44.311785 - loaded completely 12657.151758003234 4897.0483474731445 True
    2025-08-21T18:40:44.322836 - Patching comfy attention to use sageattn2025-08-21T18:40:44.322836 - 
    2025-08-21T18:40:44.324944 - 
      0%|                                                                                           | 0/20 [00:00<?, ?it/s]2025-08-21T18:40:44.340762 - SageAttention kernel is being used for this generation.2025-08-21T18:40:44.341766 - 
    2025-08-21T18:40:44.341766 - [SageAttention][DEBUG] sageattn (auto) called2025-08-21T18:40:44.341766 - 
    2025-08-21T18:40:45.432084 - 
     95%|█████████████████████████████████████████████████████████████████████████████▉    | 19/20 [00:01<00:00, 17.70it/s]2025-08-21T18:40:45.572401 - 
    100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 16.04it/s]2025-08-21T18:40:45.572401 - 
    2025-08-21T18:40:45.572401 - Restoring initial comfy attention2025-08-21T18:40:45.572401 - 
    2025-08-21T18:40:45.786527 - [Impact Pack] vae decoded in 0.2s
    2025-08-21T18:40:45.911324 - !!! Exception during processing !!! expected scalar type Double but found Float
    2025-08-21T18:40:45.922595 - Traceback (most recent call last):
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 496, in execute
        output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 315, in get_output_data
        return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 289, in _async_map_node_over_list
        await process_inputs(input_dict, i)
      File "D:\USERFILES\ComfyUI\ComfyUI\execution.py", line 277, in process_inputs
        result = f(**inputs)
                 ^^^^^^^^^^^
      File "D:\USERFILES\ComfyUI\ComfyUI\comfy_extras\nodes_post_processing.py", line 242, in sharpen
        sharpened = F.conv2d(tensor_image, kernel, padding=center, groups=channels)[:,:,sharpen_radius:-sharpen_radius, sharpen_radius:-sharpen_radius]
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: expected scalar type Double but found Float
    
    2025-08-21T18:40:45.926596 - Prompt executed in 427.79 seconds
    
    ```
    ## Attached Workflow
    Please make sure that workflow does not contain any sensitive information such as API keys or passwords.
    ```
    Workflow too large. Please manually upload the workflow from local file system.
    ```
    
    ## Additional Context
    (Please add any additional context or steps to reproduce the error here)
    

    ノード名が、UltimateSD Upscale想定で作った為にちょっと変ですが、まあこれで直るっちゃー直ります。気になる方は自分でコード弄って修正してください。

    画像

    尚、この後方にUltimate SD Upscaleがある場合、この一か所に設置するだけで後方互換性は担保されるようです。

    …

    以下の様に、問題なく通る場合は通るので、条件分岐の理屈がわからないですね。理屈はCursor先生が上で語っていますが、何故に下の形は通るんだよってのは、これ見ただけじゃわかんねえな…って話でね。

    画像


    SD WebUI Forge再始動 How to install Stable Diffsion WebUI reForge with CuDNN 9.x

    暫定版を改め、正式にPytorch2.8.0+cu129+xformers0.0.32.post2前提の内容に改訂しました。

    How to install Pytorch 2.8.0+cu129 to A1111&ComfyUI (※Update as needed)

    同様に、以下も更新しました。


     
     

    GJL

     
     
    Road bike&Cycling Road Race, Respecting Mr.Greg LeMond, & Anti Doping, Football, Rock&Pops, History.

    あなたへのおすすめ