mirror of
https://github.com/lucidrains/DALLE2-pytorch.git
synced 2025-12-19 09:44:19 +01:00
20 lines
342 B
Python
20 lines
342 B
Python
import time
|
|
|
|
# time helpers
|
|
|
|
class Timer:
|
|
def __init__(self):
|
|
self.reset()
|
|
|
|
def reset(self):
|
|
self.last_time = time.time()
|
|
|
|
def elapsed(self):
|
|
return time.time() - self.last_time
|
|
|
|
# print helpers
|
|
|
|
def print_ribbon(s, symbol = '=', repeat = 40):
|
|
flank = symbol * repeat
|
|
return f'{flank} {s} {flank}'
|