glenn-jocher pre-commit-ci[bot] commited on
Commit
7c6bae0
1 Parent(s): 53349da

Remove NCOLS from tqdm (#5804)

Browse files

* Remove NCOLS from tqdm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Files changed (3) hide show
  1. train.py +5 -5
  2. utils/general.py +1 -1
  3. val.py +2 -2
train.py CHANGED
@@ -39,10 +39,10 @@ from utils.autobatch import check_train_batch_size
39
  from utils.callbacks import Callbacks
40
  from utils.datasets import create_dataloader
41
  from utils.downloads import attempt_download
42
- from utils.general import (LOGGER, NCOLS, check_dataset, check_file, check_git_status, check_img_size,
43
- check_requirements, check_suffix, check_yaml, colorstr, get_latest_run, increment_path,
44
- init_seeds, intersect_dicts, labels_to_class_weights, labels_to_image_weights, methods,
45
- one_cycle, print_args, print_mutation, strip_optimizer)
46
  from utils.loggers import Loggers
47
  from utils.loggers.wandb.wandb_utils import check_wandb_resume
48
  from utils.loss import ComputeLoss
@@ -289,7 +289,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
289
  pbar = enumerate(train_loader)
290
  LOGGER.info(('\n' + '%10s' * 7) % ('Epoch', 'gpu_mem', 'box', 'obj', 'cls', 'labels', 'img_size'))
291
  if RANK in [-1, 0]:
292
- pbar = tqdm(pbar, total=nb, ncols=NCOLS, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
293
  optimizer.zero_grad()
294
  for i, (imgs, targets, paths, _) in pbar: # batch -------------------------------------------------------------
295
  ni = i + nb * epoch # number integrated batches (since train start)
 
39
  from utils.callbacks import Callbacks
40
  from utils.datasets import create_dataloader
41
  from utils.downloads import attempt_download
42
+ from utils.general import (LOGGER, check_dataset, check_file, check_git_status, check_img_size, check_requirements,
43
+ check_suffix, check_yaml, colorstr, get_latest_run, increment_path, init_seeds,
44
+ intersect_dicts, labels_to_class_weights, labels_to_image_weights, methods, one_cycle,
45
+ print_args, print_mutation, strip_optimizer)
46
  from utils.loggers import Loggers
47
  from utils.loggers.wandb.wandb_utils import check_wandb_resume
48
  from utils.loss import ComputeLoss
 
289
  pbar = enumerate(train_loader)
290
  LOGGER.info(('\n' + '%10s' * 7) % ('Epoch', 'gpu_mem', 'box', 'obj', 'cls', 'labels', 'img_size'))
291
  if RANK in [-1, 0]:
292
+ pbar = tqdm(pbar, total=nb, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
293
  optimizer.zero_grad()
294
  for i, (imgs, targets, paths, _) in pbar: # batch -------------------------------------------------------------
295
  ni = i + nb * epoch # number integrated batches (since train start)
utils/general.py CHANGED
@@ -838,4 +838,4 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
838
 
839
 
840
  # Variables
841
- NCOLS = 0 if is_docker() else shutil.get_terminal_size().columns # terminal window size
 
838
 
839
 
840
  # Variables
841
+ NCOLS = 0 if is_docker() else shutil.get_terminal_size().columns # terminal window size for tqdm
val.py CHANGED
@@ -26,7 +26,7 @@ ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative
26
  from models.common import DetectMultiBackend
27
  from utils.callbacks import Callbacks
28
  from utils.datasets import create_dataloader
29
- from utils.general import (LOGGER, NCOLS, box_iou, check_dataset, check_img_size, check_requirements, check_yaml,
30
  coco80_to_coco91_class, colorstr, increment_path, non_max_suppression, print_args,
31
  scale_coords, xywh2xyxy, xyxy2xywh)
32
  from utils.metrics import ConfusionMatrix, ap_per_class
@@ -164,7 +164,7 @@ def run(data,
164
  dt, p, r, f1, mp, mr, map50, map = [0.0, 0.0, 0.0], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
165
  loss = torch.zeros(3, device=device)
166
  jdict, stats, ap, ap_class = [], [], [], []
167
- pbar = tqdm(dataloader, desc=s, ncols=NCOLS, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
168
  for batch_i, (im, targets, paths, shapes) in enumerate(pbar):
169
  t1 = time_sync()
170
  if pt or engine:
 
26
  from models.common import DetectMultiBackend
27
  from utils.callbacks import Callbacks
28
  from utils.datasets import create_dataloader
29
+ from utils.general import (LOGGER, box_iou, check_dataset, check_img_size, check_requirements, check_yaml,
30
  coco80_to_coco91_class, colorstr, increment_path, non_max_suppression, print_args,
31
  scale_coords, xywh2xyxy, xyxy2xywh)
32
  from utils.metrics import ConfusionMatrix, ap_per_class
 
164
  dt, p, r, f1, mp, mr, map50, map = [0.0, 0.0, 0.0], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
165
  loss = torch.zeros(3, device=device)
166
  jdict, stats, ap, ap_class = [], [], [], []
167
+ pbar = tqdm(dataloader, desc=s, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
168
  for batch_i, (im, targets, paths, shapes) in enumerate(pbar):
169
  t1 = time_sync()
170
  if pt or engine: