Spaces:
Running on Zero
Running on Zero
File size: 1,477 Bytes
509565d | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import logging
import random
import warnings
import numpy as np
import torch
__all__ = ["filter_warnings", "set_seed"]
def filter_warnings() -> None:
warnings.filterwarnings("ignore", category=FutureWarning)
warnings.filterwarnings(
"ignore",
message="To copy construct from a tensor.*",
category=UserWarning,
)
warnings.filterwarnings(
"ignore",
message="Unable to load pointnet2_ops cpp extension.*",
category=UserWarning,
)
warnings.filterwarnings(
"ignore",
message="TORCH_CUDA_ARCH_LIST is not set.*",
category=UserWarning,
)
warnings.filterwarnings(
"ignore",
message="The given buffer is not writable.*",
category=UserWarning,
)
warnings.filterwarnings(
"ignore",
message="Using torch.cross without specifying the dim arg is deprecated.*",
category=UserWarning,
)
warnings.filterwarnings(
"ignore",
message="torch.meshgrid: in an upcoming release.*",
category=UserWarning,
)
logging.getLogger("grasp_gen.dataset.renderer").setLevel(logging.ERROR)
def set_seed(seed: int) -> None:
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
|