cocktailpeanut / fluxgym

Dead simple FLUX LoRA training UI with LOW VRAM support
MIT License
1.37k stars 113 forks source link

Failure at "generating sample images at step" #217

Open cjjp opened 1 month ago

cjjp commented 1 month ago
  File "Q:\repos\fluxgym\sd-scripts\flux_train_network.py", line 564, in <module>
    trainer.train(args)
  File "Q:\repos\fluxgym\sd-scripts\train_network.py", line 1070, in train
    self.sample_images(accelerator, args, 0, global_step, accelerator.device, vae, tokenizers, text_encoder, unet)
  File "Q:\repos\fluxgym\sd-scripts\flux_train_network.py", line 288, in sample_images
    flux_train_utils.sample_images(
  File "Q:\repos\fluxgym\sd-scripts\library\flux_train_utils.py", line 61, in sample_images
    if not os.path.isfile(args.sample_prompts) and sample_prompts_te_outputs is None:
  File "G:\Users\ABC\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Train.bat:

accelerate launch ^
  --mixed_precision bf16 ^
  --num_cpu_threads_per_process 1 ^
  sd-scripts/flux_train_network.py ^
  --pretrained_model_name_or_path ".\models\unet\flux1-dev.safetensors" ^
  --clip_l ".\models\clip\clip_l.safetensors" ^
  --t5xxl ".\models\clip\t5xxl_fp16.safetensors" ^
  --ae ".\models\vae\ae.sft" ^
  --cache_latents_to_disk ^
  --save_model_as safetensors ^
  --sdpa --persistent_data_loader_workers ^
  --max_data_loader_n_workers 2 ^
  --seed 42 ^
  --gradient_checkpointing ^
  --mixed_precision bf16 ^
  --save_precision bf16 ^
  --network_module networks.lora_flux ^
  --network_dim 4 ^
  --optimizer_type adamw8bit ^
  --learning_rate 8e-4 ^
  --cache_text_encoder_outputs ^
  --cache_text_encoder_outputs_to_disk ^
  --fp8_base ^
  --highvram ^
  --max_train_epochs 16 ^
  --save_every_n_epochs 2 ^
  --dataset_config ".\outputs\doronoi\dataset.toml" ^
  --output_dir ".\outputs\doronoi" ^
  --output_name doronoi ^
  --timestep_sampling shift ^
  --discrete_flow_shift 3.1582 ^
  --model_prediction_type raw ^
  --guidance_scale 1 ^
  --loss_type l2 ^
  --sample_at_first ^
  --sample_every_n_epochs 2

RTX4090, 64GB Ram, Windows. I trained another model last night with similar settings and it worked fine.

Any thoughts/pointers/fixes?

VPokryshkina commented 3 weeks ago

Same issue

dk994023477 commented 3 days ago

app.py注释掉406-409修改为以下代码 ` ############# Sample args ######################## sample = f"""--sample_prompts={sample_prompts_path} --sample_every_n_steps="{sample_every_n_steps}" {line_break}"""

if len(sample_prompts) > 0 and sample_every_n_steps > 0:

#    sample = f"""--sample_prompts={sample_prompts_path} --sample_every_n_steps="{sample_every_n_steps}" {line_break}"""`

原因应该是你没有设置sample_every_n_steps(Sample Image Every N Steps选项)导致sample_prompts文件没有导入,可以参考生成的.sh文件