Skip to content

Commit 0bb44f3

Browse files
njzjzwanghan-iapcm
andauthored
drop tqdm (#3194)
per discussion. Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu> Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
1 parent 5b64d5c commit 0bb44f3

5 files changed

Lines changed: 20 additions & 40 deletions

File tree

backend/dynamic_metadata.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,5 @@ def dynamic_metadata(
9090
],
9191
"torch": [
9292
"torch>=2a",
93-
"tqdm",
9493
],
9594
}

deepmd/pt/train/training.py

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
import numpy as np
1616
import torch
17-
from tqdm import (
18-
tqdm,
19-
)
20-
from tqdm.contrib.logging import (
21-
logging_redirect_tqdm,
22-
)
2317

2418
from deepmd.common import (
2519
symlink_prefix_files,
@@ -47,7 +41,6 @@
4741
)
4842
from deepmd.pt.utils.env import (
4943
DEVICE,
50-
DISABLE_TQDM,
5144
JIT,
5245
LOCAL_RANK,
5346
NUM_WORKERS,
@@ -662,29 +655,24 @@ def log_loss_valid(_task_key="Default"):
662655
f.write(str(self.latest_model))
663656

664657
self.t0 = time.time()
665-
with logging_redirect_tqdm():
666-
for step_id in tqdm(
667-
range(self.num_steps),
668-
disable=(bool(dist.get_rank()) if dist.is_initialized() else False)
669-
or DISABLE_TQDM,
670-
): # set to None to disable on non-TTY; disable on not rank 0
671-
if step_id < self.start_step:
672-
continue
673-
if self.multi_task:
674-
chosen_index_list = dp_random.choice(
675-
np.arange(self.num_model),
676-
p=np.array(self.model_prob),
677-
size=self.world_size,
678-
replace=True,
679-
)
680-
assert chosen_index_list.size == self.world_size
681-
model_index = chosen_index_list[self.rank]
682-
model_key = self.model_keys[model_index]
683-
else:
684-
model_key = "Default"
685-
step(step_id, model_key)
686-
if JIT:
687-
break
658+
for step_id in range(self.num_steps):
659+
if step_id < self.start_step:
660+
continue
661+
if self.multi_task:
662+
chosen_index_list = dp_random.choice(
663+
np.arange(self.num_model),
664+
p=np.array(self.model_prob),
665+
size=self.world_size,
666+
replace=True,
667+
)
668+
assert chosen_index_list.size == self.world_size
669+
model_index = chosen_index_list[self.rank]
670+
model_key = self.model_keys[model_index]
671+
else:
672+
model_key = "Default"
673+
step(step_id, model_key)
674+
if JIT:
675+
break
688676

689677
if (
690678
self.rank == 0 or dist.get_rank() == 0

deepmd/pt/utils/dataset.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
from torch.utils.data import (
1414
Dataset,
1515
)
16-
from tqdm import (
17-
trange,
18-
)
1916

2017
from deepmd.pt.utils import (
2118
dp_random,
@@ -506,7 +503,7 @@ def preprocess(self, batch):
506503
assert batch["atype"].max() < len(self._type_map)
507504
nlist, nlist_loc, nlist_type, shift, mapping = [], [], [], [], []
508505

509-
for sid in trange(n_frames, disable=env.DISABLE_TQDM):
506+
for sid in range(n_frames):
510507
region = Region3D(box[sid])
511508
nloc = atype[sid].shape[0]
512509
_coord = normalize_coord(coord[sid], region, nloc)

deepmd/pt/utils/env.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
GLOBAL_NP_FLOAT_PRECISION = getattr(np, PRECISION)
99
GLOBAL_PT_FLOAT_PRECISION = getattr(torch, PRECISION)
1010
GLOBAL_ENER_FLOAT_PRECISION = getattr(np, PRECISION)
11-
DISABLE_TQDM = os.environ.get("DISABLE_TQDM", False)
1211
SAMPLER_RECORD = os.environ.get("SAMPLER_RECORD", False)
1312
try:
1413
# only linux

deepmd/pt/utils/stat.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
import numpy as np
55
import torch
6-
from tqdm import (
7-
trange,
8-
)
96

107
from deepmd.pt.utils import (
118
env,
@@ -40,7 +37,7 @@ def make_stat_input(datasets, dataloaders, nbatches):
4037
if datasets[0].mixed_type:
4138
keys.append("real_natoms_vec")
4239
logging.info(f"Packing data for statistics from {len(datasets)} systems")
43-
for i in trange(len(datasets), disable=env.DISABLE_TQDM):
40+
for i in range(len(datasets)):
4441
sys_stat = {key: [] for key in keys}
4542
iterator = iter(dataloaders[i])
4643
for _ in range(nbatches):

0 commit comments

Comments
 (0)