Skip to content

Instantly share code, notes, and snippets.

@boychaboy
Created June 29, 2023 07:55
Show Gist options
  • Save boychaboy/5d534c0597aea2105e1e322a8b7948d9 to your computer and use it in GitHub Desktop.
Save boychaboy/5d534c0597aea2105e1e322a8b7948d9 to your computer and use it in GitHub Desktop.
python iteration에서 상태바, 총 소요 시간을 보여주는 기본 코드
import tqdm
start = time.time()
with tqdm.tqdm(total=len(inputs)) as pbar:
for batch_inputs in batch(inputs, BATCH_SIZE):
# do something
pbar.update(len(batch_inputs))
end = time.time()
print(f"Time elapsed: {end-start:.3f} seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment