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

configuration_utils.to_json_string() fails on WindowsPath #8651

Closed
vincedovy opened this issue Jun 20, 2024 · 2 comments · Fixed by #8662
Closed

configuration_utils.to_json_string() fails on WindowsPath #8651

vincedovy opened this issue Jun 20, 2024 · 2 comments · Fixed by #8662
Labels
bug Something isn't working

Comments

@vincedovy
Copy link
Contributor

Describe the bug

Running the diffusion-models-class/unit2/finetune_model.py line 117 (save_pretrained) and 01_finetuning_and_guidance.ipynb crashes trying to convert a WindowsPath to JSON. This worked prior to an conda update (not sure which module update caused the problem.) I have diffusers 0.29.0 installed. Issue was in configuration_utils.py line 590, where it checks whether the value is a PosixPath. My temporary fix was to insert the following lines:
elif isinstance(value, WindowsPath):
value = str(value.as_posix())

Reproduction

https://github.com/huggingface/diffusion-models-class/unit2/finetune_model.py

python finetune_model.py --image_size 128 --batch_size 8 --num_epochs 16
--grad_accumulation_steps 2 --start_model "google/ddpm-celebahq-256"
--dataset_name "Norod78/Vintage-Faces-FFHQAligned" --wandb_project 'dm-finetune'
--log_samples_every 100 --save_model_every 1000 --model_save_name 'vintageface'

Logs

No response

System Info

Windows 11 with NVIDIA GeForce RTX 4080 laptop GPU.
Python 3.11.8
pytorch 2.3.0
pytorch-cuda 12.1
diffusers 0.29.0
transformers 4.41.2

Who can help?

@DN6 @yiyixuxu @sayakpaul

@vincedovy vincedovy added the bug Something isn't working label Jun 20, 2024
@sayakpaul
Copy link
Member

Thanks for reporting this issue. Since you already know a workaround would you mind opening a PR?

@vincedovy
Copy link
Contributor Author

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants