diffusers
a536e775 - Fix json WindowsPath crash (#8662)

Comment changes are shownComment changes are hidden
Commit
1 year ago
Fix json WindowsPath crash (#8662) * Add check for WindowsPath in to_json_string On Windows, os.path.join returns a WindowsPath. to_json_string does not convert this from a WindowsPath to a string. Added check for WindowsPath to to_json_saveable. * Remove extraneous convert to string in test_check_path_types (tests/others/test_config.py) * Fix style issues in tests/others/test_config.py * Add unit test to test_config.py to verify that PosixPath and WindowsPath (depending on system) both work when converted to JSON * Remove distinction between PosixPath and WindowsPath in ConfigMixIn.to_json_string(). Conditional now tests for Path, and uses Path.as_posix() to convert to string. --------- Co-authored-by: Vincent Dovydaitis <vincedovy@gmail.com> Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Author
Parents
  • src/diffusers
    • File
      configuration_utils.py
  • tests/others
    • File
      test_config.py