diff --git a/src/diffusers/commands/fp16_safetensors.py b/src/diffusers/commands/fp16_safetensors.py index ec91bba357a0..c8f3d9ed0a0b 100644 --- a/src/diffusers/commands/fp16_safetensors.py +++ b/src/diffusers/commands/fp16_safetensors.py @@ -99,7 +99,7 @@ def run(self): from huggingface_hub._commit_api import CommitOperationAdd model_index = hf_hub_download(repo_id=self.ckpt_id, filename="model_index.json") - with open(model_index, "r") as f: + with open(model_index, "r", encoding="utf-8") as f: pipeline_class_name = json.load(f)["_class_name"] pipeline_class = getattr(import_module("diffusers"), pipeline_class_name) self.logger.info(f"Pipeline class imported: {pipeline_class_name}.") diff --git a/src/diffusers/loaders/single_file_utils.py b/src/diffusers/loaders/single_file_utils.py index ac707947d491..2526ffdd1dd0 100644 --- a/src/diffusers/loaders/single_file_utils.py +++ b/src/diffusers/loaders/single_file_utils.py @@ -500,7 +500,7 @@ def load_single_file_checkpoint( def fetch_original_config(original_config_file, local_files_only=False): if os.path.isfile(original_config_file): - with open(original_config_file, "r") as fp: + with open(original_config_file, "r", encoding="utf-8") as fp: original_config_file = fp.read() elif is_valid_url(original_config_file):