Commit 6da982b
authored
Fix input validation issues and update multiple-choice options handling (microsoft#2501)
This pull request introduces improvements to the handling of
multiple-choice questions and options extraction in the data
preprocessing and evaluation pipeline, as well as a minor enhancement to
ONNX model input handling. The main changes include switching from
numeric to letter-based multiple-choice options, extracting the selected
letter during evaluation, and supporting an additional input name in
ONNX graph surgeries.
**Multiple-choice options handling:**
* Updated `pre_process_data.py` to format multiple-choice options using
letters (A, B, C, ...) instead of numbers, and added a new field
`extract_option_letter` to indicate when letter extraction is needed.
[[1]](diffhunk://#diff-df8a7d990b3be7d29f4b7a919903dc72b9e8ff15d13d9282639a3e281bc3f23aR481-R490)
[[2]](diffhunk://#diff-df8a7d990b3be7d29f4b7a919903dc72b9e8ff15d13d9282639a3e281bc3f23aR510)
* Modified `olive_evaluator.py` to extract the selected letter from
model responses for multiple-choice questions, in addition to the
previous digit extraction. This ensures compatibility with the new
letter-based formatting.
[[1]](diffhunk://#diff-816af95cf16e31610395bb20947f1d73cc1ca67355964e074a8f55375c8139a7R884)
[[2]](diffhunk://#diff-816af95cf16e31610395bb20947f1d73cc1ca67355964e074a8f55375c8139a7L940-R943)
[[3]](diffhunk://#diff-816af95cf16e31610395bb20947f1d73cc1ca67355964e074a8f55375c8139a7R956-R959)
**ONNX model input handling:**
* Enhanced the `TieWordEmbeddings` class in `graph_surgeries.py` to
support both `input_embeds` and `inputs_embeds` as valid input names,
improving compatibility with different model variants.1 parent 120972c commit 6da982b
3 files changed
Lines changed: 18 additions & 7 deletions
File tree
- olive
- data/component
- evaluator
- passes/onnx
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
481 | 482 | | |
482 | 483 | | |
483 | | - | |
| 484 | + | |
| 485 | + | |
484 | 486 | | |
485 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
486 | 491 | | |
487 | 492 | | |
488 | 493 | | |
| |||
502 | 507 | | |
503 | 508 | | |
504 | 509 | | |
| 510 | + | |
505 | 511 | | |
506 | 512 | | |
507 | 513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
| 884 | + | |
884 | 885 | | |
885 | 886 | | |
886 | 887 | | |
| |||
937 | 938 | | |
938 | 939 | | |
939 | 940 | | |
940 | | - | |
941 | | - | |
942 | | - | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
943 | 944 | | |
944 | 945 | | |
945 | 946 | | |
| |||
952 | 953 | | |
953 | 954 | | |
954 | 955 | | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
955 | 960 | | |
956 | 961 | | |
957 | 962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2151 | 2151 | | |
2152 | 2152 | | |
2153 | 2153 | | |
2154 | | - | |
| 2154 | + | |
2155 | 2155 | | |
2156 | | - | |
| 2156 | + | |
2157 | 2157 | | |
2158 | 2158 | | |
2159 | 2159 | | |
| |||
0 commit comments