Skip to content

TypeError: Object of type PosixPath is not JSON serializable #58

@roperi

Description

@roperi

Failed while trying to save checkpoint:

Steps:  33%|███▎      | 150/450 [36:17<1:09:03, 13.81s/it, lr=1.5e-6, step_loss=0.131]Configuration saved in simpletuner-results/checkpoint-150/unet_ema/config.json
Model weights saved in simpletuner-results/checkpoint-150/unet_ema/diffusion_pytorch_model.bin                                                                                                                                   
Configuration saved in simpletuner-results/checkpoint-150/unet/config.json
Model weights saved in simpletuner-results/checkpoint-150/unet/diffusion_pytorch_model.bin
Traceback (most recent call last):                                                                              
  File "/workspace/SimpleTuner/train_sdxl.py", line 1293, in <module> main() File "/workspace/SimpleTuner/train_sdxl.py", line 1047, in main custom_balanced_sampler.save_state(File "/workspace/SimpleTuner/helpers/multiaspect/sampler.py", line 67, in save_state self.state_manager.save_state(state, state_path)                                                            
  File "/workspace/SimpleTuner/helpers/multiaspect/state.py", line 24, in save_state
    json.dump(state, f)
  File "/opt/conda/lib/python3.10/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/opt/conda/lib/python3.10/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/opt/conda/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/opt/conda/lib/python3.10/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/opt/conda/lib/python3.10/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/opt/conda/lib/python3.10/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/opt/conda/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type PosixPath is not JSON serializable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions