Skip to content
Open
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
43 changes: 20 additions & 23 deletions compliance/TEST01/run_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,24 @@ def main():
unixmode_str = unixmode if unixmode == "" else unixmode + " "

# run verify accuracy
verify_accuracy_command = (
sys.executable + " "
+ verify_accuracy_binary
+ " --dtype "
+ args.dtype
+ unixmode_str
+ " -r "
+ os.path.join(results_dir, "accuracy", "mlperf_log_accuracy.json")
+ " -t "
+ os.path.join(compliance_dir, "mlperf_log_accuracy.json")
)
verify_accuracy_command = [
sys.executable
, verify_accuracy_binary
, "--dtype"
, dtype
, unixmode_str
, "--reference_accuracy"
, os.path.join(results_dir, "accuracy", "mlperf_log_accuracy.json")
, "--test_accuracy"
, os.path.join(compliance_dir, "mlperf_log_accuracy.json")]
verify_accuracy_command = [arg.strip() for arg in verify_accuracy_command if arg.strip() != ""]

try:
with open("verify_accuracy.txt", "w") as f:
process = subprocess.Popen(
verify_accuracy_command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True,
text=True
)
# Write output to both console and file
Expand All @@ -145,24 +145,21 @@ def main():
verify_performance_binary = os.path.join(
os.path.dirname(__file__), "verify_performance.py"
)
verify_performance_command = (
sys.executable + " "
+ verify_performance_binary
+ " -r"
+ os.path.join(results_dir, "performance",
"run_1", "mlperf_log_detail.txt")
+ " -t"
+ os.path.join(compliance_dir, "mlperf_log_detail.txt")
)

verify_performance_command = [
sys.executable,
verify_performance_binary,
"-r",
os.path.join(results_dir, "performance", "run_1", "mlperf_log_detail.txt"),
"-t",
os.path.join(compliance_dir, "mlperf_log_detail.txt")
]
try:
with open("verify_performance.txt", "w") as f:
process = subprocess.Popen(
verify_performance_command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
shell=True,
)
# Write output to both console and file
for line in process.stdout:
Expand Down
19 changes: 8 additions & 11 deletions compliance/TEST04/run_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,21 @@ def main():
verify_performance_binary = os.path.join(
os.path.dirname(__file__), "verify_performance.py"
)
verify_performance_command = (
sys.executable + " "
+ verify_performance_binary
+ " -r"
+ os.path.join(results_dir, "performance",
"run_1", "mlperf_log_summary.txt")
+ " -t"
+ os.path.join(compliance_dir, "mlperf_log_summary.txt")
)

verify_performance_command = [
sys.executable,
verify_performance_binary,
"-r",
os.path.join(results_dir, "performance", "run_1", "mlperf_log_summary.txt"),
"-t",
os.path.join(compliance_dir, "mlperf_log_summary.txt")
]
try:
with open("verify_performance.txt", "w") as f:
process = subprocess.Popen(
verify_performance_command,
stdout=subprocess.PIPE, # capture output
stderr=subprocess.STDOUT,
text=True, # decode output as text
shell=True,
)
# Write output to both console and file
for line in process.stdout:
Expand Down
17 changes: 11 additions & 6 deletions language/bert/accuracy-squad.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,19 @@ def append_feature(feature):
)

print("Evaluating predictions...")
cmd = "python3 {:}/evaluate_v1.1.py {:} {:} {}".format(
os.path.dirname(os.path.abspath(__file__)),
cmd = [
"python3",
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"evaluate_v1.1.py"
),
args.val_data,
args.out_file,
"--max_examples {}".format(
args.max_examples) if args.max_examples else "",
)
subprocess.check_call(cmd, shell=True)
"--max_examples"if args.max_examples else "",
str(args.max_examples) if args.max_examples else ""
]
cmd = [arg for arg in cmd if arg.strip() != ""]
subprocess.check_call(cmd)


if __name__ == "__main__":
Expand Down
21 changes: 12 additions & 9 deletions language/bert/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def get_args():

def main():
args = get_args()

sut = None

if not args.network or args.network == "sut":
Expand Down Expand Up @@ -199,15 +198,19 @@ def main():
sut.sut, sut.qsl.qsl, settings, log_settings, args.audit_conf
)
if args.accuracy and not os.environ.get("SKIP_VERIFY_ACCURACY"):
cmd = "python3 {:}/accuracy-squad.py {}".format(
os.path.dirname(os.path.abspath(__file__)),
(
"--max_examples {}".format(args.max_examples)
if args.max_examples
else ""
cmd = [
"python3",
os.path.join(
os.path.dirname(os.path.abspath(__file__)), "accuracy-squad.py"
),
)
subprocess.check_call(cmd, shell=True)
"--max_examples" if args.max_examples
else "",
args.max_examples
if args.max_examples
else "",
]
cmd = [arg for arg in cmd if arg.strip() != ""]
subprocess.check_call(cmd)

print("Done!")

Expand Down
13 changes: 11 additions & 2 deletions retired_benchmarks/speech_recognition/rnnt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,18 @@ def main():
)

if args.accuracy:
cmd = f"python3 accuracy_eval.py --log_dir {log_path} --dataset_dir {args.dataset_dir} --manifest {args.manifest}"
cmd = [
"python3",
"accuracy_eval.py",
"--log_dir",
log_path,
"--dataset_dir",
args.dataset_dir,
"--manifest",
args.manifest,
]
print(f"Running accuracy script: {cmd}")
subprocess.check_call(cmd, shell=True)
subprocess.check_call(cmd)

