MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / format_with_label

Function format_with_label

tests/helpers.py:71–80  ·  view source on GitHub ↗
(label: str, value: Any)

Source from the content-addressed store, hash-verified

69
70
71def format_with_label(label: str, value: Any) -> str:
72 if isinstance(value, bool):
73 formatted = "T" if value else "F"
74 elif isinstance(value, (list, tuple)) and all(isinstance(v, bool) for v in value):
75 formatted = "".join("T" if b else "F" for b in value)
76 elif isinstance(value, torch.dtype):
77 formatted = describe_dtype(value)
78 else:
79 formatted = str(value)
80 return f"{label}={formatted}"
81
82
83def id_formatter(label: str):

Callers 1

id_formatterFunction · 0.85

Calls 1

describe_dtypeFunction · 0.85

Tested by

no test coverage detected