Skip to content

Commit

Permalink
receive any kinds of image extension in SanaImgDataset;
Browse files Browse the repository at this point in the history
Signed-off-by: lawrence-cj <[email protected]>
  • Loading branch information
lawrence-cj committed Dec 17, 2024
1 parent 6bfa5b8 commit dae74bf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.gradio/
.idea/
*.png
*.json
tmp*
output*
output/
Expand Down
Binary file added asset/example_data/00000000.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion asset/example_data/meta_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "sana-dev",
"__kind__": "Sana-ImgDataset",
"img_names": [
"00000000", "00000000"
"00000000", "00000000", "00000000.png", "00000000.jpg"
]
}
6 changes: 5 additions & 1 deletion diffusion/data/datasets/sana_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ def __init__(

def getdata(self, idx):
data = self.dataset[idx]
img_extensions = [".jpg", ".png", ".jpeg", ".webp"]
filename, ext = os.path.splitext(data)
if ext in img_extensions:
data = filename
self.img_extension = ext
self.key = data.split("/")[-1]
# info = json.load(open(f"{data}.json"))[self.key]
info = {}
with open(f"{data}.txt") as f:
info[self.default_prompt] = f.readlines()[0].strip()
Expand Down

0 comments on commit dae74bf

Please sign in to comment.