cocktailpeanut / fluxgym

Dead simple FLUX LoRA training UI with LOW VRAM support
1.26k stars 104 forks source link

Error Code 1 #105

Open XT-404 opened 1 month ago

XT-404 commented 1 month ago

Error CODE 1 :

[2024-09-18 00:12:07] [INFO] 2024-09-18 00:12:07 WARNING  cache_latents_to_disk is        train_util.py:3936
[2024-09-18 00:12:07] [INFO] enabled, so cache_latents is
[2024-09-18 00:12:07] [INFO] also enabled /
[2024-09-18 00:12:07] [INFO] cache_latents_to_diskが有効なた
[2024-09-18 00:12:07] [INFO] め、cache_latentsを有効にします
[2024-09-18 00:12:07] [INFO] 2024-09-18 00:12:07 INFO     t5xxl_max_token_length:  flux_train_network.py:155
[2024-09-18 00:12:07] [INFO] 512
[2024-09-18 00:12:07] [INFO] H:\fluxgym\env\lib\site-packages\transformers\tokenization_utils_base.py:1601: FutureWarning: clean_up_tokenization_spaces was not set. It will be set to True by default. This behavior will be depracted in transformers v4.45, and will be then set to False by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884
[2024-09-18 00:12:07] [INFO] warnings.warn(
[2024-09-18 00:12:08] [INFO] You are using the default legacy behaviour of the <class 'transformers.models.t5.tokenization_t5.T5Tokenizer'>. This is expected, and simply means that the legacy (previous) behavior will be used so nothing changes for you. If you want to use the new behaviour, set legacy=False. This should only be set if you understand what it means, and thoroughly read the reason why this was added as explained in https://github.com/huggingface/transformers/pull/24565
[2024-09-18 00:12:08] [INFO] 2024-09-18 00:12:08 INFO     Loading dataset config from   train_network.py:280
[2024-09-18 00:12:08] [INFO] H:\fluxgym\outputs\curvylover
[2024-09-18 00:12:08] [INFO] \dataset.toml
[2024-09-18 00:12:08] [INFO] INFO     prepare images.                 train_util.py:1807
[2024-09-18 00:12:08] [INFO] INFO     get image size from name of     train_util.py:1745
[2024-09-18 00:12:08] [INFO] cache files
[2024-09-18 00:12:08] [INFO] 0%|          | 0/80 [00:00<?, ?it/s]
100%|██████████| 80/80 [00:00<00:00, 5123.05it/s]
[2024-09-18 00:12:08] [INFO] INFO     set image size from cache       train_util.py:1752
[2024-09-18 00:12:08] [INFO] files: 0/80
[2024-09-18 00:12:08] [INFO] INFO     found directory                 train_util.py:1754
[2024-09-18 00:12:08] [INFO] H:\fluxgym\datasets\curvylover
[2024-09-18 00:12:08] [INFO] contains 80 image files
[2024-09-18 00:12:08] [INFO] ERROR    illegal char in file (not       train_util.py:1702
[2024-09-18 00:12:08] [INFO] UTF-8) /
[2024-09-18 00:12:08] [INFO] ファイルにUTF-8以外の文字があり
[2024-09-18 00:12:08] [INFO] ます:
[2024-09-18 00:12:08] [INFO] H:\fluxgym\datasets\curvylover\
[2024-09-18 00:12:08] [INFO] CurvyLover_30.txt
[2024-09-18 00:12:08] [INFO] Traceback (most recent call last):
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\flux_train_network.py", line 519, in <module>
[2024-09-18 00:12:08] [INFO] trainer.train(args)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\train_network.py", line 317, in train
[2024-09-18 00:12:08] [INFO] train_dataset_group = config_util.generate_dataset_group_by_blueprint(blueprint.dataset_group)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\library\config_util.py", line 485, in generate_dataset_group_by_blueprint
[2024-09-18 00:12:08] [INFO] dataset = dataset_klass(subsets=subsets, **asdict(dataset_blueprint.params))
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\library\train_util.py", line 1824, in __init__
[2024-09-18 00:12:08] [INFO] img_paths, captions, sizes = load_dreambooth_dir(subset)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\library\train_util.py", line 1764, in load_dreambooth_dir
[2024-09-18 00:12:08] [INFO] cap_for_img = read_caption(img_path, subset.caption_extension, subset.enable_wildcard)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\library\train_util.py", line 1703, in read_caption
[2024-09-18 00:12:08] [INFO] raise e
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\sd-scripts\library\train_util.py", line 1700, in read_caption
[2024-09-18 00:12:08] [INFO] lines = f.readlines()
[2024-09-18 00:12:08] [INFO] File "C:\Users\XT404\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
[2024-09-18 00:12:08] [INFO] (result, consumed) = self._buffer_decode(data, self.errors, final)
[2024-09-18 00:12:08] [INFO] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 186: invalid start byte
[2024-09-18 00:12:08] [INFO] Traceback (most recent call last):
[2024-09-18 00:12:08] [INFO] File "C:\Users\XT404\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
[2024-09-18 00:12:08] [INFO] return _run_code(code, main_globals, None,
[2024-09-18 00:12:08] [INFO] File "C:\Users\XT404\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
[2024-09-18 00:12:08] [INFO] exec(code, run_globals)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\env\Scripts\accelerate.exe\__main__.py", line 7, in <module>
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\env\lib\site-packages\accelerate\commands\accelerate_cli.py", line 48, in main
[2024-09-18 00:12:08] [INFO] args.func(args)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\env\lib\site-packages\accelerate\commands\launch.py", line 1106, in launch_command
[2024-09-18 00:12:08] [INFO] simple_launcher(args)
[2024-09-18 00:12:08] [INFO] File "H:\fluxgym\env\lib\site-packages\accelerate\commands\launch.py", line 704, in simple_launcher
[2024-09-18 00:12:08] [INFO] raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
[2024-09-18 00:12:08] [INFO] subprocess.CalledProcessError: Command '['H:\\fluxgym\\env\\Scripts\\python.exe', 'sd-scripts/flux_train_network.py', '--pretrained_model_name_or_path', 'H:\\fluxgym\\models\\unet\\flux1-dev.sft', '--clip_l', 'H:\\fluxgym\\models\\clip\\clip_l.safetensors', '--t5xxl', 'H:\\fluxgym\\models\\clip\\t5xxl_fp16.safetensors', '--ae', 'H:\\fluxgym\\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', '--sample_prompts=H:\\fluxgym\\outputs\\curvylover\\sample_prompts.txt', '--sample_every_n_steps=150', '--learning_rate', '8e-4', '--cache_text_encoder_outputs', '--cache_text_encoder_outputs_to_disk', '--fp8_base', '--highvram', '--max_train_epochs', '10', '--save_every_n_epochs', '1', '--dataset_config', 'H:\\fluxgym\\outputs\\curvylover\\dataset.toml', '--output_dir', 'H:\\fluxgym\\outputs\\curvylover', '--output_name', 'curvylover', '--timestep_sampling', 'shift', '--discrete_flow_shift', '3.1582', '--model_prediction_type', 'raw', '--guidance_scale', '1', '--loss_type', 'l2']' returned non-zero exit status 1.
[2024-09-18 00:12:09] [ERROR] Command exited with code 1
[2024-09-18 00:12:09] [INFO] Runner: <LogsViewRunner nb_logs=64 exit_code=1>

The main error here is related to a file encoding issue. Specifically, you have a UnicodeDecodeError, which indicates that the file CurvyLover_30.txt contains characters that are not encoded in UTF-8, causing a failure when reading the file.

Here are the details and possible solutions:

Text file encoding issue: The following error appears in the log:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 186: invalid start byte This means that a character at position 186 of the file CurvyLover_30.txt is not encoded in UTF-8. The problematic character seems to be the byte 0xa0, which could be a non-breaking space or another special character that is not compatible with the expected encoding.

Open the file CurvyLover_30.txt in a text editor that supports different encodings (such as VSCode or Notepad++). Ensure that the file is encoded in UTF-8. If it is not, convert the file to UTF-8 (without BOM). If the editor highlights special or invisible characters, remove them or replace them with compatible characters. Using a different encoding in the script: If you want to avoid this issue without manually modifying the files, you can specify a different encoding in your Python code when reading the file, such as ISO-8859-1 or latin1, which accepts a wider range of characters:

with open('path/to/CurvyLover_30.txt', 'r', encoding='ISO-8859-1') as f:
    lines = f.readlines()

Dataset file verification: The log also indicates the processing of files from the dataset in the directory H:\fluxgym\datasets\curvylover, which contains 80 image and text files. It is recommended to check if other files in this folder may also have similar issues.

By correcting the text file’s encoding or adapting the encoding used in the Python code, this should resolve the UnicodeDecodeError.

wuliang19869312 commented 1 month ago

One mistake at a time. This one's just one day at a time.

MLGODFATHER commented 1 month ago

Found a Solution!

For anyone still having this issue, if you have tried training a lora with your dataset and had this issue "cannot write mode RGBA as JPEG" and you then addresed the file types by updating/changing them you should've encountered the issue above after trying to train again. To fix it simply go to your datasets folder and delete the folder that's there of the lora you're trying to create and then simply try training again and you shouldn't receive any errors. This worked for me and had to make sure to share.

Datasets Folder Directory Location Pinokio> Api> fluxgym.git> datasets> x-lora folder.

droide commented 1 month ago

Found a Solution!

For anyone still having this issue, if you have tried training a lora with your dataset and had this issue "cannot write mode RGBA as JPEG" and you then addresed the file types by updating/changing them you should've encountered the issue above after trying to train again. To fix it simply go to your datasets folder and delete the folder that's there of the lora you're trying to create and then simply try training again and you shouldn't receive any errors. This worked for me and had to make sure to share.

Datasets Folder Directory Location Pinokio> Api> fluxgym.git> datasets> x-lora folder.

Thanks work for me!