Vision-CAIR
commited on
Commit
•
5a5f255
1
Parent(s):
1119ef9
Upload folder using huggingface_hub
Browse files
logger.py
CHANGED
@@ -13,8 +13,7 @@ from collections import defaultdict, deque
|
|
13 |
import torch
|
14 |
import torch.distributed as dist
|
15 |
|
16 |
-
import
|
17 |
-
|
18 |
|
19 |
class SmoothedValue(object):
|
20 |
"""Track a series of values and provide access to smoothed values over a
|
@@ -38,7 +37,7 @@ class SmoothedValue(object):
|
|
38 |
"""
|
39 |
Warning: does not synchronize the deque!
|
40 |
"""
|
41 |
-
if not
|
42 |
return
|
43 |
t = torch.tensor([self.count, self.total], dtype=torch.float64, device="cuda")
|
44 |
dist.barrier()
|
@@ -189,7 +188,7 @@ class AttrDict(dict):
|
|
189 |
|
190 |
def setup_logger():
|
191 |
logging.basicConfig(
|
192 |
-
level=logging.INFO if
|
193 |
format="%(asctime)s [%(levelname)s] %(message)s",
|
194 |
handlers=[logging.StreamHandler()],
|
195 |
)
|
|
|
13 |
import torch
|
14 |
import torch.distributed as dist
|
15 |
|
16 |
+
from .dist_utils import is_dist_avail_and_initialized,is_main_process
|
|
|
17 |
|
18 |
class SmoothedValue(object):
|
19 |
"""Track a series of values and provide access to smoothed values over a
|
|
|
37 |
"""
|
38 |
Warning: does not synchronize the deque!
|
39 |
"""
|
40 |
+
if not is_dist_avail_and_initialized():
|
41 |
return
|
42 |
t = torch.tensor([self.count, self.total], dtype=torch.float64, device="cuda")
|
43 |
dist.barrier()
|
|
|
188 |
|
189 |
def setup_logger():
|
190 |
logging.basicConfig(
|
191 |
+
level=logging.INFO if is_main_process() else logging.WARN,
|
192 |
format="%(asctime)s [%(levelname)s] %(message)s",
|
193 |
handlers=[logging.StreamHandler()],
|
194 |
)
|