ROKO

How to use tqdm? 본문

Develop

How to use tqdm?

RO_KO 2023. 1. 11. 08:57
728x90

tqdm is very useful library who engage in deep learning research.

 

What is tqdm?

tqdm means "progress" in Arabic (taqadum) and is an abbreviation for "I love you so much" in Spanish (te quiero demasiado)

 

We can see progress through progress bar - just wrap any iterable with tqdm!

 

e.g.

# python
# not just "import tqdm"!!!  we use tqdm.tqdm function so "from tqdm import tqdm"
from tqdm import tqdm

for i in tqdm(range(10000)):
	...
    
    
# trange(10000) == tqdm(range(10000))

[Output]

76%|████████████████████████████         | 7568/10000 [00:33<00:10, 229.00it/s]

 

 

It can be also be executed as a module with pipes:

e.g.

#bash
seq 9999999 | tqdm --bytes | wc -l

 


 

Tqdm options

tqdm(...)
  • iterable : interable object, e.g. range(100)
  • desc : show text in front of pregress bar
  • total : int, the numbers of interations
  • leave : bool, default=True, remain progress info
  • ncols : length of progress bar
  • mininterval, maxinterval : update cycle, default -> mininterval=0.1, maxinterval=100
  • miniters : Minimum progress display update interval
  • ascii : If True, then progress bar show as ascii value else graphic pixels
  • intial : start point of progress, default=0
  • bar_format : str

Tqdm functions

  • clear()
  • refresh()

Some tips

- If you use tqdm with log then more easy to understand progress and coding !

- Read some more info about tqdm !

 

More info about tqdm : [link]

728x90

'Develop' 카테고리의 다른 글

Numpy array[::]  (0) 2023.01.17
How to read NVIDIA spec?  (2) 2023.01.11
Pytorch function summary  (0) 2023.01.10
zsh: command not found: conda  (0) 2023.01.05
Comments