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

Skipping sample image generation if args.sample_prompts file is missing #1823

Open
blackmagic24 opened this issue Dec 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@blackmagic24
Copy link

blackmagic24 commented Dec 5, 2024

It would be great to have the ability to skip the generation of sample images during the training process in flux_train_network.py when the file specified by args.sample_prompts does not exist.
This feature would allow users to have more interactive control over when sample images are generated.

Current Behavior (flux_train_network.py):
At the moment, fine-tuning fails if the args.sample_prompts file is renamed, removed, or modified during training.

  File "/github/sd-scripts/flux_train_network.py", line 285, in sample_images
    flux_train_utils.sample_images(
  File "/github/sd-scripts/library/flux_train_utils.py", line 75, in sample_images
    prompts = train_util.load_prompts(args.sample_prompts)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/github/sd-scripts/library/train_util.py", line 6071, in load_prompts
    with open(prompt_file, "r", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'prompt.txt'

Perhaps like in the 'sample_images_common' function (train_util.py)?

logger.info(f"generating sample images at step / サンプル画像生成 ステップ: {steps}")
    if not os.path.isfile(args.sample_prompts):
        logger.error(f"No prompt file / プロンプトファイルがありません: {args.sample_prompts}")
        return

@kohya-ss
Copy link
Owner

kohya-ss commented Dec 9, 2024

This makes sense. I will update sooner.

@kohya-ss kohya-ss added the enhancement New feature or request label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants