Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latent files saved under Input/Latent but require manual move to Input for loading #5556

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

idealvijay
Copy link

This pull request addresses an issue where latent files saved to Input/Latent are not correctly located during loading. Previously, users had to manually move files from Input/Latent to the main Input directory for them to load successfully.

Changes Made:

Updated the LoadLatent class in INPUT_TYPES to search for latent files directly in the Input/Latent directory.
This eliminates the need for manual file movement, streamlining the process of saving and loading latent files.

@idealvijay
Copy link
Author

Fixes #5555 - Latent files were not loading from the Input/Latent folder.

@ltdrdata
Copy link
Collaborator

ltdrdata commented Nov 9, 2024

You need to read from output dir not input dir to achieve that goal.

I recommend this approach.
The CheckpointLoaderSimple is also configured to use the model saved in the output with Save Checkpoint.

"ckpt_name": (folder_paths.get_filename_list("checkpoints"), {"tooltip": "The name of the checkpoint (model) to load."}),

ComfyUI/main.py

Line 228 in 6ee066a

folder_paths.add_model_folder_path("checkpoints", os.path.join(folder_paths.get_output_directory(), "checkpoints"))

@idealvijay idealvijay marked this pull request as draft November 9, 2024 15:57
@idealvijay idealvijay marked this pull request as ready for review November 10, 2024 03:50
@ltdrdata
Copy link
Collaborator

This code is useless now.

        input_dir = os.path.join(folder_paths.get_output_directory(), "latents")  # Adjusts to "Input/Latent"
        if not os.path.exists(input_dir):
            os.makedirs(input_dir, exist_ok=True)
        files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f)) and f.endswith(".latent")]

@idealvijay
Copy link
Author

Thanks for pointing that out, @ltdrdata! The code’s purpose was initially to handle directory creation for storing latents, but if it's now redundant due to recent updates, will remove this redundant code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants