TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

Build scaffolding without tensorrt_llm dependency

Open WeiHaocheng opened this issue 1 year ago • 1 comments

Many community contributors hope to run scaffolding without building trt-llm. In theory, scaffolding can also be run through non TRT LLM workers, such as OpenAI API, and we can find ways to support this.

WeiHaocheng avatar Apr 07 '25 12:04 WeiHaocheng

Hi, I reproduced the current import boundary behind this issue and would like to contribute a narrow first slice if the direction is still wanted.

On current main (573bd5f0b8414566bd6183f74b06f8c8a99e6a69), even canonical import of the standard-library-only tensorrt_llm.scaffolding.math_utils initializes tensorrt_llm/__init__.py first. In a CPU environment with the OpenAI/MCP/Transformers dependencies installed but no TensorRT-LLM runtime stack, both that import and import tensorrt_llm.scaffolding fail before any Scaffolding source frame is reached. Direct loading of the exact math_utils.py control succeeds.

The source audit shows a second coupling layer after the package root:

scaffolding/__init__.py -> eagerly exports worker.py, controllers, benchmark, replay
worker.py               -> imports LLM, executor, KV/Scheduler config, SamplingParams
task.py/controller.py   -> import executor result and logger types at runtime

The result passed identically in three fresh subprocesses. This means OpenAI-only controller execution is structurally coupled to the full runtime even when it does not use an in-process TRT worker.

Could a maintainer approve a narrow dependency-boundary contribution before implementation? I propose:

  1. define the supported lightweight public surface and dependency direction first;
  2. separate generic task/result/controller protocols and OpenaiWorker from the in-process TRTLLMWorker adapter;
  3. avoid eager imports of optional worker/benchmark/replay surfaces;
  4. add a clean CPU import-and-minimal-controller test that fails if native/runtime modules are imported;
  5. preserve existing imports through compatibility re-exports where feasible, without changing execution semantics.

There is no assignee or active PR referencing this issue visible today.

HOYALIM avatar Jul 15 '26 22:07 HOYALIM