fastdev.utils.model_summary

Module Contents

fastdev.utils.model_summary.console = None[source]
fastdev.utils.model_summary.PARAMETER_NUM_UNITS = [' ', 'K', 'M', 'B', 'T'][source]
fastdev.utils.model_summary.get_human_readable_count(number: int | float) str[source]

Abbreviates an integer number with K, M, B, T for thousands, millions, billions and trillions, respectively.

Examples

>>> get_human_readable_count(123)
'123  '
>>> get_human_readable_count(1234)  # (one thousand)
'1.2 K'
>>> get_human_readable_count(2e6)   # (two million)
'2.0 M'
>>> get_human_readable_count(3e9)   # (three billion)
'3.0 B'
>>> get_human_readable_count(4e14)  # (four hundred trillion)
'400 T'
>>> get_human_readable_count(5e15)  # (more than trillion)
'5,000 T'
Parameters:

number (Union[int, float]) – a positive integer number

Returns:

A string formatted according to the pattern described above.

Return type:

str

fastdev.utils.model_summary.summarize_model(model: torch.nn.Module, max_depth: int = 1)[source]
Parameters:
  • model (torch.nn.Module)

  • max_depth (int)