| 2356 | |
| 2357 | |
| 2358 | class TrtLlmArgs(BaseLlmArgs): |
| 2359 | enable_tqdm: bool = Field(default=False, |
| 2360 | description="Enable tqdm for progress bar.") |
| 2361 | |
| 2362 | workspace: Optional[str] = Field(default=None, |
| 2363 | description="The workspace for the model.") |
| 2364 | |
| 2365 | # Once set, the model will reuse the build_cache |
| 2366 | enable_build_cache: object = Field( |
| 2367 | default=False, |
| 2368 | description="Enable build cache.", |
| 2369 | json_schema_extra={ |
| 2370 | "type": f"Union[{get_type_repr(BuildCacheConfig)}, bool]" |
| 2371 | }) |
| 2372 | |
| 2373 | extended_runtime_perf_knob_config: Optional[ |
| 2374 | ExtendedRuntimePerfKnobConfig] = Field( |
| 2375 | default=None, description="Extended runtime perf knob config.") |
| 2376 | |
| 2377 | calib_config: Optional[CalibConfig] = Field( |
| 2378 | default=None, description="Calibration config.", validate_default=True) |
| 2379 | |
| 2380 | # Quantization and calibration configurations |
| 2381 | quant_config: Optional[QuantConfig] = Field( |
| 2382 | default=None, description="Quantization config.", validate_default=True) |
| 2383 | |
| 2384 | embedding_parallel_mode: str = Field( |
| 2385 | default='SHARDING_ALONG_VOCAB', |
| 2386 | description="The embedding parallel mode.") |
| 2387 | |
| 2388 | fast_build: bool = Field(default=False, description="Enable fast build.") |
| 2389 | |
| 2390 | # BuildConfig is introduced to give users a familiar interface to configure the model building. |
| 2391 | build_config: Optional[BuildConfig] = Field(default=None, |
| 2392 | description="Build config.") |
| 2393 | |
| 2394 | # Prompt adapter arguments |
| 2395 | enable_prompt_adapter: bool = Field(default=False, |
| 2396 | description="Enable prompt adapter.") |
| 2397 | |
| 2398 | max_prompt_adapter_token: int = Field( |
| 2399 | default=0, description="The maximum number of prompt adapter tokens.") |
| 2400 | |
| 2401 | batching_type: Optional[BatchingType] = Field(default=None, |
| 2402 | description="Batching type.") |
| 2403 | |
| 2404 | normalize_log_probs: bool = Field( |
| 2405 | default=False, description="Normalize log probabilities.") |
| 2406 | |
| 2407 | # Private attributes |
| 2408 | # This is used to hold the options for convert_checkpoint |
| 2409 | _convert_checkpoint_options: Dict[str, |
| 2410 | Any] = PrivateAttr(default_factory=dict) |
| 2411 | |
| 2412 | @model_validator(mode="after") |
| 2413 | def init_build_config(self): |
| 2414 | """ |
| 2415 | Creating a default BuildConfig if none is provided |