| 41 | return hparams |
| 42 | |
| 43 | def parse_args(): |
| 44 | parser = argparse.ArgumentParser() |
| 45 | |
| 46 | # Add your arguments here |
| 47 | parser.add_argument('--dataset', default="landoceandataset", type=str, choices=["checkerboard"]) |
| 48 | parser.add_argument('--pe', default=["sphericalharmonics"], type=str, nargs='+', help='positional encoder(s)', choices=["sphericalharmonics", "theory", "grid", "spherec", "spherecplus", "direct", "cartesian3d", "wrap", "spherem", "spheremplus"]) |
| 49 | parser.add_argument('--nn', default=["siren"], type=str, nargs='+', help='neural network(s)', choices=["linear", "siren", "fcnet", "mlp"]) |
| 50 | |
| 51 | # optional configs |
| 52 | parser.add_argument('--save-model', action="store_true", help='save model checkpoint to results-dir') |
| 53 | parser.add_argument('--log-wandb', action="store_true", help='log run to wandb') |
| 54 | parser.add_argument('--hparams', default="hparams.yaml", type=str, help='hypereparameter yaml') |
| 55 | parser.add_argument('--results-dir', default="results/train", type=str, help='results directory') |
| 56 | parser.add_argument('--expname', default=None, type=str, help='experiment name. If specified, saves results in subfolder') |
| 57 | parser.add_argument('--seed', default=0, type=int, help='global random seed') |
| 58 | parser.add_argument('--max-epochs', default=None, type=int, help='maximum number of epochs. If unset, uses value in hparams.yaml') |
| 59 | parser.add_argument('--gpus', default='-1', type=int, nargs='+', help='which gpus to use; if unset uses -1 which we map to auto') |
| 60 | |
| 61 | parser.add_argument('-r', '--resume-ckpt-from-results-dir', action="store_true", |
| 62 | help="searches through provided results dir and resumes from suitable checkpoint " |
| 63 | "that matches pe and nn") |
| 64 | parser.add_argument('--matplotlib', action="store_true", |
| 65 | help="plot maps with matplotlib") |
| 66 | parser.add_argument('--matplotlib-show', action="store_true", |
| 67 | help="shows matplotlib plots (can cause freezing when called remotely)") |
| 68 | |
| 69 | # checkerboard |
| 70 | parser.add_argument('--checkerboard-scale', default=1, type=float, help="scales the number of support points for the checkerboard dataset (specificed in hparams.yaml) " |
| 71 | "by this factor. This is useful to vary the scale to test different resolutions of encoders") |
| 72 | |
| 73 | # overwrite certain hparams |
| 74 | parser.add_argument('--legendre-polys', default=None, type=int) |
| 75 | parser.add_argument('--min-radius', default=None, type=float) |
| 76 | parser.add_argument('--harmonics-calculation', default="analytic", type=str, choices=["analytic", "closed-form", "discretized"], |
| 77 | help='calculation of spherical harmonics: ' + |
| 78 | 'analytic uses pre-computed equations. This is exact, but works only up to degree 50, ' + |
| 79 | 'closed-form uses one equation but is computationally slower (especially for high degrees)' + |
| 80 | 'discretized pre-computes harmonics on a grid and interpolates these later') |
| 81 | args = parser.parse_args() |
| 82 | return args |
| 83 | |
| 84 | def parse_resultsdir(args): |
| 85 | if args.expname is None: |