Repository navigation
【feature】Support Multi Lora Infer - #408
Merged
Merged
Conversation
added 2 commits
July 21, 2026 20:28
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
SJTUyh
had a problem deploying
to
smoke-test-approval
July 22, 2026 01:44 — with
GitHub Actions
Failure
SJTUyh
temporarily deployed
to
smoke-test-approval
July 22, 2026 02:24 — with
GitHub Actions
Inactive
Collaborator
Author
|
UT CI is broken, See the UT results of manul execution |
SJTUyh
temporarily deployed
to
smoke-test-approval
July 22, 2026 07:49 — with
GitHub Actions
Inactive
| return url | ||
|
|
||
| @staticmethod | ||
| def _load_lora_data_map(generation_kwargs): |
Contributor
There was a problem hiding this comment.
这几个api model 下的 方法有啥区别?可以共用一个?都是静态方法
Collaborator
Author
There was a problem hiding this comment.
[reply] lora map不是所有API后端都支持的,所有没法抽离到基类BaseAPIModel里
Keithwwa
approved these changes
Jul 27, 2026
This branch was previously deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for your contribution; we appreciate it a lot. The following instructions will make your pull request healthier and help you get feedback more easily. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
感谢您的贡献,我们非常重视。以下说明将使您的拉取请求更健康,更易于获得反馈。如果您不理解某些项目,请不要担心,只需提交拉取请求并从维护人员那里寻求帮助即可。
PR Type / PR类型
Related Issue | 关联 Issue
Fixes #(issue ID / issue 编号) / Relates to #(issue ID / issue 编号)
Fixes #404
🔍 Motivation / 变更动机
Background / 背景
AISBench's service-oriented inference (vLLM / TGI / MindIE) currently supports only a single base model per evaluation. When the inference server has multiple LoRA adapters loaded (a common production scenario), the benchmark must run as multiple independent tasks — one per adapter — which fails to faithfully represent multi-tenant workload and inflates evaluation overhead.
The legacy
benchmark-mindie-oldplugin already implemented this feature using a JSON mapping file (lora_data_map_file), but the new benchmark codebase lacks equivalent support.Goal / 目标
Enable routing each sample to the correct LoRA adapter based on dataset
data_id(row index) — entirely via a single config parameter (lora_data_map_fileundergeneration_kwargs), without introducing new model classes, without changingmodel type, and with zero behavior change for users who don't enable it.📝 Modification / 修改内容
1. Core / 核心改动
ais_bench/benchmark/models/api_models/vllm_custom_api_chat.py_load_lora_data_map,_resolve_lora_model_name); loadlora_data_map_filein__init__; overridemodelfield inget_request_body; emit[Multi-LoRA]debug logais_bench/benchmark/models/api_models/vllm_custom_api.pymodelfield)ais_bench/benchmark/models/api_models/tgi_api.pyparameters.adapter_idais_bench/benchmark/models/api_models/mindie_stream_api.pyparameters.adapter_idais_bench/benchmark/openicl/icl_inferencer/icl_gen_inferencer.pyoutput.data_id = index(1 line) so the data_id is propagated from dataset to modelNo new model class is registered. No
@MODELS.register_module()additions. Themodels/__init__.pyexport table is unchanged.2. Tests / 测试
tests/UT/models/api_models/test_vllm_custom_api_chat.pyTestVLLMCustomAPIChatLoratests/UT/models/api_models/test_vllm_custom_api.pyTestVLLMCustomAPILoratests/UT/models/api_models/test_tgi_api.pyTestTGICustomAPILoratests/UT/models/api_models/test_mindie_stream_api.pyTestMindieStreamApiLoratests/UT/openicl/icl_inferencer/test_icl_gen_inferencer.pytest_do_request_writes_data_id_to_output+CapturingModelhelpertest results:
Coverage:
_load_lora_data_map(valid / missing / null / empty / file-not-exist / invalid-JSON / empty dict),_resolve_lora_model_name(hit / miss / no map / no data_id),get_request_bodyLoRA injection (hit / miss / no config / PromptList input).3. Docs / 文档
docs/source_en/base_tutorials/all_params/models.md— new "Multi-LoRA Routing" section.docs/source_zh_cn/base_tutorials/all_params/models.md— new "Multi-LoRA 路由" section.4. Design Spec / 设计文档
.trae/documents/multi-lora-support-design.md— full design doc followingdesign_doc_template.md(Story context, sequence diagram, class diagram, flow chart, 14 UT cases, 7 exception scenarios)..trae/documents/multi-lora-support-design.docx— Word format of the same doc.📐 Associated Test Results / 关联测试结果
output.data_id = indexpresent inicl_gen_inferencer.py(32/32 structural checks PASS)./gemini reviewshould runpytest tests/UT/models/api_models/test_vllm_custom_api_chat.py::TestVLLMCustomAPIChatLora(and analogous for the other 3 backend classes + the new inferencer test).No BC-breaking change. Verified:
lora_data_map_fileingeneration_kwargs:_load_lora_data_mapreturnsNone;_resolve_lora_model_namereturnsNone;get_request_bodyfalls back to existing behavior (writesmodel=self.modelor noadapter_id). Behavior is identical to pre-change baseline.RequestOutputdoes not requiredata_idattribute;_resolve_lora_model_nameusesgetattr(output, 'data_id', None)so old callers that don't set it are unaffected.TestVLLMCustomAPIChat) preserved untouched — new tests live in dedicatedTestVLLMCustomAPIChatLoraetc.Negligible / none.
_load_lora_data_mapruns exactly once per model instance at__init__time (i.e. once per worker process)._resolve_lora_model_nameis O(1) dict lookup + attribute access; called once per request.output.data_id = indexis a single attribute write indo_request.[Multi-LoRA]debug log is atlogger.debuglevel — no runtime cost unless--debug/verbose=Trueis enabled.🌟 Use cases (Optional) / 使用案例
Use case 1: Single dataset per LoRA adapter
→ Requests for
data_id=0route toLoraA;data_id=1routes toLoraB.Use case 2: Mixed base-model + LoRA
data_id=0→LoraA;data_id=1→ base model (silent fallback, no error).Use case 3: Multi-backend tests
parameters.adapter_id(--lora-rank Nper adapter)./inferAPI.modelfield (no client-side change needed; vLLM router picks up adapter bymodel).Use case 4: Debugging
--debug(orverbose=True) prints one log line per case:Unified
[Multi-LoRA]prefix across all 4 backends makes grep / log-aggregation easy.design: https://github.com/SJTUyh/benchmark/wiki/Multi-Lora-Support-Design
test report:https://github.com/SJTUyh/benchmark/wiki/Multi-Lora-Test-Report
✅ Checklist / 检查列表
Before PR:
After PR:
👥 Collaboration Info / 协作信息
🌟 Useful CI Command / 实用的CI命令
/gemini review/gemini summary/gemini help/readthedocs build