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

Fixes to SDXL accuracy output, submission preprocessor, fixes #1938 #1948

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d8f0d7e
Update generate_final_report.py
arjunsuresh Oct 31, 2024
390a8cb
Merge branch 'master' into dev
arjunsuresh Nov 7, 2024
6b1a0f8
Fix sdxl (#1911)
arjunsuresh Nov 7, 2024
a4ba51f
Fixes for filtering invalid results
arjunsuresh Nov 7, 2024
7097ef5
Merge branch 'master' into dev
arjunsuresh Nov 7, 2024
190ee41
Merge 7097ef540bfa0286c65c81fbfdcb300e6d54f770 into d3c01ed3de6618a8d…
arjunsuresh Nov 7, 2024
451b310
[Automated Commit] Format Codebase
arjunsuresh Nov 7, 2024
4c109ea
Update preprocess_submission.py
arjunsuresh Nov 7, 2024
40c1fe0
Added an option to pass in sample_ids.txt for SDXL accuracy check
arjunsuresh Nov 7, 2024
2a61df9
Merge 40c1fe0c28364b243b5944b3569000611ddf2b7d into d3c01ed3de6618a8d…
arjunsuresh Nov 7, 2024
89a2ffe
[Automated Commit] Format Codebase
arjunsuresh Nov 7, 2024
69ffdc0
Update accuracy_coco.py
arjunsuresh Nov 7, 2024
76b703b
Merge 69ffdc0aa783f9127af612a7de57c6329703c1dc into d3c01ed3de6618a8d…
arjunsuresh Nov 7, 2024
d1d642e
[Automated Commit] Format Codebase
arjunsuresh Nov 7, 2024
8d3b8ab
Fix typo
arjunsuresh Nov 7, 2024
b09b1ef
Not use default for sample_ids.txt
arjunsuresh Nov 8, 2024
857494f
Merge branch 'master' into dev
arjunsuresh Nov 12, 2024
df5049d
Update requirements.txt (#1907)
arjunsuresh Nov 14, 2024
a7e8c8a
Fix preprocess_sudbmission for a bug
arjunsuresh Nov 15, 2024
213c239
Fix conflict
arjunsuresh Nov 15, 2024
8915a90
Update submission_checker.py | Removed TEST05
arjunsuresh Nov 16, 2024
36d5b74
Merge branch 'master' into dev
arjunsuresh Nov 16, 2024
da9e6bb
Fix to SDXL accuracy output
arjunsuresh Nov 21, 2024
db7fb38
Merge branch 'master' into dev
arjunsuresh Nov 21, 2024
13cd2e0
Added exists checks for rmtree in preprocess_submission script
arjunsuresh Nov 21, 2024
0abd369
Merge 13cd2e0abc98a36601e125f60dc96bc13738dc62 into 35c7e1f0dbbd1a63b…
arjunsuresh Nov 21, 2024
db5e737
[Automated Commit] Format Codebase
arjunsuresh Nov 21, 2024
dbecd2b
Delete .github/workflows/format.yml
arjunsuresh Nov 21, 2024
011a0d1
Delete .github/scripts directory
arjunsuresh Nov 21, 2024
d04ae63
Update build_wheels.yml | Added src distribution
arjunsuresh Nov 22, 2024
1923b01
Update VERSION.txt
arjunsuresh Nov 22, 2024
dc1acd3
Update build_wheels.yml
arjunsuresh Nov 22, 2024
dac78f5
Update VERSION.txt
arjunsuresh Nov 22, 2024
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
26 changes: 0 additions & 26 deletions .github/scripts/format-cpp.sh

This file was deleted.

26 changes: 0 additions & 26 deletions .github/scripts/format-py.sh

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ jobs:
- uses: actions/setup-python@v3

- name: Install requirements
run: python -m pip install cibuildwheel twine
run: python -m pip install cibuildwheel twine build

- name: Build src dist
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python -m build --sdist --outdir wheels loadgen

- name: Build wheels
run: git pull && python -m cibuildwheel loadgen/ --output-dir wheels
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/format.yml

This file was deleted.

2 changes: 1 addition & 1 deletion loadgen/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.23
4.1.25
4 changes: 2 additions & 2 deletions text_to_image/tools/accuracy_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def compute_accuracy(
generated_img).item())
fid_score = compute_fid(result_list, statistics_path, device)

result_dict["FID_SCORE"] = fid_score
result_dict["CLIP_SCORE"] = np.mean(clip_scores)
result_dict["FID_SCORE"] = f"{fid_score}"
result_dict["CLIP_SCORE"] = f"{np.mean(clip_scores)}"
print(f"Accuracy Results: {result_dict}")

with open(output_file, "w") as fp:
Expand Down
4 changes: 4 additions & 0 deletions text_to_image/tools/fid/fid_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ def compute_fid(
imgs, model, batch_size, dims, device, num_workers
)

# Ensure dimensions match before calculating FID
assert s1.shape == s2.shape, f"Covariance shapes mismatch: {s1.shape} vs {s2.shape}"
assert m1.shape == m2.shape, f"Mean shapes mismatch: {m1.shape} vs {m2.shape}"

fid_value = calculate_frechet_distance(m1, s1, m2, s2)

return fid_value
54 changes: 36 additions & 18 deletions tools/submission/preprocess_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,25 @@ def clean_model_dir(model_results_dir):
model_results_dir, "results", "compliance")

