Repository navigation
Conversation
Use available checkpoint file metadata before the safetensors parameter-count fallback, preventing packed quantized weights from being overestimated. Fixes ai-dynamo#16140 Signed-off-by: xinjun.jiang <[email protected]>
|
👋 Hi git-jxj! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
| """Return model size in MB by querying Hugging Face Hub API.""" | ||
| try: | ||
| info = model_info(model_name, token=token) | ||
| info = model_info(model_name, token=token, files_metadata=True) |
There was a problem hiding this comment.
Requesting Hub file metadata makes the existing broad extension filter authoritative for remote models, so any non-checkpoint artifact ending in .bin, .pt, or .pth is now included in model_size. A Hub repo that contains Trainer artifacts such as training_args.bin or optimizer.pt will inflate the profiler's GPU search bound even though those files are not inference weights. Filter the metadata total to checkpoint filenames/index entries rather than every file with a weight-like extension, and keep the safetensors fallback when no checkpoint sizes are available.
🤖 AI Fix
Restrict Hub metadata summation to actual checkpoint files, excluding trainer and optimizer artifacts before adding sibling sizes.
There was a problem hiding this comment.
Fixed in the follow-up commit: Hub sizes now use checkpoint index weight_map entries (deduplicated and pinned to the metadata revision), or checkpoint filenames when no index is present. Trainer/optimizer/scheduler/scaler/RNG and unrelated binary artifacts no longer contribute; custom quantized safetensors and indexed custom binary shards remain supported. Checkpoint bytes are used only when every selected file is present and has a size; incomplete size metadata or unreadable indexes use the safetensors estimate when available.
Validation: 55 model-info/model-cache tests passed (2 existing optional-module skips), including regressions for partial sizes, missing indexed shards and the installed Hub transport's connection/timeout errors. Changed-file pre-commit passed. A real Hub query for philschmid/tiny-bert-sst2-distilled previously included 2,927 bytes of training_args.bin; it now returns exactly the checkpoint size. TinyLlama GPTQ and Qwen's sharded index also returned their exact checkpoint totals. Only metadata and the JSON index were fetched; no weights or inference engine were loaded.
Signed-off-by: xinjun.jiang <[email protected]>
Signed-off-by: xinjun.jiang <[email protected]>
|
Current head |
Summary
The profiler's Hub query leaves checkpoint sizes unset by default, making packed quantized weights fall back to an inaccurate parameter-count estimate. Request file metadata and select checkpoint files through index references or checkpoint filenames so training and optimizer artifacts do not inflate automatic GPU sizing. Select one checkpoint format and use file bytes only when all selected checkpoints have size metadata, preserving the safetensors estimate when metadata is incomplete or the index is unavailable.
For
TheBloke/TinyLlama-1.1B-Chat-v1.0-GPTQ, the helper reports the actual checkpoint size of 732.56 MiB instead of 2098.93 MiB. Custom quantized safetensors and indexed custom binary shards are supported.Validation
training_args.bin, TinyLlama GPTQ, and Qwen2.5-3B's sharded index. Only metadata and a JSON index were fetched; no weights or inference engine were loaded.git diff --checkpassed.Where should the reviewer start?
_get_hub_checkpoint_filenames(),get_model_weight_size_from_hub()and their regressions intest_model_info.py.Related Issues
Closes #16140.