small changes

This commit is contained in:
OlivierDehaene 2023-02-15 15:52:11 +01:00
parent 603a1b3f48
commit e77d9b86ea
2 changed files with 3 additions and 9 deletions

View File

@ -83,13 +83,10 @@ def convert_files(pt_files: List[Path], st_files: List[Path]):
] ]
# We do this instead of using tqdm because we want to parse the logs with the launcher # We do this instead of using tqdm because we want to parse the logs with the launcher
logger.info(f"Convert: [0/{len(futures)}]")
start_time = time.time() start_time = time.time()
for i, future in enumerate(concurrent.futures.as_completed(futures)): for i, future in enumerate(concurrent.futures.as_completed(futures)):
elapsed = timedelta(seconds=int(time.time() - start_time)) elapsed = timedelta(seconds=int(time.time() - start_time))
remaining = len(futures) - (i + 1) remaining = len(futures) - (i + 1)
eta = (elapsed / (i + 1)) * remaining if remaining > 0 else None eta = (elapsed / (i + 1)) * remaining if remaining > 0 else 0
logger.info(f"Convert: [{i + 1}/{len(futures)}]") logger.info(f"Convert: [{i + 1}/{len(futures)}] -- ETA: {eta}")
if eta is not None:
logger.info(f"ETA: {eta}")

View File

@ -153,17 +153,14 @@ def download_weights(
] ]
# We do this instead of using tqdm because we want to parse the logs with the launcher # We do this instead of using tqdm because we want to parse the logs with the launcher
logger.info(f"Download: [0/{len(futures)}]")
start_time = time.time() start_time = time.time()
files = [] files = []
for i, future in enumerate(concurrent.futures.as_completed(futures)): for i, future in enumerate(concurrent.futures.as_completed(futures)):
elapsed = timedelta(seconds=int(time.time() - start_time)) elapsed = timedelta(seconds=int(time.time() - start_time))
remaining = len(futures) - (i + 1) remaining = len(futures) - (i + 1)
eta = (elapsed / (i + 1)) * remaining if remaining > 0 else None eta = (elapsed / (i + 1)) * remaining if remaining > 0 else 0
logger.info(f"Download: [{i + 1}/{len(futures)}] -- ETA: {eta}") logger.info(f"Download: [{i + 1}/{len(futures)}] -- ETA: {eta}")
if eta is not None:
logger.info(f"ETA: {eta}")
files.append(future.result()) files.append(future.result())
return files return files