Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Sun, Xuehao <[email protected]>
  • Loading branch information
XuehaoSun committed Jul 2, 2024
1 parent cacefb0 commit d58042e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
34 changes: 17 additions & 17 deletions .azure-pipelines/model-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ stages:
mkdir generated last_generated
python -u summarize_results.py --logs_dir $(OUT_SCRIPT_PATH) --output_dir generated
displayName: "Summarize all results"
# - task: DownloadPipelineArtifact@2
# continueOnError: true
# inputs:
# source: "specific"
# artifact: "FinalReport"
# patterns: "**.log"
# path: $(OUT_SCRIPT_PATH)/last_generated
# project: $(System.TeamProject)
# pipeline: "Model-Test"
# runVersion: "specific"
# runId: $(refer_buildId)
# displayName: "Download last logs"
# - script: |
# echo "------ Generating final report.html ------"
# cd ${OUT_SCRIPT_PATH}
# /usr/bin/bash generate_report.sh --WORKSPACE generated --json_path generated/summary.json --last_json_path last_generated/summary.json
# displayName: "Generate report"
- task: DownloadPipelineArtifact@2
continueOnError: true
inputs:
source: "specific"
artifact: "FinalReport"
patterns: "**.json"
path: $(OUT_SCRIPT_PATH)/last_generated
project: $(System.TeamProject)
pipeline: "onc model test"
runVersion: "specific"
runId: $(refer_buildId)
displayName: "Download last logs"
- script: |
echo "------ Generating final report.html ------"
cd ${OUT_SCRIPT_PATH}
/usr/bin/bash generate_report.sh --WORKSPACE generated --json_path generated/summary.json --last_json_path last_generated/summary.json
displayName: "Generate report"
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(OUT_SCRIPT_PATH)/generated
Expand Down
15 changes: 11 additions & 4 deletions .azure-pipelines/scripts/models/collect_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@
)


def str_to_float(value):
try:
return round(float(value), 4)
except ValueError:
return value


def main():
result_dict = {
args.model: {
"performance": {"value": "n/a", "log_path": URL},
"accuracy": {"value": "n/a", "log_path": URL},
"performance": {"value": "N/A", "log_path": URL},
"accuracy": {"value": "N/A", "log_path": URL},
}
}

pattern = {
"performance": r"Throughput = ([\d.]+)",
"performance": r"Throughput: ([\d.]+)",
"accuracy": r"Accuracy: ([\d.]+)",
}

Expand All @@ -40,7 +47,7 @@ def main():
match = re.search(pattern[mode], log_content)

if match:
result_dict[args.model][mode]["value"] = match.group(1)
result_dict[args.model][mode]["value"] = str_to_float(match.group(1))

with open(f"/neural-compressor/.azure-pipelines/scripts/models/{args.model}/result.json", "w") as json_file:
json.dump(result_dict, json_file, indent=4)
Expand Down

0 comments on commit d58042e

Please sign in to comment.