Conversation
`fetch_original_config` reads the user-supplied original config file and the fp16_safetensors command reads `model_index.json` without specifying an encoding, so both fall back to the locale encoding. On Windows with a non-UTF-8 locale (e.g. cp936) any non-ASCII content (CJK comments, emoji) crashes with a UnicodeDecodeError. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two user-facing config reads fall back to the locale encoding:
fetch_original_configreading the user-supplied original config file (src/diffusers/loaders/single_file_utils.py) — the entry point used byfrom_single_filewhen a local YAML config is passedfp16_safetensorsconversion command readingmodel_index.json(src/diffusers/commands/fp16_safetensors.py)Why
On Windows with a non-UTF-8 locale (e.g. cp936/GBK), any non-ASCII content in these files crashes with
UnicodeDecodeError. Original config files are user-authored YAML where non-ASCII comments or values are realistic.Reproduction (Windows, cp936 locale)
Verified red before the fix; after the fix the file is read and parsed correctly (non-ASCII values preserved).
🤖 Generated with Claude Code