cocktailpeanut / fluxgym

Dead simple FLUX LoRA training UI with LOW VRAM support
1.19k stars 97 forks source link

TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType' #16

Open freecoderwaifu opened 1 month ago

freecoderwaifu commented 1 month ago

No idea what could be causing it, happens both in pinokio and standalone install, maybe one of the images is bad? Maybe one of the paths? Those images have worked fine with both SD 1.5 and SDXL training.

Kohya GUI works fine too.

Standalone Python is 3.10.11, but pinokio should also install its own shouldn't it? Win 11 24h2 RTX 3080 12GB 64GB RAM

Creating dataset
resize datasets/bbf7e5c0-f455-4f5e-9ea2-9b9ef3c8950c\00040.png : 1024x1321
image_path=datasets/bbf7e5c0-f455-4f5e-9ea2-9b9ef3c8950c\00040.png, caption_path = datasets/bbf7e5c0-f455-4f5e-9ea2-9b9ef3c8950c\00040.txt, original_caption=
resize datasets/bbf7e5c0-f455-4f5e-9ea2-9b9ef3c8950c\00041.png : 1024x2406
Traceback (most recent call last):
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\route_utils.py", line 321, in call_process_api
    output = await app.get_blocks().process_api(
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\blocks.py", line 1935, in process_api
    result = await self.call_function(
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\blocks.py", line 1520, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "E:\variousAI\fluxgym\env\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "E:\variousAI\fluxgym\env\lib\site-packages\anyio\_backends\_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "E:\variousAI\fluxgym\env\lib\site-packages\anyio\_backends\_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\utils.py", line 826, in wrapper
    response = f(*args, **kwargs)
  File "E:\variousAI\fluxgym\app.py", line 94, in create_dataset
    resize_image(new_image_path, new_image_path, size)
  File "E:\variousAI\fluxgym\app.py", line 80, in resize_image
    img_resized.save(output_path)
  File "E:\variousAI\fluxgym\env\lib\site-packages\PIL\Image.py", line 2568, in save
    save_handler(self, fp, filename)
  File "E:\variousAI\fluxgym\env\lib\site-packages\PIL\PngImagePlugin.py", line 1340, in _save
    data = name + b"\0\0" + zlib.compress(icc)
TypeError: a bytes-like object is required, not 'str'
gen_sh: network_dim:16, max_train_epochs=8, save_every_n_epochs=4, timestep_sampling=shift, guidance_scale=1, vram=12G,
Traceback (most recent call last):
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\route_utils.py", line 321, in call_process_api
    output = await app.get_blocks().process_api(
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\blocks.py", line 1935, in process_api
    result = await self.call_function(
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\blocks.py", line 1532, in call_function
    prediction = await utils.async_iteration(iterator)
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\utils.py", line 671, in async_iteration
    return await iterator.__anext__()
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\utils.py", line 664, in __anext__
    return await anyio.to_thread.run_sync(
  File "E:\variousAI\fluxgym\env\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "E:\variousAI\fluxgym\env\lib\site-packages\anyio\_backends\_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "E:\variousAI\fluxgym\env\lib\site-packages\anyio\_backends\_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\utils.py", line 647, in run_sync_iterator_async
    return next(iterator)
  File "E:\variousAI\fluxgym\env\lib\site-packages\gradio\utils.py", line 809, in gen_wrapper
    response = next(iterator)
  File "E:\variousAI\fluxgym\app.py", line 341, in start_training
    gen_toml(dataset_folder, resolution, class_tokens, num_repeats)
  File "E:\variousAI\fluxgym\app.py", line 284, in gen_toml
    image_dir = '{resolve_path_without_quotes(dataset_folder)}'
  File "E:\variousAI\fluxgym\app.py", line 173, in resolve_path_without_quotes
    norm_path = os.path.normpath(os.path.join(current_dir, p))
  File "F:\APPSOLO\Python\lib\ntpath.py", line 143, in join
    genericpath._check_arg_types('join', path, *paths)
  File "F:\APPSOLO\Python\lib\genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
freecoderwaifu commented 1 month ago

Looking at the datasets folder inside Fluxgym, some images seem to not open, but the original dataset opens fine in every other image program, and I never had any issues with it.

Maybe PngImagePlugin.py is very picky about PNG formats?

File "E:\variousAI\fluxgym\env\lib\site-packages\PIL\PngImagePlugin.py", line 1340, in _save data = name + b"\0\0" + zlib.compress(icc)

Tried with a different dataset and that started the training fine, so it's definitely something related with those specific images.