Download train.py from OneScience-Group/MatterGen: direct link, hf CLI and curl.
- Browser
- Download file 962 Bytes
-
https://huggingface.co/OneScience-Group/MatterGen/resolve/main/train.py
- Command line
-
hf download hf://OneScience-Group/MatterGen/train.py
-
curl -L -o train.py https://huggingface.co/OneScience-Group/MatterGen/resolve/main/train.py
962 Bytes
| """Train MatterGen with the OneScience materials stack.""" | |
| import os | |
| from datetime import datetime | |
| from pathlib import Path | |
| import hydra | |
| import omegaconf | |
| import torch | |
| from omegaconf import OmegaConf | |
| from model.diffusion.config import Config | |
| from model.diffusion.run import main as run_training | |
| EXAMPLE_DIR = Path(__file__).resolve().parent | |
| os.environ.setdefault( | |
| "OUTPUT_DIR", | |
| str(EXAMPLE_DIR / "outputs" / "train" / datetime.now().strftime("%Y-%m-%d_%H-%M-%S")), | |
| ) | |
| def main(cfg: omegaconf.DictConfig) -> None: | |
| """Resolve the Hydra config and run MatterGen training.""" | |
| torch.set_float32_matmul_precision("high") | |
| config = OmegaConf.merge(OmegaConf.structured(Config), cfg) | |
| OmegaConf.set_readonly(config, True) | |
| print(OmegaConf.to_yaml(cfg, resolve=True)) | |
| run_training(config) | |
| if __name__ == "__main__": | |
| main() | |