Skip to content

Commit

Permalink
Update train_util.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbds authored May 15, 2023
1 parent 45f9cc9 commit 7e5b615
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/train_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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を用意する
Expand Down

0 comments on commit 7e5b615

Please sign in to comment.