print("Done!")

Expand Down
61 changes: 21 additions & 40 deletions retired_benchmarks/translation/gnmt/tensorflow/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,44 +88,25 @@

outpath = os.path.join(args.output_path, "output", "console_out_gnmt.txt")

cmd = (
"python -m nmt.nmt \
--src=en --tgt=de \
--ckpt="
+ cpk_path
+ " \
--hparams_path="
+ haparams_path
+ " \
--out_dir="
+ out_dir
+ " \
--vocab_prefix="
+ vocab_prefix
+ " \
--inference_input_file="
+ inference_input_file
+ " \
--inference_output_file="
+ inference_output_file
+ " \
--inference_ref_file="
+ inference_ref_file
+ " \
--infer_batch_size="
+ args.batch_size
+ " \
--num_inter_threads="
+ args.num_inter_threads
+ " \
--num_intra_threads="
+ args.num_intra_threads
+ " \
--iterations="
+ str(iterations)
+ " \
--run="
+ args.run
)

return_code = subprocess.call(cmd, shell=True)
cmd = [
"python",
"-m",
"nmt.nmt",
"--src=en",
"--tgt=de",
"--ckpt={}".format(cpk_path),
"--hparams_path={}".format(haparams_path),
"--out_dir={}".format(out_dir),
"--vocab_prefix={}".format(vocab_prefix),
"--inference_input_file={}".format(inference_input_file),
"--inference_output_file={}".format(inference_output_file),
"--inference_ref_file={}".format(inference_ref_file),
"--infer_batch_size={}".format(args.batch_size),
"--num_inter_threads={}".format(args.num_inter_threads),
"--num_intra_threads={}".format(args.num_intra_threads),
"--iterations={}".format(iterations),
"--run={}".format(args.run)
]

return_code = subprocess.call(cmd)
28 changes: 20 additions & 8 deletions text_to_video/wan-2.2-t2v-a14b/run_mlperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def load_prompts(dataset_path):


class Model:
def __init__(self, model_path, device, config, prompts, fixed_latent=None, rank=0):
def __init__(self, model_path, device, config,
prompts, fixed_latent=None, rank=0):
self.device = device
self.rank = rank
self.height = config["height"]
Expand Down Expand Up @@ -106,7 +107,8 @@ def flush_queries(self):


class DebugModel:
def __init__(self, model_path, device, config, prompts, fixed_latent=None, rank=0):
def __init__(self, model_path, device, config,
prompts, fixed_latent=None, rank=0):
self.prompts = prompts

def issue_queries(self, query_samples):
Expand Down Expand Up @@ -186,7 +188,8 @@ def get_args():
parser.add_argument(
"--scenario",
default="SingleStream",
help="mlperf benchmark scenario, one of " + str(list(SCENARIO_MAP.keys())),
help="mlperf benchmark scenario, one of " +
str(list(SCENARIO_MAP.keys())),
)
parser.add_argument(
"--user_conf",
Expand All @@ -202,7 +205,10 @@ def get_args():
help="performance sample count",
default=5000,
)
parser.add_argument("--accuracy", action="store_true", help="enable accuracy pass")
parser.add_argument(
"--accuracy",
action="store_true",
help="enable accuracy pass")
# Dont overwrite these for official submission
parser.add_argument("--count", type=int, help="dataset items to use")
parser.add_argument("--time", type=int, help="time to scan in seconds")
Expand Down Expand Up @@ -271,7 +277,10 @@ def run_mlperf(args, config):

audit_config = os.path.abspath(args.audit_conf)
if os.path.exists(audit_config):
settings.FromConfig(audit_config, "wan-2.2-t2v-a14b", args.scenario)
settings.FromConfig(
audit_config,
"wan-2.2-t2v-a14b",
args.scenario)
settings.scenario = SCENARIO_MAP[args.scenario]

settings.mode = lg.TestMode.PerformanceOnly
Expand All @@ -297,8 +306,10 @@ def run_mlperf(args, config):
if args.samples_per_query:
settings.multi_stream_samples_per_query = args.samples_per_query
if args.max_latency:
settings.server_target_latency_ns = int(args.max_latency * NANO_SEC)
settings.multi_stream_expected_latency_ns = int(args.max_latency * NANO_SEC)
settings.server_target_latency_ns = int(
args.max_latency * NANO_SEC)
settings.multi_stream_expected_latency_ns = int(
args.max_latency * NANO_SEC)

performance_sample_count = (
args.performance_sample_count
Expand All @@ -311,7 +322,8 @@ def run_mlperf(args, config):
count, performance_sample_count, load_query_samples, unload_query_samples
)

lg.StartTestWithLogSettings(sut, qsl, settings, log_settings, audit_config)
lg.StartTestWithLogSettings(
sut, qsl, settings, log_settings, audit_config)

lg.DestroyQSL(qsl)
lg.DestroySUT(sut)
Expand Down
6 changes: 3 additions & 3 deletions tools/submission/generate_final_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ def main():
"singlestream": "SingleStream",
"multistream": "MultiStream",
"server": "Server",
"interactive":"Interactive",
"interactive": "Interactive",
"offline": "Offline",
}
df["Scenario"] = df["Scenario"].apply(lambda x: scenario_map.get(str(x).lower(), x))

df["Scenario"] = df["Scenario"].apply(
lambda x: scenario_map.get(str(x).lower(), x))

output = args.input[:-4]
writer = pd.ExcelWriter(output + ".xlsx", engine="xlsxwriter")
Expand Down
Loading