Skip to content

Commit

Permalink
Auto-calculate total model bytes on model descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyballentine committed May 17, 2024
1 parent 65ebd7e commit 25661d8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/spandrel/spandrel/__helpers/model_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ def __init__(
on how to best use the model.
"""

self.model_bytes: int = sum(p.numel() * 4 for p in model.parameters())
"""
The number of bytes the model uses in fp32.
"""

self.model.load_state_dict(state_dict) # type: ignore

@property
Expand Down

0 comments on commit 25661d8

Please sign in to comment.