-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathperact_config.py
More file actions
32 lines (22 loc) · 804 Bytes
/
peract_config.py
File metadata and controls
32 lines (22 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
System configuration for peract
"""
import os
import logging
import torch.multiprocessing as mp
def config_logging(logging_level=logging.INFO, reset=False):
if reset:
root = logging.getLogger()
list(map(root.removeHandler, root.handlers))
list(map(root.removeFilter, root.filters))
from rich.logging import RichHandler
logging.basicConfig(level=logging_level, handlers=[RichHandler()])
def on_init():
config_logging(logging.INFO)
logging.debug("Configuring environment.")
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
mp.set_start_method("spawn", force=True)
mp.set_sharing_strategy("file_system")
def on_config(cfg):
os.environ["MASTER_ADDR"] = str(cfg.ddp.master_addr)
os.environ["MASTER_PORT"] = str(cfg.ddp.master_port)