Spaces:
Running on Zero
Running on Zero
Download embodied_gen/utils/general.py from HorizonRobotics/EmbodiedGen-Texture-Gen: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/spaces/HorizonRobotics/EmbodiedGen-Texture-Gen/resolve/main/embodied_gen/utils/general.py
- Command line
-
hf download hf://spaces/HorizonRobotics/EmbodiedGen-Texture-Gen/embodied_gen/utils/general.py
-
curl -L -o general.py https://huggingface.co/spaces/HorizonRobotics/EmbodiedGen-Texture-Gen/resolve/main/embodied_gen/utils/general.py
1.48 kB
| 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 | |