MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / sizeof_fmt

Function sizeof_fmt

benchmarks/benchmark_generation.py:15–20  ·  view source on GitHub ↗
(num, suffix='B')

Source from the content-addressed store, hash-verified

13
14
15def sizeof_fmt(num, suffix='B'):
16 for unit in ('', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi'):
17 if abs(num) < 1024.0:
18 return f'{num:3.1f}{unit}{suffix}'
19 num /= 1024.0
20 return f'{num:.1f}Yi{suffix}'
21
22
23if __name__ == "__main__":

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected