From 7e5b6154d0dccb086d5c706e27d878829e6c9cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E9=BE=8D=E8=81=96=E8=80=85=40bdsqlsz?= Date: Tue, 16 May 2023 00:09:53 +0800 Subject: [PATCH 1/2] Update train_util.py --- library/train_util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/train_util.py b/library/train_util.py index 7c821c82..0bd87bc8 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -3308,15 +3308,15 @@ def sample_images( # prompts = f.readlines() if args.sample_prompts.endswith(".txt"): - with open(args.sample_prompts, "r") as f: + with open(args.sample_prompts, "r", encoding="utf-8") as f: lines = f.readlines() prompts = [line.strip() for line in lines if len(line.strip()) > 0 and line[0] != "#"] elif args.sample_prompts.endswith(".toml"): - with open(args.sample_prompts, "r") as f: + with open(args.sample_prompts, "r", encoding="utf-8") as f: data = toml.load(f) prompts = [dict(**data["prompt"], **subset) for subset in data["prompt"]["subset"]] elif args.sample_prompts.endswith(".json"): - with open(args.sample_prompts, "r") as f: + with open(args.sample_prompts, "r", encoding="utf-8") as f: prompts = json.load(f) # schedulerを用意する From 5b54086663c52c8696f9b114c14d4a70d49f31ed Mon Sep 17 00:00:00 2001 From: Kohya S Date: Tue, 16 May 2023 07:09:21 +0900 Subject: [PATCH 2/2] update readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 86ca9a4f..846d23fb 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,13 @@ The majority of scripts is licensed under ASL 2.0 (including codes from Diffuser ## Change History +### 16 May 2023, 2023/05/16 + +- Fixed an issue where an error would occur if the encoding of the prompt file was different from the default. [PR #510](https://github.com/kohya-ss/sd-scripts/pull/510) Thanks to sdbds! + - Please save the prompt file in UTF-8. +- プロンプトファイルのエンコーディングがデフォルトと異なる場合にエラーが発生する問題を修正しました。 [PR #510](https://github.com/kohya-ss/sd-scripts/pull/510) sdbds氏に感謝します。 + - プロンプトファイルはUTF-8で保存してください。 + ### 15 May 2023, 2023/05/15 - Added [English translation of documents](https://github.com/darkstorm2150/sd-scripts#links-to-usage-documentation) by darkstorm2150. Thank you very much!