Commit cd4b679
Fix genai_config.json discovery for nested multi-component model layouts (microsoft#2529)
## Description
The evaluator previously assumed `genai_config.json` is in the same
directory as the ONNX model file (`Path(model.model_path).parent`). For
nested multi-component model layouts (e.g., `models/decoder/model.onnx`
where `genai_config.json` lives at `models/`), this caused evaluation to
fail because the config file was not found.
This is the case for models exported by `MobiusBuilder` (gemma4, etc.),
which creates a nested layout:
```
models/
├── genai_config.json
├── decoder/model.onnx
├── vision_encoder/model.onnx
├── audio_encoder/model.onnx
└── embedding/model.onnx
```
When the evaluator loads the decoder (`models/decoder/model.onnx`),
`Path(model.model_path).parent` resolves to `models/decoder/`, missing
the `genai_config.json` at `models/`.
## Changes
- Added module-level `_find_genai_config()` helper that searches upward
(up to 3 levels) from the ONNX file's parent directory to find
`genai_config.json`
- Added module-level `_get_genai_model_dir()` helper that returns the
root model directory containing `genai_config.json` (falls back to ONNX
file's parent if not found)
- `OnnxEvaluator` static methods wrap these for backward compatibility
- Updated all usages across `OnnxEvaluator`, `LMEvaluator`, and
`MTEBEvaluator`
## Motivation
This fix enables evaluation of multimodal models with nested component
layouts (e.g., gemma4-E2B exported by MobiusBuilder) using Olive's
built-in evaluator.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: jiafatom <jiafatom@users.noreply.github.com>1 parent 8452622 commit cd4b679
3 files changed
Lines changed: 137 additions & 13 deletions
File tree
- .azure_pipelines/job_templates
- olive/evaluator
- test/evaluator
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
485 | 514 | | |
486 | 515 | | |
487 | 516 | | |
| |||
584 | 613 | | |
585 | 614 | | |
586 | 615 | | |
587 | | - | |
588 | | - | |
589 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
590 | 624 | | |
591 | 625 | | |
592 | 626 | | |
| |||
845 | 879 | | |
846 | 880 | | |
847 | 881 | | |
848 | | - | |
| 882 | + | |
849 | 883 | | |
850 | 884 | | |
851 | 885 | | |
| |||
918 | 952 | | |
919 | 953 | | |
920 | 954 | | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
921 | 960 | | |
922 | 961 | | |
923 | 962 | | |
| |||
991 | 1030 | | |
992 | 1031 | | |
993 | 1032 | | |
994 | | - | |
| 1033 | + | |
995 | 1034 | | |
996 | 1035 | | |
997 | 1036 | | |
| |||
1125 | 1164 | | |
1126 | 1165 | | |
1127 | 1166 | | |
1128 | | - | |
| 1167 | + | |
1129 | 1168 | | |
1130 | 1169 | | |
1131 | 1170 | | |
| |||
1947 | 1986 | | |
1948 | 1987 | | |
1949 | 1988 | | |
1950 | | - | |
| 1989 | + | |
1951 | 1990 | | |
1952 | 1991 | | |
1953 | 1992 | | |
| |||
2062 | 2101 | | |
2063 | 2102 | | |
2064 | 2103 | | |
2065 | | - | |
2066 | | - | |
| 2104 | + | |
| 2105 | + | |
2067 | 2106 | | |
2068 | 2107 | | |
2069 | 2108 | | |
| |||
2098 | 2137 | | |
2099 | 2138 | | |
2100 | 2139 | | |
2101 | | - | |
| 2140 | + | |
2102 | 2141 | | |
2103 | 2142 | | |
2104 | 2143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
0 commit comments