-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Libraries update for Stable Diffusion (#335) * compliance checker update for StableDiffusion * RCP checker update for StableDiffusion * renamed the stable diffusion rules files to match the benchmark name * added "stable_diffusion" to relevant configs, renamed rcp file * renamed AT_LEAST_N_TIMES to AT_LEAST (#337) * Remove stable_diffusion_v2 references --------- Co-authored-by: Ahmad Kiswani <[email protected]>
- Loading branch information
1 parent
c27d838
commit 7fe011c
Showing
10 changed files
with
239 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
mlperf_logging/compliance_checker/training_3.1.0/closed_stable_diffusion.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Stable diffusion uses two metrics, FID and CLIP. | ||
# These metrics can be calculated offline, using different scripts | ||
# and logged seperatly. Therefore, we create a virtual key | ||
# called aggregated_eval_accuracy, which aggregates | ||
# both metrics into a single log line | ||
|
||
- BEGIN: | ||
CODE: | | ||
from dataclasses import replace | ||
agg_eval_lines = {} | ||
for line in loglines: | ||
if line.key == "eval_accuracy": | ||
step_num = line.value['metadata']['step_num'] | ||
if step_num not in agg_eval_lines: | ||
new_line = replace(line) # Make a copy | ||
new_line.key = "aggregated_eval_accuracy" | ||
new_line.full_string = "" # Not needed | ||
new_line.lineno = -1 # Not needed | ||
new_line.value = {'value': {'step_num': step_num}, 'metadata':{}} | ||
agg_eval_lines[step_num] = new_line | ||
agg_eval_lines[step_num].timestamp = max(line.timestamp, agg_eval_lines[step_num].timestamp) | ||
agg_eval_lines[step_num].value['value'][line.value['metadata']['metric']] = line.value['value'] | ||
loglines.extend(agg_eval_lines.values()) | ||
- KEY: | ||
NAME: global_batch_size | ||
REQ: AT_LEAST_ONE | ||
CHECK: " v['value'] >= 0 " | ||
|
||
- KEY: | ||
NAME: opt_name | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] == 'adamw' " | ||
|
||
- KEY: | ||
NAME: opt_adamw_beta_1 | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] == 0.9 " | ||
|
||
- KEY: | ||
NAME: opt_adamw_beta_2 | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] == 0.999 " | ||
|
||
- KEY: | ||
NAME: opt_adamw_epsilon | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] == 1e-08 " | ||
|
||
- KEY: | ||
NAME: opt_adamw_weight_decay | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] == 0.01 " | ||
|
||
- KEY: | ||
NAME: opt_base_learning_rate | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] >= 0.0 " | ||
|
||
- KEY: | ||
NAME: opt_learning_rate_warmup_steps | ||
REQ: EXACTLY_ONE | ||
CHECK: " v['value'] >= 0 " | ||
|
||
- KEY: | ||
NAME: aggregated_eval_accuracy | ||
REQ: AT_LEAST(2) | ||
CHECK: | ||
- "'FID' in v['value']" | ||
- "'CLIP' in v['value']" | ||
- "'step_num' in v['value']" | ||
ATLEAST_ONE_CHECK: "(0.0 <= v['value']['FID'] <= 90.0) and (0.15 <= v['value']['CLIP'] <= 1.0)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
mlperf_logging/compliance_checker/training_3.1.0/open_stable_diffusion.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Stable diffusion uses two metrics, FID and CLIP. | ||
# These metrics can be calculated offline, using different scripts | ||
# and logged seperatly. Therefore, we create a virtual key | ||
# called aggregated_eval_accuracy, which aggregates | ||
# both metrics into a single log line | ||
|
||
- BEGIN: | ||
CODE: | | ||
from dataclasses import replace | ||
agg_eval_lines = {} | ||
for line in loglines: | ||
if line.key == "eval_accuracy": | ||
step_num = line.value['metadata']['step_num'] | ||
if step_num not in agg_eval_lines: | ||
new_line = replace(line) # Make a copy | ||
new_line.key = "aggregated_eval_accuracy" | ||
new_line.full_string = "" # Not needed | ||
new_line.lineno = -1 # Not needed | ||
new_line.value = {'value': {'step_num': step_num}, 'metadata':{}} | ||
agg_eval_lines[step_num] = new_line | ||
agg_eval_lines[step_num].timestamp = max(line.timestamp, agg_eval_lines[step_num].timestamp) | ||
agg_eval_lines[step_num].value['value'][line.value['metadata']['metric']] = line.value['value'] | ||
loglines.extend(agg_eval_lines.values()) | ||
- KEY: | ||
NAME: aggregated_eval_accuracy | ||
REQ: AT_LEAST(2) | ||
CHECK: | ||
- "'FID' in v['value']" | ||
- "'CLIP' in v['value']" | ||
- "'step_num' in v['value']" | ||
ATLEAST_ONE_CHECK: "v['value']['FID'] >= 0.0 and v['value']['CLIP'] <= 1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.