Skip to content

Conversation

CharlieFRuan
Copy link
Contributor

@CharlieFRuan CharlieFRuan commented May 4, 2025

This PR prints out the memory usage of KV cache: MB for one token's KV cache, and the total MB for model weights + intermediate buffers + a 4K-long KV cache.

If somehow the required fields are not present in config and metadata (e.g. for an old model), we do nothing.

Sample output in CLI:

[2025-05-03 21:44:24] INFO model_metadata.py:94: Total memory usage without KV cache: 2254.16 MB (Parameters: 923.16 MB. Temporary buffer: 1331.00 MB)
[2025-05-03 21:44:24] INFO model_metadata.py:128: KV cache size: 0.11 MB per token in the context window
[2025-05-03 21:44:24] INFO model_metadata.py:133: Total memory usage with a 4K KV cache: 2702.16 MB

@CharlieFRuan CharlieFRuan requested a review from MasterJH5574 May 4, 2025 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant