MCPcopy
hub / github.com/EvolvingLMMs-Lab/lmms-eval / _format_time

Function _format_time

lmms_eval/models/model_utils/progress.py:33–44  ·  view source on GitHub ↗

Format seconds into human-readable time string.

(seconds: float)

Source from the content-addressed store, hash-verified

31
32
33def _format_time(seconds: float) -> str:
34 """Format seconds into human-readable time string."""
35 if seconds < 0 or seconds != seconds: # negative or NaN
36 return "?"
37 if seconds < 60:
38 return f"{seconds:.0f}s"
39 if seconds < 3600:
40 m, s = divmod(int(seconds), 60)
41 return f"{m}m{s:02d}s"
42 h, remainder = divmod(int(seconds), 3600)
43 m, s = divmod(remainder, 60)
44 return f"{h}h{m:02d}m"
45
46
47class SlurmProgress:

Callers 2

updateMethod · 0.85
closeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected