Repository navigation
Commit 6c87b6a
committed
[None][refactor] Table-drive the lazy-safetensors model-type check in HfWeightLoader
`HfWeightLoader._is_kimi_k3_checkpoint` decided, from `config.json`'s
`model_type`, whether a checkpoint must stay mmapped instead of being
materialized in host RAM, and hard-coded the two Kimi model types in the
method body. Rename it to `_requires_lazy_safetensors` and move the model
types into a module-level `_LAZY_SAFETENSORS_MODEL_TYPES` tuple, so the
next model family whose checkpoint is too large for host RAM opts in by
adding one entry instead of editing a Kimi-named predicate.
Behavior is unchanged: the tuple holds exactly the two model types the
method used to name.
Add unit tests that exercise the predicate for every listed model
type, for a non-lazy model type, for a config without `model_type`, and
for a directory without `config.json`.
Signed-off-by: Michal Guzek <mguzek@nvidia.com>1 parent 01dc618 commit 6c87b6a
2 files changed
Lines changed: 40 additions & 8 deletions
File tree
- tensorrt_llm/_torch/models/checkpoints/hf
- tests/unittest/_torch/models/checkpoints/hf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
352 | 355 | | |
353 | 356 | | |
354 | 357 | | |
355 | | - | |
356 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
357 | 367 | | |
358 | 368 | | |
359 | 369 | | |
360 | 370 | | |
361 | | - | |
362 | | - | |
363 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
364 | 374 | | |
365 | 375 | | |
366 | | - | |
| 376 | + | |
367 | 377 | | |
368 | 378 | | |
369 | 379 | | |
| |||
715 | 725 | | |
716 | 726 | | |
717 | 727 | | |
718 | | - | |
| 728 | + | |
719 | 729 | | |
720 | 730 | | |
721 | 731 | | |
| |||
877 | 887 | | |
878 | 888 | | |
879 | 889 | | |
880 | | - | |
| 890 | + | |
881 | 891 | | |
882 | 892 | | |
883 | 893 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
519 | 520 | | |
520 | 521 | | |
521 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
0 commit comments