Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

[Bug] KSampler (Efficiency) unable to restore the global_preview_method value and fallback to No Preview. #254

Open
lenkunz opened this issue Jan 6, 2024 · 0 comments

Comments

@lenkunz
Copy link

lenkunz commented Jan 6, 2024

It seems like the function set_preview_method was unable to restore the value from preview method saved using function global_preview_method. on tsc_utils.py#L504

def set_preview_method(method):
    if method == 'auto' or method == 'LatentPreviewMethod.Auto':
        args.preview_method = latent_preview.LatentPreviewMethod.Auto
    elif method == 'latent2rgb' or method == 'LatentPreviewMethod.Latent2RGB':
        args.preview_method = latent_preview.LatentPreviewMethod.Latent2RGB
    elif method == 'taesd' or method == 'LatentPreviewMethod.TAESD':
        args.preview_method = latent_preview.LatentPreviewMethod.TAESD
    else:
        args.preview_method = latent_preview.LatentPreviewMethod.NoPreviews

This is because ComfyUI Manager will set the args.preview_method using latent_preview.LatentPreviewMethod class.
(refer to ComfyUI-Manager/init.py#L224)
I can confirm that compare the enum against string will not equal.

Slight change like this would suffice.

# efficiency-nodes-comfyui/tsc_utils.py#L504
def set_preview_method(method):
    if method == 'auto' or method == 'LatentPreviewMethod.Auto' or method == latent_preview.LatentPreviewMethod.Auto:
        args.preview_method = latent_preview.LatentPreviewMethod.Auto
    elif method == 'latent2rgb' or method == 'LatentPreviewMethod.Latent2RGB' or method == latent_preview.LatentPreviewMethod.Latent2RGB:
        args.preview_method = latent_preview.LatentPreviewMethod.Latent2RGB
    elif method == 'taesd' or method == 'LatentPreviewMethod.TAESD' or method == latent_preview.LatentPreviewMethod.TAESD:
        args.preview_method = latent_preview.LatentPreviewMethod.TAESD
    else:
        args.preview_method = latent_preview.LatentPreviewMethod.NoPreviews

Edit: Remove the ComfyUI Manager from title. I just realized that this node will set the args.preview_method to latent_preview.LatentPreviewMethod enum either. And after scan other libs, it seems like using this class is a norm.

@lenkunz lenkunz changed the title [Bug] KSampler (Efficiency) unable to restore the global_preview_method value and fallback to No Preview (w/ ComfyUI Manager). [Bug] KSampler (Efficiency) unable to restore the global_preview_method value and fallback to No Preview. Jan 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant