With the new TensorRT-LLM 0.9.0, ModelConfig in tesnorrt_llm.runtime.generation now has new args max_batch_size, max_beam_width - how do we set these? #1505
Replies: 1 comment
-
|
In TensorRT-LLM 0.9.0, the addition of 1. Where do these values come from?You generally do NOT manually invent them at runtime. They come from one of three places: ✔ Option A: From the engine/build config (recommended)When you build the engine: trtllm-build \
--max_batch_size X \
--max_beam_width YThose values are embedded into the serialized engine and later reused automatically in runtime ✔ Option B: Passed via high-level APIs (LLM API)If using Python build_config = BuildConfig()
build_config.max_batch_size = 8
build_config.max_beam_width = 4
llm = LLM(model_dir, build_config=build_config)Then runtime config inherits it. :contentReference[oaicite:1]{index=1} ✔ Option C: Auto-loaded from engine (most common runtime path)If you're using: ModelRunnerCpp.from_dir(engine_dir)then:
are read directly from the engine config file and passed into So in this case:
2. What do these parameters actually mean?🔹
|
| Value | Who sets it | When |
|---|---|---|
| max_batch_size | build time (trtllm-build) |
engine creation |
| max_beam_width | build time | engine creation |
| ModelConfig fields | runtime loader | engine execution |
Bottom line
- You typically do not manually tune these at runtime
- They are inherited from engine build config
- Their purpose is safety + consistency enforcement in runtime API (0.9+)
- Old scripts break because they assumed runtime was independent of build constraints
If this answer helped or pointed you in the right direction, I'd appreciate it if you could mark it as the accepted answer so it's easier for others with the same issue to find.
Also, if you found my contribution useful, I'd appreciate it if you could check out my GitHub profile, follow me, and star any repositories you find interesting.
GitHub: https://github.com/Advait251206
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The new version of Tensorrt_llm introduced new arguments to ModelConfig - max_batch_size, max_beam_width.
How do we set these? Specifically, this breaks the trt_llama_api.py script that is used to build the rag on windows. I'm trying to run that on Ubuntu and wish to stay up to date with tensorrt_llm's latest release.
Beta Was this translation helpful? Give feedback.
All reactions