print(f"rmtree {model_results_dir}")
shutil.rmtree(model_results_dir)
shutil.rmtree(model_measurements_dir)
shutil.rmtree(model_compliance_dir)
if os.path.exists(model_results_dir):
shutil.rmtree(model_results_dir)
if os.path.exists(model_measurements_dir):
shutil.rmtree(model_measurements_dir)
if os.path.exists(model_compliance_dir):
shutil.rmtree(model_compliance_dir)

sut_results_dir = os.path.dirname(model_results_dir)
if not os.listdir(sut_results_dir):
if os.path.exists(sut_results_dir) and not os.listdir(sut_results_dir):
# clean sut dir
sut = os.path.basename(sut_results_dir)
log.info(
f"No benchmark results remaining for {sut}. rmtree {sut_results_dir}")
shutil.rmtree(sut_results_dir)
shutil.rmtree(os.path.dirname(model_measurements_dir))
shutil.rmtree(os.path.dirname(model_compliance_dir))
if os.path.exists(sut_results_dir):
shutil.rmtree(sut_results_dir)
if os.path.exists(os.path.dirname(model_measurements_dir)):
shutil.rmtree(os.path.dirname(model_measurements_dir))
if os.path.exists(os.path.dirname(model_compliance_dir)):
shutil.rmtree(os.path.dirname(model_compliance_dir))


def clean_invalid_results(args, log_path, config, system_desc, system_json,
Expand Down Expand Up @@ -200,7 +207,7 @@ def clean_invalid_results(args, log_path, config, system_desc, system_json,
ranging_path = os.path.join(
scenario_path, "performance", "ranging")
try:
ranging_r = get_performance_metric(
ranging_r = checker.get_performance_metric(
config,
mlperf_model,
ranging_path,
Expand All @@ -224,9 +231,13 @@ def clean_invalid_results(args, log_path, config, system_desc, system_json,
if not power_is_valid:
log.warning(
f"Power result is invalid for {system_desc}: {model} {scenario} scenario in {division} division. Removing...")
shutil.rmtree(power_path)
shutil.rmtree(ranging_path)
shutil.rmtree(os.path.join(perf_path, "spl.txt"))
if os.path.exists(power_path):
shutil.rmtree(power_path)
if os.path.exists(ranging_path):
shutil.rmtree(ranging_path)
spl_path = os.path.join(perf_path, "spl.txt")
if os.path.exists(spl_path):
os.remove(spl_path)

compliance_is_valid = True
if is_closed_or_network:
Expand All @@ -253,9 +264,12 @@ def clean_invalid_results(args, log_path, config, system_desc, system_json,
scenario_path, "results", "compliance")
log.warning(
f"{scenario} scenario result is invalid for {system_desc}: {model} in {division} division. Accuracy: {accuracy_is_valid}, Performance: {perf_is_valid}. Removing...")
shutil.rmtree(scenario_path)
shutil.rmtree(scenario_measurements_path)
shutil.rmtree(scenario_compliance_path)
if os.path.exists(scenario_path):
shutil.rmtree(scenario_path)
if os.path.exists(scenario_measurements_path):
shutil.rmtree(scenario_measurements_path)
if os.path.exists(scenario_compliance_path):
shutil.rmtree(scenario_compliance_path)
elif division in ["closed", "network"]:
model_results_path = os.path.dirname(scenario_path)
model_measurements_path = change_folder_name_in_path(
Expand All @@ -279,10 +293,12 @@ def clean_invalid_results(args, log_path, config, system_desc, system_json,
if not perf_is_valid:
log.warning(
f"{scenario} scenario result is invalid for {system_desc}: {model} in {division} and open divisions. Accuracy: {accuracy_is_valid}, Performance: {perf_is_valid}. Removing it...")
shutil.rmtree(scenario_path)
if os.path.exists(scenario_path):
shutil.rmtree(scenario_path)
scenario_measurements_path = change_folder_name_in_path(
scenario_path, "results", "measurements")
shutil.rmtree(scenario_measurements_path)
if os.path.exists(scenario_measurements_path):
shutil.rmtree(scenario_measurements_path)
if not os.path.exists(target_results_path):
shutil.copytree(
model_results_path, target_results_path)
Expand Down Expand Up @@ -311,9 +327,11 @@ def clean_invalid_results(args, log_path, config, system_desc, system_json,
clean_model_dir(model_results_path)
else: # delete this result
# delete other scenario results too
shutil.rmtree(scenario_path)
if os.path.exists(scenario_path):
shutil.rmtree(scenario_path)
# delete other scenario results too
shutil.rmtree(scenario_measurements_path)
if os.path.exists(scenario_measurements_path):
shutil.rmtree(scenario_measurements_path)
log.warning(
f"{scenario} scenario result is invalid for {system_desc}: {model} in {division} division. Accuracy: {accuracy_is_valid}, Performance: {perf_is_valid}. Removing it...")

Expand Down
Loading