Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sdxl #1911

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion recommendation/dlrm_v2/pytorch/run_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

source ./run_common.sh

common_opt="--mlperf_conf ../../../mlperf.conf"
#mlperf.conf is now automatically loaded by loadgen
#common_opt="--mlperf_conf ../../../mlperf.conf"

OUTPUT_DIR=`pwd`/output/$name
if [ ! -d $OUTPUT_DIR ]; then
mkdir -p $OUTPUT_DIR
Expand Down
24 changes: 14 additions & 10 deletions text_to_image/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,24 @@ def __call__(self, results, ids, expected=None, result_dict=None):
def save_images(self, ids, ds):
info = []
idx = {}
for i, id in enumerate(self.content_ids):
if id in ids:
idx[id] = i
for i, image_id in enumerate(self.content_ids):
if image_id in ids:
idx[image_id] = i
if not os.path.exists("images/"):
os.makedirs("images/", exist_ok=True)
for id in ids:
caption = ds.get_caption(id)
generated = Image.fromarray(self.results[idx[id]])
image_path_tmp = f"images/{self.content_ids[idx[id]]}.png"
for image_id in ids:
if not idx.get(image_id):
print(
f"image id {image_id} is missing in the results. Hence not saved.")
continue
caption = ds.get_caption(image_id)
generated = Image.fromarray(self.results[idx[image_id]])
image_path_tmp = f"images/{self.content_ids[idx[image_id]]}.png"
generated.save(image_path_tmp)
info.append((self.content_ids[idx[id]], caption))
info.append((self.content_ids[idx[image_id]], caption))
with open("images/captions.txt", "w+") as f:
for id, caption in info:
f.write(f"{id} {caption}\n")
for image_id, caption in info:
f.write(f"{image_id} {caption}\n")

def start(self):
self.results = []
Expand Down
2 changes: 1 addition & 1 deletion text_to_image/tools/fid/fid_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import pathlib
import os
import sys
sys.path.insert("..", 0)
sys.path.insert(0, "..")
from inception import InceptionV3 # noqa: E402


Expand Down
Loading