Download main.py from LDA1020/CodePDE: direct link, hf CLI and curl.
- Browser
- Download file 926 Bytes
-
https://huggingface.co/LDA1020/CodePDE/resolve/main/main.py
- Command line
-
hf download hf://LDA1020/CodePDE/main.py
-
curl -L -o main.py https://huggingface.co/LDA1020/CodePDE/resolve/main/main.py
926 Bytes
| import os | |
| import sys | |
| import hydra | |
| from refine import refine | |
| from repeated_sample import repeated_sample | |
| from funsearch import funsearch | |
| def main(cfg): | |
| print(f'Method: {cfg.method.name}') | |
| print(f'Model name: {cfg.model.name}') | |
| print(f'PDE name: {cfg.pde.name}') | |
| print(f'Working folder: {cfg.working_folder}') | |
| if not os.path.exists(cfg.working_folder): | |
| os.makedirs(cfg.working_folder) | |
| if cfg.redirect_stdout: | |
| sys.stdout = open(os.path.join(cfg.working_folder, 'stdout.txt'), 'w') | |
| if cfg.method.name[:6] == 'refine': | |
| refine(cfg) | |
| elif cfg.method.name == 'repeated_sample': | |
| repeated_sample(cfg) | |
| elif cfg.method.name == 'funsearch': | |
| funsearch(cfg) | |
| else: | |
| raise NotImplementedError(f'Unknown method: {cfg.method.name}') | |
| if __name__ == "__main__": | |
| main() | |