Skip to content

Commit 7c6bae0

Browse files
Remove NCOLS from tqdm (#5804)
* 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>
1 parent 53349da commit 7c6bae0

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

train.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
from utils.callbacks import Callbacks
4040
from utils.datasets import create_dataloader
4141
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)
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)
4646
from utils.loggers import Loggers
4747
from utils.loggers.wandb.wandb_utils import check_wandb_resume
4848
from utils.loss import ComputeLoss
@@ -289,7 +289,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
289289
pbar = enumerate(train_loader)
290290
LOGGER.info(('\n' + '%10s' * 7) % ('Epoch', 'gpu_mem', 'box', 'obj', 'cls', 'labels', 'img_size'))
291291
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
292+
pbar = tqdm(pbar, total=nb, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
293293
optimizer.zero_grad()
294294
for i, (imgs, targets, paths, _) in pbar: # batch -------------------------------------------------------------
295295
ni = i + nb * epoch # number integrated batches (since train start)

utils/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,4 +838,4 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
838838

839839

840840
# Variables
841-
NCOLS = 0 if is_docker() else shutil.get_terminal_size().columns # terminal window size
841+
NCOLS = 0 if is_docker() else shutil.get_terminal_size().columns # terminal window size for tqdm

val.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from models.common import DetectMultiBackend
2727
from utils.callbacks import Callbacks
2828
from utils.datasets import create_dataloader
29-
from utils.general import (LOGGER, NCOLS, box_iou, check_dataset, check_img_size, check_requirements, check_yaml,
29+
from utils.general import (LOGGER, box_iou, check_dataset, check_img_size, check_requirements, check_yaml,
3030
coco80_to_coco91_class, colorstr, increment_path, non_max_suppression, print_args,
3131
scale_coords, xywh2xyxy, xyxy2xywh)
3232
from utils.metrics import ConfusionMatrix, ap_per_class
@@ -164,7 +164,7 @@ def run(data,
164164
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
165165
loss = torch.zeros(3, device=device)
166166
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
167+
pbar = tqdm(dataloader, desc=s, bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') # progress bar
168168
for batch_i, (im, targets, paths, shapes) in enumerate(pbar):
169169
t1 = time_sync()
170170
if pt or engine:

0 commit comments

Comments
 (0)