diff --git a/_downloads/5fdddbed2260616231dbf7b0d94bb665/train.txt b/_downloads/5fdddbed2260616231dbf7b0d94bb665/train.txt new file mode 100644 index 000000000..5c5ae5b55 --- /dev/null +++ b/_downloads/5fdddbed2260616231dbf7b0d94bb665/train.txt @@ -0,0 +1,224 @@ +2024-05-17 17:52:21 (INFO): Project root: /home/runner/work/fairchem/fairchem/src/fairchem +2024-05-17 17:52:23 (WARNING): Detected old config, converting to new format. Consider updating to avoid potential incompatibilities. +2024-05-17 17:52:23 (INFO): amp: true +cmd: + checkpoint_dir: fine-tuning/checkpoints/2024-05-17-17-53-04-ft-oxides + commit: 00de11a + identifier: ft-oxides + logs_dir: fine-tuning/logs/tensorboard/2024-05-17-17-53-04-ft-oxides + print_every: 10 + results_dir: fine-tuning/results/2024-05-17-17-53-04-ft-oxides + seed: 0 + timestamp_id: 2024-05-17-17-53-04-ft-oxides + version: 0.1.dev1+g00de11a +dataset: + a2g_args: + r_energy: true + r_forces: true + format: ase_db + key_mapping: + force: forces + y: energy + src: train.db +eval_metrics: + metrics: + energy: + - mae + forces: + - forcesx_mae + - forcesy_mae + - forcesz_mae + - mae + - cosine_similarity + - magnitude_error + misc: + - energy_forces_within_threshold + primary_metric: forces_mae +gpus: 0 +logger: tensorboard +loss_fns: +- energy: + coefficient: 1 + fn: mae +- forces: + coefficient: 1 + fn: l2mae +model: gemnet_oc +model_attributes: + activation: silu + atom_edge_interaction: true + atom_interaction: true + cbf: + name: spherical_harmonics + cutoff: 12.0 + cutoff_aeaint: 12.0 + cutoff_aint: 12.0 + cutoff_qint: 12.0 + direct_forces: true + edge_atom_interaction: true + emb_size_aint_in: 64 + emb_size_aint_out: 64 + emb_size_atom: 256 + emb_size_cbf: 16 + emb_size_edge: 512 + emb_size_quad_in: 32 + emb_size_quad_out: 32 + emb_size_rbf: 16 + emb_size_sbf: 32 + emb_size_trip_in: 64 + emb_size_trip_out: 64 + envelope: + exponent: 5 + name: polynomial + extensive: true + forces_coupled: false + max_neighbors: 30 + max_neighbors_aeaint: 20 + max_neighbors_aint: 1000 + max_neighbors_qint: 8 + num_after_skip: 2 + num_atom: 3 + num_atom_emb_layers: 2 + num_before_skip: 2 + num_blocks: 4 + num_concat: 1 + num_global_out_layers: 2 + num_output_afteratom: 3 + num_radial: 128 + num_spherical: 7 + otf_graph: true + output_init: HeOrthogonal + qint_tags: + - 1 + - 2 + quad_interaction: true + rbf: + name: gaussian + regress_forces: true + sbf: + name: legendre_outer + symmetric_edge_symmetrization: false +noddp: false +optim: + batch_size: 4 + clip_grad_norm: 10 + ema_decay: 0.999 + energy_coefficient: 1 + eval_batch_size: 16 + eval_every: 10 + factor: 0.8 + force_coefficient: 1 + load_balancing: atoms + loss_energy: mae + lr_initial: 0.0005 + max_epochs: 1 + mode: min + num_workers: 2 + optimizer: AdamW + optimizer_params: + amsgrad: true + patience: 3 + scheduler: ReduceLROnPlateau + weight_decay: 0 +outputs: + energy: + level: system + forces: + eval_on_free_atoms: true + level: atom + train_on_free_atoms: false +slurm: {} +task: + dataset: ase_db +test_dataset: + a2g_args: + r_energy: false + r_forces: false + src: test.db +trainer: ocp +val_dataset: + a2g_args: + r_energy: true + r_forces: true + src: val.db + +2024-05-17 17:52:23 (INFO): Loading dataset: ase_db +2024-05-17 17:52:23 (INFO): rank: 0: Sampler created... +2024-05-17 17:52:23 (INFO): Batch balancing is disabled for single GPU training. +2024-05-17 17:52:23 (INFO): rank: 0: Sampler created... +2024-05-17 17:52:23 (INFO): Batch balancing is disabled for single GPU training. +2024-05-17 17:52:23 (INFO): rank: 0: Sampler created... +2024-05-17 17:52:23 (INFO): Batch balancing is disabled for single GPU training. +2024-05-17 17:52:23 (INFO): Loading model: gemnet_oc +2024-05-17 17:52:23 (WARNING): Unrecognized arguments: ['symmetric_edge_symmetrization'] +2024-05-17 17:52:25 (INFO): Loaded GemNetOC with 38864438 parameters. +2024-05-17 17:52:25 (WARNING): Model gradient logging to tensorboard not yet supported. +2024-05-17 17:52:25 (WARNING): Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated. +2024-05-17 17:52:25 (INFO): Loading checkpoint from: /tmp/ocp_checkpoints/gnoc_oc22_oc20_all_s2ef.pt +2024-05-17 17:52:25 (INFO): Overwriting scaling factors with those loaded from checkpoint. If you're generating predictions with a pretrained checkpoint, this is the correct behavior. To disable this, delete `scale_dict` from the checkpoint. +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +2024-05-17 17:52:49 (INFO): energy_forces_within_threshold: 0.00e+00, energy_mae: 6.77e+00, forcesx_mae: 4.11e-02, forcesy_mae: 3.63e-02, forcesz_mae: 5.26e-02, forces_mae: 4.33e-02, forces_cosine_similarity: 8.24e-02, forces_magnitude_error: 7.42e-02, loss: 6.86e+00, lr: 5.00e-04, epoch: 1.69e-01, step: 1.00e+01 +2024-05-17 17:52:50 (INFO): Evaluating on val. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:04<00:04, 4.69s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.69s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.89s/it] +2024-05-17 17:52:57 (INFO): energy_forces_within_threshold: 0.0000, energy_mae: 8.7335, forcesx_mae: 0.0231, forcesy_mae: 0.0188, forcesz_mae: 0.0198, forces_mae: 0.0206, forces_cosine_similarity: -0.0317, forces_magnitude_error: 0.0290, loss: 8.6592, epoch: 0.1695 +2024-05-17 17:52:58 (INFO): Predicting on test. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:02<00:02, 2.99s/it] device 0: 100%|██████████| 2/2 [00:05<00:00, 2.95s/it] device 0: 100%|██████████| 2/2 [00:06<00:00, 3.02s/it] +2024-05-17 17:53:04 (INFO): Writing results to fine-tuning/results/2024-05-17-17-53-04-ft-oxides/ocp_predictions.npz +2024-05-17 17:53:29 (INFO): energy_forces_within_threshold: 0.00e+00, energy_mae: 1.07e+01, forcesx_mae: 2.63e-02, forcesy_mae: 1.76e-02, forcesz_mae: 1.90e-02, forces_mae: 2.10e-02, forces_cosine_similarity: -3.68e-02, forces_magnitude_error: 2.25e-02, loss: 1.07e+01, lr: 5.00e-04, epoch: 3.39e-01, step: 2.00e+01 +2024-05-17 17:53:31 (INFO): Evaluating on val. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:04<00:04, 4.50s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.69s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.90s/it] +2024-05-17 17:53:39 (INFO): energy_forces_within_threshold: 0.0000, energy_mae: 2.6897, forcesx_mae: 0.0235, forcesy_mae: 0.0180, forcesz_mae: 0.0129, forces_mae: 0.0181, forces_cosine_similarity: 0.0681, forces_magnitude_error: 0.0215, loss: 2.7173, epoch: 0.3390 +2024-05-17 17:53:39 (INFO): Predicting on test. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:03<00:03, 3.08s/it] device 0: 100%|██████████| 2/2 [00:05<00:00, 2.85s/it] device 0: 100%|██████████| 2/2 [00:05<00:00, 2.96s/it] +2024-05-17 17:53:45 (INFO): Writing results to fine-tuning/results/2024-05-17-17-53-04-ft-oxides/ocp_predictions.npz +2024-05-17 17:54:04 (INFO): energy_forces_within_threshold: 0.00e+00, energy_mae: 4.89e+00, forcesx_mae: 1.80e-02, forcesy_mae: 1.50e-02, forcesz_mae: 2.08e-02, forces_mae: 1.79e-02, forces_cosine_similarity: -4.57e-03, forces_magnitude_error: 2.32e-02, loss: 4.93e+00, lr: 5.00e-04, epoch: 5.08e-01, step: 3.00e+01 +2024-05-17 17:54:06 (INFO): Evaluating on val. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:04<00:04, 4.63s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.56s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.82s/it] +2024-05-17 17:54:14 (INFO): energy_forces_within_threshold: 0.0000, energy_mae: 4.6175, forcesx_mae: 0.0263, forcesy_mae: 0.0286, forcesz_mae: 0.0325, forces_mae: 0.0291, forces_cosine_similarity: -0.0261, forces_magnitude_error: 0.0409, loss: 4.7090, epoch: 0.5085 +2024-05-17 17:54:38 (INFO): energy_forces_within_threshold: 0.00e+00, energy_mae: 3.94e+00, forcesx_mae: 3.14e-02, forcesy_mae: 2.66e-02, forcesz_mae: 3.14e-02, forces_mae: 2.98e-02, forces_cosine_similarity: -1.45e-01, forces_magnitude_error: 4.03e-02, loss: 4.00e+00, lr: 5.00e-04, epoch: 6.78e-01, step: 4.00e+01 +2024-05-17 17:54:40 (INFO): Evaluating on val. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:04<00:04, 4.53s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.50s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.75s/it] +2024-05-17 17:54:48 (INFO): energy_forces_within_threshold: 0.0000, energy_mae: 1.7784, forcesx_mae: 0.0119, forcesy_mae: 0.0114, forcesz_mae: 0.0122, forces_mae: 0.0118, forces_cosine_similarity: 0.0522, forces_magnitude_error: 0.0146, loss: 1.8084, epoch: 0.6780 +2024-05-17 17:54:48 (INFO): Predicting on test. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:03<00:03, 3.23s/it] device 0: 100%|██████████| 2/2 [00:05<00:00, 2.93s/it] device 0: 100%|██████████| 2/2 [00:06<00:00, 3.07s/it] +2024-05-17 17:54:55 (INFO): Writing results to fine-tuning/results/2024-05-17-17-53-04-ft-oxides/ocp_predictions.npz +2024-05-17 17:55:15 (INFO): energy_forces_within_threshold: 0.00e+00, energy_mae: 3.88e+00, forcesx_mae: 2.33e-02, forcesy_mae: 2.34e-02, forcesz_mae: 2.19e-02, forces_mae: 2.29e-02, forces_cosine_similarity: 6.18e-03, forces_magnitude_error: 2.81e-02, loss: 3.93e+00, lr: 5.00e-04, epoch: 8.47e-01, step: 5.00e+01 +2024-05-17 17:55:17 (INFO): Evaluating on val. + device 0: 0%| | 0/2 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 50%|█████ | 1/2 [00:04<00:04, 4.88s/it] device 0: 100%|██████████| 2/2 [00:07<00:00, 3.75s/it] device 0: 100%|██████████| 2/2 [00:08<00:00, 4.04s/it] +2024-05-17 17:55:25 (INFO): energy_forces_within_threshold: 0.0000, energy_mae: 3.3263, forcesx_mae: 0.0122, forcesy_mae: 0.0134, forcesz_mae: 0.0110, forces_mae: 0.0122, forces_cosine_similarity: 0.0079, forces_magnitude_error: 0.0148, loss: 3.3173, epoch: 0.8475 +2024-05-17 17:55:44 (INFO): Total time taken: 198.9398910999298 diff --git a/_downloads/819e10305ddd6839cd7da05935b17060/mass-inference.txt b/_downloads/819e10305ddd6839cd7da05935b17060/mass-inference.txt new file mode 100644 index 000000000..70d4e0671 --- /dev/null +++ b/_downloads/819e10305ddd6839cd7da05935b17060/mass-inference.txt @@ -0,0 +1,143 @@ +2024-05-17 17:57:43 (INFO): Project root: /home/runner/work/fairchem/fairchem/src/fairchem +2024-05-17 17:57:44 (WARNING): Detected old config, converting to new format. Consider updating to avoid potential incompatibilities. +2024-05-17 17:57:44 (INFO): amp: true +cmd: + checkpoint_dir: ./checkpoints/2024-05-17-17-57-20 + commit: 00de11a + identifier: '' + logs_dir: ./logs/tensorboard/2024-05-17-17-57-20 + print_every: 10 + results_dir: ./results/2024-05-17-17-57-20 + seed: 0 + timestamp_id: 2024-05-17-17-57-20 + version: 0.1.dev1+g00de11a +dataset: + a2g_args: + r_energy: false + r_forces: false + format: ase_db + key_mapping: + force: forces + y: energy + select_args: + selection: natoms>5,xc=PBE + src: data.db +eval_metrics: + metrics: + energy: + - mae + forces: + - forcesx_mae + - forcesy_mae + - forcesz_mae + - mae + - cosine_similarity + - magnitude_error + misc: + - energy_forces_within_threshold + primary_metric: forces_mae +gpus: 0 +logger: tensorboard +loss_fns: +- energy: + coefficient: 1 + fn: mae +- forces: + coefficient: 1 + fn: l2mae +model: gemnet_t +model_attributes: + activation: silu + cbf: + name: spherical_harmonics + cutoff: 6.0 + direct_forces: true + emb_size_atom: 512 + emb_size_bil_trip: 64 + emb_size_cbf: 16 + emb_size_edge: 512 + emb_size_rbf: 16 + emb_size_trip: 64 + envelope: + exponent: 5 + name: polynomial + extensive: true + max_neighbors: 50 + num_after_skip: 2 + num_atom: 3 + num_before_skip: 1 + num_blocks: 3 + num_concat: 1 + num_radial: 128 + num_spherical: 7 + otf_graph: true + output_init: HeOrthogonal + rbf: + name: gaussian + regress_forces: true +noddp: false +optim: + batch_size: 16 + clip_grad_norm: 10 + ema_decay: 0.999 + energy_coefficient: 1 + eval_batch_size: 16 + eval_every: 5000 + force_coefficient: 1 + loss_energy: mae + loss_force: atomwisel2 + lr_gamma: 0.8 + lr_initial: 0.0005 + lr_milestones: + - 64000 + - 96000 + - 128000 + - 160000 + - 192000 + max_epochs: 80 + num_workers: 2 + optimizer: AdamW + optimizer_params: + amsgrad: true + warmup_steps: -1 +outputs: + energy: + level: system + forces: + eval_on_free_atoms: true + level: atom + train_on_free_atoms: false +slurm: {} +task: + dataset: ase_db + prediction_dtype: float32 +test_dataset: + a2g_args: + r_energy: false + r_forces: false + select_args: + selection: natoms>5,xc=PBE + src: data.db +trainer: ocp +val_dataset: null + +2024-05-17 17:57:44 (INFO): Loading dataset: ase_db +2024-05-17 17:57:44 (INFO): rank: 0: Sampler created... +2024-05-17 17:57:44 (INFO): Batch balancing is disabled for single GPU training. +2024-05-17 17:57:44 (INFO): rank: 0: Sampler created... +2024-05-17 17:57:44 (INFO): Batch balancing is disabled for single GPU training. +2024-05-17 17:57:44 (INFO): Loading model: gemnet_t +2024-05-17 17:57:46 (INFO): Loaded GemNetT with 31671825 parameters. +2024-05-17 17:57:46 (WARNING): Model gradient logging to tensorboard not yet supported. +2024-05-17 17:57:46 (INFO): Loading checkpoint from: /tmp/ocp_checkpoints/gndt_oc22_all_s2ef.pt +2024-05-17 17:57:46 (INFO): Overwriting scaling factors with those loaded from checkpoint. If you're generating predictions with a pretrained checkpoint, this is the correct behavior. To disable this, delete `scale_dict` from the checkpoint. +2024-05-17 17:57:46 (WARNING): Scale factor comment not found in model +2024-05-17 17:57:46 (INFO): Predicting on test. + device 0: 0%| | 0/3 [00:00, ?it/s]/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) +/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch_geometric/data/collate.py:145: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() + storage = elem.storage()._new_shared(numel) + device 0: 33%|███████████▋ | 1/3 [00:03<00:07, 3.71s/it] device 0: 67%|███████████████████████▎ | 2/3 [00:05<00:02, 2.82s/it] device 0: 100%|███████████████████████████████████| 3/3 [00:08<00:00, 2.77s/it] device 0: 100%|███████████████████████████████████| 3/3 [00:08<00:00, 2.88s/it] +2024-05-17 17:57:55 (INFO): Writing results to ./results/2024-05-17-17-57-20/ocp_predictions.npz +2024-05-17 17:57:55 (INFO): Total time taken: 8.80666995048523 +Elapsed time = 15.0 seconds diff --git a/_images/01e81f6c3f48ab7afff5b938d0c6a052f8635f048b5b7f495a17409cb544df72.png b/_images/01e81f6c3f48ab7afff5b938d0c6a052f8635f048b5b7f495a17409cb544df72.png new file mode 100644 index 000000000..22d68d577 Binary files /dev/null and b/_images/01e81f6c3f48ab7afff5b938d0c6a052f8635f048b5b7f495a17409cb544df72.png differ diff --git a/_images/170bc9949a589c01b9dd86594314ef1566bd2800215484dd031eacea9d34b8ed.png b/_images/170bc9949a589c01b9dd86594314ef1566bd2800215484dd031eacea9d34b8ed.png new file mode 100644 index 000000000..796c5a501 Binary files /dev/null and b/_images/170bc9949a589c01b9dd86594314ef1566bd2800215484dd031eacea9d34b8ed.png differ diff --git a/_images/1886195143c6c8d57e07a010567f9bb54c1798d26a22825456aba891bc405e78.png b/_images/1886195143c6c8d57e07a010567f9bb54c1798d26a22825456aba891bc405e78.png new file mode 100644 index 000000000..9a13303a4 Binary files /dev/null and b/_images/1886195143c6c8d57e07a010567f9bb54c1798d26a22825456aba891bc405e78.png differ diff --git a/_images/306e207eace1dbdfee27c032ab03b020846de4ddeb72841a5ad724eac484b1f4.png b/_images/306e207eace1dbdfee27c032ab03b020846de4ddeb72841a5ad724eac484b1f4.png new file mode 100644 index 000000000..53af529a0 Binary files /dev/null and b/_images/306e207eace1dbdfee27c032ab03b020846de4ddeb72841a5ad724eac484b1f4.png differ diff --git a/_images/366dcb1f0d2763d7437d3b5b666ebfda153643d4b11dc71a09f6161ce695c67c.png b/_images/366dcb1f0d2763d7437d3b5b666ebfda153643d4b11dc71a09f6161ce695c67c.png new file mode 100644 index 000000000..976b5917e Binary files /dev/null and b/_images/366dcb1f0d2763d7437d3b5b666ebfda153643d4b11dc71a09f6161ce695c67c.png differ diff --git a/_images/3af36046407c85efd47c685c029d67f42a28c228c33b7b8a35c33f393440382a.png b/_images/3af36046407c85efd47c685c029d67f42a28c228c33b7b8a35c33f393440382a.png new file mode 100644 index 000000000..107c6974e Binary files /dev/null and b/_images/3af36046407c85efd47c685c029d67f42a28c228c33b7b8a35c33f393440382a.png differ diff --git a/_images/4bace82b10c623914f65162c41715b5dfcc194c1569698d06031d1f715ccc1e4.png b/_images/4bace82b10c623914f65162c41715b5dfcc194c1569698d06031d1f715ccc1e4.png new file mode 100644 index 000000000..fa074fa31 Binary files /dev/null and b/_images/4bace82b10c623914f65162c41715b5dfcc194c1569698d06031d1f715ccc1e4.png differ diff --git a/_images/50c8e6d9d4ff36851865c963e5b0dbec8644e6b8165949be66d93ad908a3a94c.png b/_images/50c8e6d9d4ff36851865c963e5b0dbec8644e6b8165949be66d93ad908a3a94c.png new file mode 100644 index 000000000..ecf54428e Binary files /dev/null and b/_images/50c8e6d9d4ff36851865c963e5b0dbec8644e6b8165949be66d93ad908a3a94c.png differ diff --git a/_images/603a3f197485612e5d2d7f77aef8972195897bccb91b0077121a68d6755c44fd.png b/_images/603a3f197485612e5d2d7f77aef8972195897bccb91b0077121a68d6755c44fd.png new file mode 100644 index 000000000..616d2955f Binary files /dev/null and b/_images/603a3f197485612e5d2d7f77aef8972195897bccb91b0077121a68d6755c44fd.png differ diff --git a/_images/643db0cf71f60bbef7025b3f50dfab282da4371e89979a0744574aaa167e16fc.png b/_images/643db0cf71f60bbef7025b3f50dfab282da4371e89979a0744574aaa167e16fc.png new file mode 100644 index 000000000..a519c9c5a Binary files /dev/null and b/_images/643db0cf71f60bbef7025b3f50dfab282da4371e89979a0744574aaa167e16fc.png differ diff --git a/_images/6a5800b612d2be5c9576cda60c4f84e52cbeee8ab9c16e8abc25a1c42d77bf2e.png b/_images/6a5800b612d2be5c9576cda60c4f84e52cbeee8ab9c16e8abc25a1c42d77bf2e.png new file mode 100644 index 000000000..95e8495a4 Binary files /dev/null and b/_images/6a5800b612d2be5c9576cda60c4f84e52cbeee8ab9c16e8abc25a1c42d77bf2e.png differ diff --git a/_images/779c250f6bf7aaa03eef896ef1541e648ebf742911fe25095bde7b712d7234d4.png b/_images/779c250f6bf7aaa03eef896ef1541e648ebf742911fe25095bde7b712d7234d4.png new file mode 100644 index 000000000..e3e80d12f Binary files /dev/null and b/_images/779c250f6bf7aaa03eef896ef1541e648ebf742911fe25095bde7b712d7234d4.png differ diff --git a/_images/88ead5bbd89bc50c23bfe01328aaa56af0a05a83b148ec0823e6f4c10cf0cd88.png b/_images/88ead5bbd89bc50c23bfe01328aaa56af0a05a83b148ec0823e6f4c10cf0cd88.png new file mode 100644 index 000000000..9ae7e37b9 Binary files /dev/null and b/_images/88ead5bbd89bc50c23bfe01328aaa56af0a05a83b148ec0823e6f4c10cf0cd88.png differ diff --git a/_images/8f0c9791161c339543bda4170c3f954270bca8b6e60d88b947cc42c8e7018929.png b/_images/8f0c9791161c339543bda4170c3f954270bca8b6e60d88b947cc42c8e7018929.png new file mode 100644 index 000000000..ba89a830c Binary files /dev/null and b/_images/8f0c9791161c339543bda4170c3f954270bca8b6e60d88b947cc42c8e7018929.png differ diff --git a/_images/90530c0fb25b9caa530cc02502a659b784f34bf0b8ebdceb934bee7ddc222d55.png b/_images/90530c0fb25b9caa530cc02502a659b784f34bf0b8ebdceb934bee7ddc222d55.png new file mode 100644 index 000000000..bcc5c4700 Binary files /dev/null and b/_images/90530c0fb25b9caa530cc02502a659b784f34bf0b8ebdceb934bee7ddc222d55.png differ diff --git a/_images/91047de027f6044074d02e1daa405a2fef563d024b57288137bc0adf4344b0b9.png b/_images/91047de027f6044074d02e1daa405a2fef563d024b57288137bc0adf4344b0b9.png new file mode 100644 index 000000000..55dbe505d Binary files /dev/null and b/_images/91047de027f6044074d02e1daa405a2fef563d024b57288137bc0adf4344b0b9.png differ diff --git a/_images/91fcdb74c7a32cfd906c08e7eda163b036b5855ad498bbc2af892fa1eecc1acc.png b/_images/91fcdb74c7a32cfd906c08e7eda163b036b5855ad498bbc2af892fa1eecc1acc.png new file mode 100644 index 000000000..9678f123c Binary files /dev/null and b/_images/91fcdb74c7a32cfd906c08e7eda163b036b5855ad498bbc2af892fa1eecc1acc.png differ diff --git a/_images/94b675b655200519baaacdd72a4fb6b0f7a36c57d7a4025b34de029233d8d3f8.png b/_images/94b675b655200519baaacdd72a4fb6b0f7a36c57d7a4025b34de029233d8d3f8.png new file mode 100644 index 000000000..9eead9f4e Binary files /dev/null and b/_images/94b675b655200519baaacdd72a4fb6b0f7a36c57d7a4025b34de029233d8d3f8.png differ diff --git a/_images/97bae66afd16160f960e71dabd2e5f1bf7353dec7684a664b9bf1567a66cb8f8.png b/_images/97bae66afd16160f960e71dabd2e5f1bf7353dec7684a664b9bf1567a66cb8f8.png new file mode 100644 index 000000000..caec71c18 Binary files /dev/null and b/_images/97bae66afd16160f960e71dabd2e5f1bf7353dec7684a664b9bf1567a66cb8f8.png differ diff --git a/_images/a805497531c4318bd9c1de44a25bad55c2a04c8af86172257c92af81de2ee1dd.png b/_images/a805497531c4318bd9c1de44a25bad55c2a04c8af86172257c92af81de2ee1dd.png new file mode 100644 index 000000000..7089b5c38 Binary files /dev/null and b/_images/a805497531c4318bd9c1de44a25bad55c2a04c8af86172257c92af81de2ee1dd.png differ diff --git a/_images/b9ebdf8f12d9cd2f8047e0ab51acc9b23a16cc43177fe0c7eeef63d0e285908f.png b/_images/b9ebdf8f12d9cd2f8047e0ab51acc9b23a16cc43177fe0c7eeef63d0e285908f.png new file mode 100644 index 000000000..604ea77d4 Binary files /dev/null and b/_images/b9ebdf8f12d9cd2f8047e0ab51acc9b23a16cc43177fe0c7eeef63d0e285908f.png differ diff --git a/_images/bafcd798ce6fa792883069f5f67d59f84f0614aee01a6b563e2eda73664e980d.png b/_images/bafcd798ce6fa792883069f5f67d59f84f0614aee01a6b563e2eda73664e980d.png new file mode 100644 index 000000000..b688b4a2a Binary files /dev/null and b/_images/bafcd798ce6fa792883069f5f67d59f84f0614aee01a6b563e2eda73664e980d.png differ diff --git a/_images/bc678ad5f054a187ada9488eac6034ec451475c82b447ad813ae1b9b24601637.png b/_images/bc678ad5f054a187ada9488eac6034ec451475c82b447ad813ae1b9b24601637.png new file mode 100644 index 000000000..9c8588664 Binary files /dev/null and b/_images/bc678ad5f054a187ada9488eac6034ec451475c82b447ad813ae1b9b24601637.png differ diff --git a/_images/bf05617ed79cfad41d663e5de1dec67497ae7ce7453e5cbe0c7f17a841c2dfa9.png b/_images/bf05617ed79cfad41d663e5de1dec67497ae7ce7453e5cbe0c7f17a841c2dfa9.png new file mode 100644 index 000000000..446b58b65 Binary files /dev/null and b/_images/bf05617ed79cfad41d663e5de1dec67497ae7ce7453e5cbe0c7f17a841c2dfa9.png differ diff --git a/_images/d85ad5d3c74affda9d2ebdcc0989e7d9df9e4402115a54d313d45a4fdd215802.png b/_images/d85ad5d3c74affda9d2ebdcc0989e7d9df9e4402115a54d313d45a4fdd215802.png new file mode 100644 index 000000000..1f9512d66 Binary files /dev/null and b/_images/d85ad5d3c74affda9d2ebdcc0989e7d9df9e4402115a54d313d45a4fdd215802.png differ diff --git a/_images/dd5a6f98208aaa1c5ff0b1c91baebe0a2cd7bc24bdda4bc2cd0905198d1021e9.png b/_images/dd5a6f98208aaa1c5ff0b1c91baebe0a2cd7bc24bdda4bc2cd0905198d1021e9.png new file mode 100644 index 000000000..a0e7f35c3 Binary files /dev/null and b/_images/dd5a6f98208aaa1c5ff0b1c91baebe0a2cd7bc24bdda4bc2cd0905198d1021e9.png differ diff --git a/_images/e407f2aba16854949ec326b5ce84fc620bea274782085e3f1bb89ccfb4f910f0.png b/_images/e407f2aba16854949ec326b5ce84fc620bea274782085e3f1bb89ccfb4f910f0.png new file mode 100644 index 000000000..66f86d55b Binary files /dev/null and b/_images/e407f2aba16854949ec326b5ce84fc620bea274782085e3f1bb89ccfb4f910f0.png differ diff --git a/core/fine-tuning/fine-tuning-oxides.html b/core/fine-tuning/fine-tuning-oxides.html index 109f7e6a1..d531c2e74 100644 --- a/core/fine-tuning/fine-tuning-oxides.html +++ b/core/fine-tuning/fine-tuning-oxides.html @@ -640,7 +640,7 @@
from fairchem.core.models.model_registry import model_name_to_local_file
+from fairchem.core.models.model_registry import model_name_to_local_file
checkpoint_path = model_name_to_local_file('GemNet-OC-S2EFS-OC20+OC22', local_cache='/tmp/ocp_checkpoints/')
@@ -654,7 +654,7 @@ Fine tuning a model
-import json
+import json
import numpy as np
import matplotlib.pyplot as plt
from ase import Atoms
@@ -669,11 +669,66 @@ Fine tuning a model
+(['SnO2', 'IrO2', 'RuO2', 'TiO2', 'VO2'],
+ ['rutile', 'pyrite', 'columbite', 'brookite', 'fluorite', 'anatase'])
+
+
+
A specific calculation has a lot of details in it. You can use this to recreate the calculations. Shortly we will use these to compare the DFT results to OCP.
-d['TiO2']['rutile']['PBE']['EOS']['calculations'][0]
+d['TiO2']['rutile']['PBE']['EOS']['calculations'][0]
+
+
+
+
+{'incar': {'doc': 'INCAR parameters',
+ 'prec': 'Normal',
+ 'isif': 4,
+ 'nbands': 20,
+ 'ibrion': 2,
+ 'gga': 'PE',
+ 'encut': 520.0,
+ 'ismear': 0,
+ 'sigma': 0.001,
+ 'nsw': 50},
+ 'doc': 'JSON representation of a VASP calculation.\n\nenergy is in eV\nforces are in eV/\\AA\nstress is in GPa (sxx, syy, szz, syz, sxz, sxy)\nmagnetic moments are in Bohr-magneton\nThe density of states is reported with E_f at 0 eV.\nVolume is reported in \\AA^3\nCoordinates and cell parameters are reported in \\AA\n\nIf atom-projected dos are included they are in the form:\n{ados:{energy:data, {atom index: {orbital : dos}}}\n',
+ 'potcar': [['O',
+ 'potpaw/O/POTCAR',
+ '0cf2ce56049ca395c567026b700ed66c94a85161'],
+ ['Ti', 'potpaw/Ti/POTCAR', '51f7f05982d6b4052becc160375a8b8b670177a7']],
+ 'input': {'kpts': [6, 6, 6],
+ 'reciprocal': False,
+ 'xc': 'LDA',
+ 'kpts_nintersections': None,
+ 'setups': None,
+ 'txt': '-',
+ 'gamma': False},
+ 'atoms': {'cell': [[4.3789762519649225, 0.0, 0.0],
+ [0.0, 4.3789762519649225, 0.0],
+ [0.0, 0.0, 2.864091775985314]],
+ 'symbols': ['Ti', 'Ti', 'O', 'O', 'O', 'O'],
+ 'tags': [0, 0, 0, 0, 0, 0],
+ 'pbc': [True, True, True],
+ 'positions': [[0.0, 0.0, 0.0],
+ [2.1894881259824612, 2.1894881259824612, 1.432045887992657],
+ [1.3181554154438013, 1.3181554154438013, 0.0],
+ [3.0608208365211214, 3.0608208365211214, 0.0],
+ [3.5076435414262623, 0.87133271053866, 1.432045887992657],
+ [0.87133271053866, 3.5076435414262623, 1.432045887992657]]},
+ 'data': {'stress': [496.18519999, 496.18519999, 502.82679392, 0.0, 0.0, 0.0],
+ 'doc': 'Data from the output of the calculation',
+ 'volume': 54.92019999999996,
+ 'total_energy': -56.230672,
+ 'forces': [[0.0, 0.0, 0.0],
+ [0.0, 0.0, 0.0],
+ [-0.001264, -0.001264, 0.0],
+ [0.001264, 0.001264, 0.0],
+ [-0.001264, 0.001264, 0.0],
+ [0.001264, -0.001264, 0.0]],
+ 'fermi_level': 3.153}}
@@ -681,7 +736,7 @@ Fine tuning a model
-c = d['TiO2']['rutile']['PBE']['EOS']['calculations'][0]
+c = d['TiO2']['rutile']['PBE']['EOS']['calculations'][0]
atoms = Atoms(symbols=c['atoms']['symbols'],
positions=c['atoms']['positions'],
cell=c['atoms']['cell'],
@@ -691,20 +746,46 @@ Fine tuning a model
+(Atoms(symbols='Ti2O4', pbc=True, cell=[4.3789762519649225, 4.3789762519649225, 2.864091775985314], tags=...),
+ -56.230672,
+ [[0.0, 0.0, 0.0],
+ [0.0, 0.0, 0.0],
+ [-0.001264, -0.001264, 0.0],
+ [0.001264, 0.001264, 0.0],
+ [-0.001264, 0.001264, 0.0],
+ [0.001264, -0.001264, 0.0]])
+
+
+
Next, we will create an OCP calculator that we can use to get predictions from.
-from fairchem.core.common.relaxation.ase_utils import OCPCalculator
+from fairchem.core.common.relaxation.ase_utils import OCPCalculator
calc = OCPCalculator(checkpoint_path=checkpoint_path, trainer='forces', cpu=False)
+
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
Now, we loop through each structure and accumulate the OCP predictions. Then, we plot the parity results.
-import time
+import time
t0 = time.time()
eos_data = {}
@@ -738,20 +819,31 @@ Fine tuning a model
+Elapsed time 67.4 seconds.
+
+
+
+
-mae = np.mean(np.abs(np.array(dft) - np.array(ocp)))
+mae = np.mean(np.abs(np.array(dft) - np.array(ocp)))
print(f'MAE = {mae:1.3f} eV/atom')
+
+MAE = 1.669 eV/atom
+
+
+
The MAE is somewhat high compared to the reported value of 0.458 eV. That is not too surprising; although OC22 was trained on oxides, it was not trained on all of these structures. It is also evident on inspection that the main issues are all the VO2 structures, and these skew the MAE. Next we look at the EOS for each material. Here you can see offsets, and qualitative issues in the shapes. The offset is largely a PBE/RPBE difference.
Some notable issues are with fluorite structures. We show one here for VO2.
-oxide, polymorph = 'VO2', 'fluorite'
+oxide, polymorph = 'VO2', 'fluorite'
V, D, O = eos_data[oxide][polymorph]
plt.plot(V, D, label='dft')
@@ -761,6 +853,9 @@ Fine tuning a model
+
+
We can improve this by fine-tuning the model.
@@ -776,10 +871,10 @@ Fine tuning the checkpoint
-from ase.db import connect
+from ase.db import connect
from ase.calculators.singlepoint import SinglePointCalculator
-! rm -fr oxides.db # start clean when you run this cell
+! rm -fr oxides.db # start clean when you run this cell
db = connect('oxides.db')
@@ -787,7 +882,7 @@ Fine tuning the checkpoint
-for oxide in oxides:
+for oxide in oxides:
for polymorph in polymorphs:
for c in d[oxide][polymorph]['PBE']['EOS']['calculations']:
atoms = Atoms(symbols=c['atoms']['symbols'],
@@ -807,7 +902,33 @@ Fine tuning the checkpoint
-! ase db oxides.db
+! ase db oxides.db
+
+
+
+
+id|age|user |formula|calculator| energy|natoms| fmax|pbc| volume|charge| mass
+ 1| 1s|runner|Sn2O4 |unknown |-41.359| 6|0.045|TTT| 64.258| 0.000|301.416
+ 2| 1s|runner|Sn2O4 |unknown |-41.853| 6|0.025|TTT| 66.526| 0.000|301.416
+ 3| 1s|runner|Sn2O4 |unknown |-42.199| 6|0.010|TTT| 68.794| 0.000|301.416
+ 4| 1s|runner|Sn2O4 |unknown |-42.419| 6|0.006|TTT| 71.062| 0.000|301.416
+ 5| 1s|runner|Sn2O4 |unknown |-42.534| 6|0.011|TTT| 73.330| 0.000|301.416
+ 6| 1s|runner|Sn2O4 |unknown |-42.562| 6|0.029|TTT| 75.598| 0.000|301.416
+ 7| 1s|runner|Sn2O4 |unknown |-42.518| 6|0.033|TTT| 77.866| 0.000|301.416
+ 8| 1s|runner|Sn2O4 |unknown |-42.415| 6|0.010|TTT| 80.134| 0.000|301.416
+ 9| 1s|runner|Sn2O4 |unknown |-42.266| 6|0.006|TTT| 82.402| 0.000|301.416
+10| 1s|runner|Sn2O4 |unknown |-42.083| 6|0.017|TTT| 84.670| 0.000|301.416
+11| 1s|runner|Sn4O8 |unknown |-81.424| 12|0.012|TTT|117.473| 0.000|602.832
+12| 1s|runner|Sn4O8 |unknown |-82.437| 12|0.005|TTT|121.620| 0.000|602.832
+13| 1s|runner|Sn4O8 |unknown |-83.147| 12|0.015|TTT|125.766| 0.000|602.832
+14| 1s|runner|Sn4O8 |unknown |-83.599| 12|0.047|TTT|129.912| 0.000|602.832
+15| 1s|runner|Sn4O8 |unknown |-83.831| 12|0.081|TTT|134.058| 0.000|602.832
+16| 1s|runner|Sn4O8 |unknown |-83.898| 12|0.001|TTT|138.204| 0.000|602.832
+17| 1s|runner|Sn4O8 |unknown |-83.805| 12|0.001|TTT|142.350| 0.000|602.832
+18| 1s|runner|Sn4O8 |unknown |-83.586| 12|0.002|TTT|146.496| 0.000|602.832
+19| 1s|runner|Sn4O8 |unknown |-83.262| 12|0.002|TTT|150.642| 0.000|602.832
+20| 1s|runner|Sn4O8 |unknown |-82.851| 12|0.013|TTT|154.788| 0.000|602.832
+Rows: 295 (showing first 20)
@@ -820,14 +941,21 @@ Make the train, test, val splitsfairchem.core.common.tutorial_utils to streamline this process.
-from fairchem.core.common.tutorial_utils import train_test_val_split
-! rm -fr train.db test.db val.db
+from fairchem.core.common.tutorial_utils import train_test_val_split
+! rm -fr train.db test.db val.db
train, test, val = train_test_val_split('oxides.db')
train, test, val
+
+(PosixPath('/home/runner/work/fairchem/fairchem/docs/core/fine-tuning/train.db'),
+ PosixPath('/home/runner/work/fairchem/fairchem/docs/core/fine-tuning/test.db'),
+ PosixPath('/home/runner/work/fairchem/fairchem/docs/core/fine-tuning/val.db'))
+
+
+
@@ -835,7 +963,7 @@ Setting up the configuration yaml file
-from fairchem.core.common.tutorial_utils import generate_yml_config
+from fairchem.core.common.tutorial_utils import generate_yml_config
yml = generate_yml_config(checkpoint_path, 'config.yml',
delete=['slurm', 'cmd', 'logger', 'task', 'model_attributes',
@@ -865,10 +993,159 @@ Setting up the configuration yaml file
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+PosixPath('/home/runner/work/fairchem/fairchem/docs/core/fine-tuning/config.yml')
+
+
+
-! cat config.yml
+! cat config.yml
+
+
+
+
+amp: true
+checkpoint: /tmp/ocp_checkpoints/gnoc_oc22_oc20_all_s2ef.pt
+dataset:
+ test:
+ a2g_args:
+ r_energy: false
+ r_forces: false
+ src: test.db
+ train:
+ a2g_args:
+ r_energy: true
+ r_forces: true
+ src: train.db
+ val:
+ a2g_args:
+ r_energy: true
+ r_forces: true
+ src: val.db
+evaluation_metrics:
+ metrics:
+ energy:
+ - mae
+ forces:
+ - forcesx_mae
+ - forcesy_mae
+ - forcesz_mae
+ - mae
+ - cosine_similarity
+ - magnitude_error
+ misc:
+ - energy_forces_within_threshold
+ primary_metric: forces_mae
+gpus: 1
+logger: tensorboard
+loss_fns:
+- energy:
+ coefficient: 1
+ fn: mae
+- forces:
+ coefficient: 1
+ fn: l2mae
+model:
+ activation: silu
+ atom_edge_interaction: true
+ atom_interaction: true
+ cbf:
+ name: spherical_harmonics
+ cutoff: 12.0
+ cutoff_aeaint: 12.0
+ cutoff_aint: 12.0
+ cutoff_qint: 12.0
+ direct_forces: true
+ edge_atom_interaction: true
+ emb_size_aint_in: 64
+ emb_size_aint_out: 64
+ emb_size_atom: 256
+ emb_size_cbf: 16
+ emb_size_edge: 512
+ emb_size_quad_in: 32
+ emb_size_quad_out: 32
+ emb_size_rbf: 16
+ emb_size_sbf: 32
+ emb_size_trip_in: 64
+ emb_size_trip_out: 64
+ envelope:
+ exponent: 5
+ name: polynomial
+ extensive: true
+ forces_coupled: false
+ max_neighbors: 30
+ max_neighbors_aeaint: 20
+ max_neighbors_aint: 1000
+ max_neighbors_qint: 8
+ name: gemnet_oc
+ num_after_skip: 2
+ num_atom: 3
+ num_atom_emb_layers: 2
+ num_before_skip: 2
+ num_blocks: 4
+ num_concat: 1
+ num_global_out_layers: 2
+ num_output_afteratom: 3
+ num_radial: 128
+ num_spherical: 7
+ otf_graph: true
+ output_init: HeOrthogonal
+ qint_tags:
+ - 1
+ - 2
+ quad_interaction: true
+ rbf:
+ name: gaussian
+ regress_forces: true
+ sbf:
+ name: legendre_outer
+ symmetric_edge_symmetrization: false
+noddp: false
+optim:
+ batch_size: 4
+ clip_grad_norm: 10
+ ema_decay: 0.999
+ energy_coefficient: 1
+ eval_batch_size: 16
+ eval_every: 10
+ factor: 0.8
+ force_coefficient: 1
+ load_balancing: atoms
+ loss_energy: mae
+ lr_initial: 0.0005
+ max_epochs: 1
+ mode: min
+ num_workers: 2
+ optimizer: AdamW
+ optimizer_params:
+ amsgrad: true
+ patience: 3
+ scheduler: ReduceLROnPlateau
+ weight_decay: 0
+outputs:
+ energy:
+ level: system
+ forces:
+ eval_on_free_atoms: true
+ level: atom
+ train_on_free_atoms: true
+task:
+ dataset: ase_db
+trainer: ocp
@@ -887,43 +1164,70 @@ Running the training jobtail -f train.txt
-You can also visit it in a browser at train.txt. You have to periodically refresh the view to see updates though.
+You can also visit it in a browser at train.txt. You have to periodically refresh the view to see updates though.
This can take up to 30 minutes for 80 epochs, so we only do a few here to see what happens.
-
-import time
+
+import time
from fairchem.core.common.tutorial_utils import fairchem_main
t0 = time.time()
-! python {fairchem_main()} --mode train --config-yml {yml} --checkpoint {checkpoint_path} --run-dir fine-tuning --identifier ft-oxides --amp > train.txt 2>&1
+! python {fairchem_main()} --mode train --config-yml {yml} --checkpoint {checkpoint_path} --run-dir fine-tuning --identifier ft-oxides --amp > train.txt 2>&1
print(f'Elapsed time = {time.time() - t0:1.1f} seconds')
+
+
+Show code cell output
+
+
+
+Elapsed time = 206.1 seconds
+
+
+
+
-Now since we have a file, we can find the training results in it. See train.txt. At the top, the config is printed, so we can get the checkpoint directory. I use shell commands and Python to get the line, split and strip it here.
+Now since we have a file, we can find the training results in it. See train.txt. At the top, the config is printed, so we can get the checkpoint directory. I use shell commands and Python to get the line, split and strip it here.
-cpline = !grep "checkpoint_dir:" train.txt
+cpline = !grep "checkpoint_dir:" train.txt
cpdir = cpline[0].split(':')[-1].strip()
cpdir
+
+'fine-tuning/checkpoints/2024-05-17-17-53-04-ft-oxides'
+
+
+
There will be two files in there: checkpoint.pt
and best_checkpoint.pt
.
The best_checkpoint.pt
is the one that performs best on the validation dataset. The checkpoint.pt
is the most recently saved one. Probably it has the lowest loss in training, but this could be an indication of overfitting. You have to use some judgement in determining which one to use, and if it is sufficiently accurate for your needs. It may need additional training to further improve it.
-newckpt = cpdir + '/checkpoint.pt'
+newckpt = cpdir + '/checkpoint.pt'
newcalc = OCPCalculator(checkpoint_path=newckpt, cpu=False)
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
-eos_data = {}
+eos_data = {}
for oxide in oxides:
eos_data[oxide] = {}
for polymorph in polymorphs:
@@ -953,19 +1257,27 @@ Running the training job
+
+
-mae = np.mean(np.abs(np.array(dft) - np.array(ocp)))
+mae = np.mean(np.abs(np.array(dft) - np.array(ocp)))
print(f'New MAE = {mae:1.3f} eV/atom')
+
+New MAE = 0.463 eV/atom
+
+
+
This is a substantial improvement! We can see what it means in terms of the Equations of State. There is still not perfect agreement, but the curves are closer together. Additional fine tuning, or a better model could probably still improve this.
-oxide, polymorph = 'VO2', 'fluorite'
+oxide, polymorph = 'VO2', 'fluorite'
V, D, O = eos_data[oxide][polymorph]
plt.plot(V, D, label='dft')
@@ -975,6 +1287,9 @@ Running the training job
+
+
It is possible to continue refining the fit. The simple things to do are to use more epochs of training. Eventually the MAE will stabilize, and then it may be necessary to adjust other optimization parameters like the learning rate (usually you decrease it).
Depending on what is important to you, you may consider changing the relative importances of energy and forces; you can often trade off accuracy of one for the other. It may be necessary to add additional data to cover the composition and configuration space more thoroughly.
diff --git a/core/gotchas.html b/core/gotchas.html
index a1e6906b2..29c03ea32 100644
--- a/core/gotchas.html
+++ b/core/gotchas.html
@@ -660,17 +660,31 @@ I want the energy of a gas phase atom
-from fairchem.core.common.relaxation.ase_utils import OCPCalculator
+from fairchem.core.common.relaxation.ase_utils import OCPCalculator
from fairchem.core.models.model_registry import model_name_to_local_file
checkpoint_path = model_name_to_local_file('GemNet-OC-S2EFS-OC20+OC22', local_cache='/tmp/ocp_checkpoints/')
calc = OCPCalculator(checkpoint_path=checkpoint_path)
+
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
-%%capture
+
@@ -686,7 +869,7 @@ I get wildly different energies from the different models
-# These are to suppress the output from making the calculators.
+# These are to suppress the output from making the calculators.
from io import StringIO
import contextlib
@@ -695,7 +878,7 @@ I get wildly different energies from the different models
-from ase.build import fcc111, add_adsorbate
+from ase.build import fcc111, add_adsorbate
slab = fcc111('Pt', size=(2, 2, 5), vacuum=10.0)
add_adsorbate(slab, 'O', height=1.2, position='fcc')
@@ -704,7 +887,7 @@ I get wildly different energies from the different models
-from fairchem.core.models.model_registry import model_name_to_local_file
+from fairchem.core.models.model_registry import model_name_to_local_file
# OC20 model - trained on adsorption energies
checkpoint_path = model_name_to_local_file('GemNet-OC-S2EF-OC20-All', local_cache='/tmp/ocp_checkpoints/')
@@ -719,10 +902,27 @@ I get wildly different energies from the different models
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+1.2779738903045654
+
+
+
-# An OC22 checkpoint - trained on total energy
+# An OC22 checkpoint - trained on total energy
checkpoint_path = model_name_to_local_file('GemNet-OC-S2EFS-OC20+OC22', local_cache='/tmp/ocp_checkpoints/')
with contextlib.redirect_stdout(StringIO()) as _:
@@ -735,10 +935,27 @@ I get wildly different energies from the different models
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+-110.3986587524414
+
+
+
-# This eSCN model is trained on adsorption energies
+# This eSCN model is trained on adsorption energies
checkpoint_path = model_name_to_local_file('eSCN-L4-M2-Lay12-S2EF-OC20-2M', local_cache='/tmp/ocp_checkpoints/')
with contextlib.redirect_stdout(StringIO()) as _:
@@ -749,6 +966,17 @@ I get wildly different energies from the different models
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+1.6684269905090332
+
+
+
@@ -781,7 +1009,7 @@ You need at least four atoms for molecules with some models
-%%capture
+%%capture
from fairchem.core.common.relaxation.ase_utils import OCPCalculator
from fairchem.core.models.model_registry import model_name_to_local_file
import os
@@ -792,10 +1020,24 @@ You need at least four atoms for molecules with some models
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
-%%capture
+
@@ -813,7 +1224,7 @@ To tag or not?
-%%capture
+%%capture
from fairchem.core.common.relaxation.ase_utils import OCPCalculator
from fairchem.core.models.model_registry import model_name_to_local_file
import os
@@ -823,31 +1234,219 @@ To tag or not?
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Unrecognized arguments: ['symmetric_edge_symmetrization']
+
+
+WARNING:root:Using `weight_decay` from `optim` instead of `optim.optimizer_params`.Please update your config to use `optim.optimizer_params.weight_decay`.`optim.weight_decay` will soon be deprecated.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
-%%capture
+%%capture
atoms = molecule('CH4')
atoms.set_calculator(calc)
atoms.get_potential_energy() # error
+
+---------------------------------------------------------------------------
+RuntimeError Traceback (most recent call last)
+Cell In[11], line 3
+ 1 atoms = molecule('CH4')
+ 2 atoms.set_calculator(calc)
+----> 3 atoms.get_potential_energy() # error
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/ase/atoms.py:731, in Atoms.get_potential_energy(self, force_consistent, apply_constraint)
+ 728 energy = self._calc.get_potential_energy(
+ 729 self, force_consistent=force_consistent)
+ 730 else:
+--> 731 energy = self._calc.get_potential_energy(self)
+ 732 if apply_constraint:
+ 733 for constraint in self.constraints:
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/ase/calculators/calculator.py:709, in Calculator.get_potential_energy(self, atoms, force_consistent)
+ 708 def get_potential_energy(self, atoms=None, force_consistent=False):
+--> 709 energy = self.get_property('energy', atoms)
+ 710 if force_consistent:
+ 711 if 'free_energy' not in self.results:
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/ase/calculators/calculator.py:737, in Calculator.get_property(self, name, atoms, allow_calculation)
+ 735 if not allow_calculation:
+ 736 return None
+--> 737 self.calculate(atoms, [name], system_changes)
+ 739 if name not in self.results:
+ 740 # For some reason the calculator was not able to do what we want,
+ 741 # and that is OK.
+ 742 raise PropertyNotImplementedError('{} not present in this '
+ 743 'calculation'.format(name))
+
+File ~/work/fairchem/fairchem/src/fairchem/core/common/relaxation/ase_utils.py:243, in OCPCalculator.calculate(self, atoms, properties, system_changes)
+ 240 data_object = self.a2g.convert(atoms)
+ 241 batch = data_list_collater([data_object], otf_graph=True)
+--> 243 predictions = self.trainer.predict(batch, per_image=False, disable_tqdm=True)
+ 245 for key in predictions:
+ 246 _pred = predictions[key]
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/utils/_contextlib.py:115, in context_decorator.<locals>.decorate_context(*args, **kwargs)
+ 112 @functools.wraps(func)
+ 113 def decorate_context(*args, **kwargs):
+ 114 with ctx_factory():
+--> 115 return func(*args, **kwargs)
+
+File ~/work/fairchem/fairchem/src/fairchem/core/trainers/ocp_trainer.py:434, in OCPTrainer.predict(self, data_loader, per_image, results_file, disable_tqdm)
+ 426 for _i, batch in tqdm(
+ 427 enumerate(data_loader),
+ 428 total=len(data_loader),
+ (...)
+ 431 disable=disable_tqdm,
+ 432 ):
+ 433 with torch.cuda.amp.autocast(enabled=self.scaler is not None):
+--> 434 out = self._forward(batch)
+ 436 for target_key in self.config["outputs"]:
+ 437 pred = out[target_key]
+
+File ~/work/fairchem/fairchem/src/fairchem/core/trainers/ocp_trainer.py:235, in OCPTrainer._forward(self, batch)
+ 234 def _forward(self, batch):
+--> 235 out = self.model(batch.to(self.device))
+ 237 ### TODO: Move into BaseModel in OCP 2.0
+ 238 outputs = {}
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/nn/modules/module.py:1511, in Module._wrapped_call_impl(self, *args, **kwargs)
+ 1509 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
+ 1510 else:
+-> 1511 return self._call_impl(*args, **kwargs)
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/nn/modules/module.py:1520, in Module._call_impl(self, *args, **kwargs)
+ 1515 # If we don't have any hooks, we want to skip the rest of the logic in
+ 1516 # this function, and just call forward.
+ 1517 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
+ 1518 or _global_backward_pre_hooks or _global_backward_hooks
+ 1519 or _global_forward_hooks or _global_forward_pre_hooks):
+-> 1520 return forward_call(*args, **kwargs)
+ 1522 try:
+ 1523 result = None
+
+File ~/work/fairchem/fairchem/src/fairchem/core/common/utils.py:156, in conditional_grad.<locals>.decorator.<locals>.cls_method(self, *args, **kwargs)
+ 154 if self.regress_forces and not getattr(self, "direct_forces", 0):
+ 155 f = dec(func)
+--> 156 return f(self, *args, **kwargs)
+
+File ~/work/fairchem/fairchem/src/fairchem/core/models/gemnet_oc/gemnet_oc.py:1229, in GemNetOC.forward(self, data)
+ 1207 (
+ 1208 main_graph,
+ 1209 a2a_graph,
+ (...)
+ 1216 quad_idx,
+ 1217 ) = self.get_graphs_and_indices(data)
+ 1218 _, idx_t = main_graph["edge_index"]
+ 1220 (
+ 1221 basis_rad_raw,
+ 1222 basis_atom_update,
+ 1223 basis_output,
+ 1224 bases_qint,
+ 1225 bases_e2e,
+ 1226 bases_a2e,
+ 1227 bases_e2a,
+ 1228 basis_a2a_rad,
+-> 1229 ) = self.get_bases(
+ 1230 main_graph=main_graph,
+ 1231 a2a_graph=a2a_graph,
+ 1232 a2ee2a_graph=a2ee2a_graph,
+ 1233 qint_graph=qint_graph,
+ 1234 trip_idx_e2e=trip_idx_e2e,
+ 1235 trip_idx_a2e=trip_idx_a2e,
+ 1236 trip_idx_e2a=trip_idx_e2a,
+ 1237 quad_idx=quad_idx,
+ 1238 num_atoms=num_atoms,
+ 1239 )
+ 1241 # Embedding block
+ 1242 h = self.atom_emb(atomic_numbers)
+
+File ~/work/fairchem/fairchem/src/fairchem/core/models/gemnet_oc/gemnet_oc.py:1102, in GemNetOC.get_bases(self, main_graph, a2a_graph, a2ee2a_graph, qint_graph, trip_idx_e2e, trip_idx_a2e, trip_idx_e2a, quad_idx, num_atoms)
+ 1093 cosφ_cab_q, cosφ_abd, angle_cabd = self.calculate_quad_angles(
+ 1094 main_graph["vector"],
+ 1095 qint_graph["vector"],
+ 1096 quad_idx,
+ 1097 )
+ 1099 basis_rad_cir_qint_raw, basis_cir_qint_raw = self.cbf_basis_qint(
+ 1100 qint_graph["distance"], cosφ_abd
+ 1101 )
+-> 1102 basis_rad_sph_qint_raw, basis_sph_qint_raw = self.sbf_basis_qint(
+ 1103 main_graph["distance"],
+ 1104 cosφ_cab_q[quad_idx["trip_out_to_quad"]],
+ 1105 angle_cabd,
+ 1106 )
+ 1107 if self.atom_edge_interaction:
+ 1108 basis_rad_a2ee2a_raw = self.radial_basis_aeaint(a2ee2a_graph["distance"])
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/nn/modules/module.py:1511, in Module._wrapped_call_impl(self, *args, **kwargs)
+ 1509 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
+ 1510 else:
+-> 1511 return self._call_impl(*args, **kwargs)
+
+File /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/torch/nn/modules/module.py:1520, in Module._call_impl(self, *args, **kwargs)
+ 1515 # If we don't have any hooks, we want to skip the rest of the logic in
+ 1516 # this function, and just call forward.
+ 1517 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
+ 1518 or _global_backward_pre_hooks or _global_backward_hooks
+ 1519 or _global_forward_hooks or _global_forward_pre_hooks):
+-> 1520 return forward_call(*args, **kwargs)
+ 1522 try:
+ 1523 result = None
+
+File ~/work/fairchem/fairchem/src/fairchem/core/models/gemnet_oc/layers/spherical_basis.py:132, in SphericalBasisLayer.forward(self, D_ca, cosφ_cab, θ_cabd)
+ 130 def forward(self, D_ca, cosφ_cab, θ_cabd):
+ 131 rad_basis = self.radial_basis(D_ca)
+--> 132 sph_basis = self.spherical_basis(cosφ_cab, θ_cabd)
+ 133 # (num_quadruplets, num_spherical**2)
+ 135 if self.scale_basis:
+
+File ~/work/fairchem/fairchem/src/fairchem/core/models/gemnet_oc/layers/spherical_basis.py:116, in SphericalBasisLayer.__init__.<locals>.<lambda>(cosφ, θ)
+ 111 elif sbf_name == "legendre_outer":
+ 112 circular_basis = get_sph_harm_basis(num_spherical, zero_m_only=True)
+ 113 self.spherical_basis = lambda cosφ, ϑ: (
+ 114 circular_basis(cosφ)[:, :, None]
+ 115 * circular_basis(torch.cos(ϑ))[:, None, :]
+--> 116 ).reshape(cosφ.shape[0], -1)
+ 118 elif sbf_name == "gaussian_outer":
+ 119 self.circular_basis = GaussianBasis(
+ 120 start=-1, stop=1, num_gaussians=num_spherical, **sbf_hparams
+ 121 )
+
+RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1] because the unspecified dimension size -1 can be any value and is ambiguous
+
+
+
-atoms = molecule('CH4')
+atoms = molecule('CH4')
atoms.set_tags(np.ones(len(atoms))) # <- critical line for Gemnet
atoms.set_calculator(calc)
atoms.get_potential_energy()
+
+-23.71796226501465
+
+
+
Not all models require tags though. This EquiformerV2 model does not use them. This is another detail that is important to keep in mind.
-from fairchem.core.common.relaxation.ase_utils import OCPCalculator
+from fairchem.core.common.relaxation.ase_utils import OCPCalculator
from fairchem.core.models.model_registry import model_name_to_local_file
import os
@@ -857,16 +1456,32 @@ To tag or not?
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Skipping scheduler setup. No training set found.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
-atoms = molecule('CH4')
+atoms = molecule('CH4')
atoms.set_calculator(calc)
atoms.get_potential_energy()
+
+-0.4297371208667755
+
+
+
@@ -876,7 +1491,7 @@ Stochastic simulation results
-from fairchem.core.models.model_registry import model_name_to_local_file
+from fairchem.core.models.model_registry import model_name_to_local_file
from fairchem.core.common.relaxation.ase_utils import OCPCalculator
checkpoint_path = model_name_to_local_file('EquiformerV2-31M-S2EF-OC20-All+MD', local_cache='/tmp/ocp_checkpoints/')
@@ -900,6 +1515,30 @@ Stochastic simulation results
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Skipping scheduler setup. No training set found.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+1.213987159729004 1.897787927830925e-06
+1.2139880657196045
+1.2139830589294434
+1.213986873626709
+1.2139854431152344
+1.2139866352081299
+1.2139878273010254
+1.2139861583709717
+1.2139899730682373
+1.2139892578125
+1.2139883041381836
+
+
+
@@ -907,7 +1546,7 @@ The forces don’t sum to zero
-from fairchem.core.models.model_registry import model_name_to_local_file
+from fairchem.core.models.model_registry import model_name_to_local_file
checkpoint_path = model_name_to_local_file('EquiformerV2-31M-S2EF-OC20-All+MD', local_cache='/tmp/ocp_checkpoints/')
from fairchem.core.common.relaxation.ase_utils import OCPCalculator
@@ -924,14 +1563,33 @@ The forces don’t sum to zero
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Skipping scheduler setup. No training set found.
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+array([ 0.00848243, 0.01409519, -0.05882597], dtype=float32)
+
+
+
-# This makes them sum closer to zero by removing net translational force
+# This makes them sum closer to zero by removing net translational force
(f - f.mean(axis=0)).sum(axis=0)
+
+array([ 2.0005973e-07, 2.2817403e-08, -4.7683716e-07], dtype=float32)
+
+
+
diff --git a/core/inference.html b/core/inference.html
index 7f2cbcde4..32c2a98ee 100644
--- a/core/inference.html
+++ b/core/inference.html
@@ -634,7 +634,67 @@ Fast batched inferenceYou can retrieve the dataset below. In this notebook we learn how to do “mass inference” without an ASE calculator. You do this by creating a config.yml file, and running the main.py
command line utility.
-! wget https://figshare.com/ndownloader/files/11948267 -O data.db
+! wget https://figshare.com/ndownloader/files/11948267 -O data.db
+
+
+
+
+--2024-05-17 17:57:32-- https://figshare.com/ndownloader/files/11948267
+Resolving figshare.com (figshare.com)...
+
+
+52.214.121.144, 63.33.12.55, 2a05:d018:1f4:d000:2dfa:52ce:c4c9:d519, ...
+Connecting to figshare.com (figshare.com)|52.214.121.144|:443...
+
+
+connected.
+
+
+HTTP request sent, awaiting response...
+
+
+302 Found
+Location: https://s3-eu-west-1.amazonaws.com/pstorage-cmu-348901238291901/11948267/data.db?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI266R7V6O36O5JUA/20240517/eu-west-1/s3/aws4_request&X-Amz-Date=20240517T175732Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=70dcda6ab23a1f0c3fb366d82d481f47125db5be17bde4aa902a351216183910 [following]
+--2024-05-17 17:57:32-- https://s3-eu-west-1.amazonaws.com/pstorage-cmu-348901238291901/11948267/data.db?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI266R7V6O36O5JUA/20240517/eu-west-1/s3/aws4_request&X-Amz-Date=20240517T175732Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=70dcda6ab23a1f0c3fb366d82d481f47125db5be17bde4aa902a351216183910
+Resolving s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)... 52.218.105.82, 52.218.88.219, 52.218.100.251, ...
+Connecting to s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)|52.218.105.82|:443...
+
+
+connected.
+
+
+HTTP request sent, awaiting response...
+
+
+200 OK
+Length: 43125760 (41M) [binary/octet-stream]
+Saving to: ‘data.db’
+
+
+data.db 0%[ ] 0 --.-KB/s
+
+
+data.db 0%[ ] 147.38K 687KB/s
+
+
+data.db 2%[ ] 1.22M 2.85MB/s
+
+
+data.db 19%[==> ] 7.85M 12.2MB/s
+
+
+data.db 39%[======> ] 16.32M 19.0MB/s
+
+
+data.db 61%[===========> ] 25.14M 23.3MB/s
+
+
+data.db 82%[===============> ] 33.77M 26.1MB/s
+
+
+data.db 100%[===================>] 41.13M 28.3MB/s in 1.5s
+
+2024-05-17 17:57:34 (28.3 MB/s) - ‘data.db’ saved [43125760/43125760]
@@ -643,7 +703,7 @@ Fast batched inference
-! mv data.db full_data.db
+! mv data.db full_data.db
import ase.db
import numpy as np
@@ -665,7 +725,34 @@ Fast batched inference
-! ase db data.db
+! ase db data.db
+
+
+
+
+id|age|user |formula|calculator| energy|natoms| fmax|pbc| volume|charge| mass
+ 1| 0s|runner|Au15 |unknown | -35.061| 15|0.110|TTT| 3809.068| 0.000| 2954.499
+ 2| 0s|runner|Au8 |unknown | -16.742| 8|0.105|TTT| 2863.348| 0.000| 1575.733
+ 3| 0s|runner|Au4 |unknown | -11.818| 4|0.499|TTT| 156.940| 0.000| 787.866
+ 4| 0s|runner|Au25 |unknown | -60.018| 25|0.510|TTT| 4771.343| 0.000| 4924.164
+ 5| 0s|runner|Au4 |unknown | -11.834| 4|0.179|TTT| 156.940| 0.000| 787.866
+ 6| 0s|runner|Au14 |unknown | -31.286| 14|0.328|TTT| 3847.524| 0.000| 2757.532
+ 7| 0s|runner|Au6 |unknown | -10.713| 6|0.558|TTT| 2459.786| 0.000| 1181.799
+ 8| 0s|runner|Au53 |unknown |-137.903| 53|0.446|TTT| 6796.009| 0.000|10439.228
+ 9| 0s|runner|Au46 |unknown |-121.374| 46|0.945|TTT| 6322.757| 0.000| 9060.462
+10| 0s|runner|Au106 |unknown |-286.646| 106|0.676|TTT|11898.264| 0.000|20878.456
+11| 0s|runner|Au18 |unknown | -39.812| 18|1.039|TTT| 4250.202| 0.000| 3545.398
+12| 0s|runner|Au25 |unknown | -61.261| 25|0.109|TTT| 4771.343| 0.000| 4924.164
+13| 0s|runner|Au51 |unknown |-131.385| 51|0.692|TTT| 6691.718| 0.000|10045.295
+14| 0s|runner|Au33 |unknown | -85.707| 33|0.166|TTT| 5480.808| 0.000| 6499.897
+15| 0s|runner|Au26 |unknown | -64.100| 26|0.235|TTT| 4932.626| 0.000| 5121.131
+16| 0s|runner|Au55 |unknown |-138.467| 55|0.617|TTT| 6865.782| 0.000|10833.161
+17| 0s|runner|Au51 |unknown |-134.138| 51|0.883|TTT| 7480.442| 0.000|10045.295
+18| 0s|runner|Au43 |unknown |-113.497| 43|0.142|TTT| 6014.312| 0.000| 8469.562
+19| 0s|runner|Au9 |unknown | -19.412| 9|0.689|TTT| 2646.667| 0.000| 1772.699
+20| 0s|runner|Au34 |unknown | -81.696| 34|0.796|TTT| 5583.053| 0.000| 6696.863
+Rows: 50 (showing first 20)
+Keys: NEB, calc_time, cluster, config, diffusion, ediffg, encut, fermi, gga, group, image, kpt1, kpt2, kpt3, miller, neural_energy, reax_energy, structure, surf, train_set, traj, vacuum, volume, xc
@@ -673,26 +760,36 @@ Fast batched inferenceYou have to choose a checkpoint to start with. The newer checkpoints may require too much memory for this environment.
-from fairchem.core.models.model_registry import available_pretrained_models
+from fairchem.core.models.model_registry import available_pretrained_models
print(available_pretrained_models)
+
+('CGCNN-S2EF-OC20-200k', 'CGCNN-S2EF-OC20-2M', 'CGCNN-S2EF-OC20-20M', 'CGCNN-S2EF-OC20-All', 'DimeNet-S2EF-OC20-200k', 'DimeNet-S2EF-OC20-2M', 'SchNet-S2EF-OC20-200k', 'SchNet-S2EF-OC20-2M', 'SchNet-S2EF-OC20-20M', 'SchNet-S2EF-OC20-All', 'DimeNet++-S2EF-OC20-200k', 'DimeNet++-S2EF-OC20-2M', 'DimeNet++-S2EF-OC20-20M', 'DimeNet++-S2EF-OC20-All', 'SpinConv-S2EF-OC20-2M', 'SpinConv-S2EF-OC20-All', 'GemNet-dT-S2EF-OC20-2M', 'GemNet-dT-S2EF-OC20-All', 'PaiNN-S2EF-OC20-All', 'GemNet-OC-S2EF-OC20-2M', 'GemNet-OC-S2EF-OC20-All', 'GemNet-OC-S2EF-OC20-All+MD', 'GemNet-OC-Large-S2EF-OC20-All+MD', 'SCN-S2EF-OC20-2M', 'SCN-t4-b2-S2EF-OC20-2M', 'SCN-S2EF-OC20-All+MD', 'eSCN-L4-M2-Lay12-S2EF-OC20-2M', 'eSCN-L6-M2-Lay12-S2EF-OC20-2M', 'eSCN-L6-M2-Lay12-S2EF-OC20-All+MD', 'eSCN-L6-M3-Lay20-S2EF-OC20-All+MD', 'EquiformerV2-83M-S2EF-OC20-2M', 'EquiformerV2-31M-S2EF-OC20-All+MD', 'EquiformerV2-153M-S2EF-OC20-All+MD', 'SchNet-S2EF-force-only-OC20-All', 'DimeNet++-force-only-OC20-All', 'DimeNet++-Large-S2EF-force-only-OC20-All', 'DimeNet++-S2EF-force-only-OC20-20M+Rattled', 'DimeNet++-S2EF-force-only-OC20-20M+MD', 'CGCNN-IS2RE-OC20-10k', 'CGCNN-IS2RE-OC20-100k', 'CGCNN-IS2RE-OC20-All', 'DimeNet-IS2RE-OC20-10k', 'DimeNet-IS2RE-OC20-100k', 'DimeNet-IS2RE-OC20-all', 'SchNet-IS2RE-OC20-10k', 'SchNet-IS2RE-OC20-100k', 'SchNet-IS2RE-OC20-All', 'DimeNet++-IS2RE-OC20-10k', 'DimeNet++-IS2RE-OC20-100k', 'DimeNet++-IS2RE-OC20-All', 'PaiNN-IS2RE-OC20-All', 'GemNet-dT-S2EFS-OC22', 'GemNet-OC-S2EFS-OC22', 'GemNet-OC-S2EFS-OC20+OC22', 'GemNet-OC-S2EFS-nsn-OC20+OC22', 'GemNet-OC-S2EFS-OC20->OC22', 'EquiformerV2-lE4-lF100-S2EFS-OC22', 'SchNet-S2EF-ODAC', 'DimeNet++-S2EF-ODAC', 'PaiNN-S2EF-ODAC', 'GemNet-OC-S2EF-ODAC', 'eSCN-S2EF-ODAC', 'EquiformerV2-S2EF-ODAC', 'EquiformerV2-Large-S2EF-ODAC', 'Gemnet-OC-IS2RE-ODAC', 'eSCN-IS2RE-ODAC', 'EquiformerV2-IS2RE-ODAC')
+
+
+
-from fairchem.core.models.model_registry import model_name_to_local_file
+from fairchem.core.models.model_registry import model_name_to_local_file
checkpoint_path = model_name_to_local_file('GemNet-dT-S2EFS-OC22', local_cache='/tmp/ocp_checkpoints/')
checkpoint_path
+
+'/tmp/ocp_checkpoints/gndt_oc22_all_s2ef.pt'
+
+
+
We have to update our configuration yml file with the dataset. It is necessary to specify the train and test set for some reason.
-from fairchem.core.common.tutorial_utils import generate_yml_config
+
+
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Scale factor comment not found in model
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+PosixPath('/home/runner/work/fairchem/fairchem/docs/core/config.yml')
+
+
+
It is a good idea to redirect the output to a file. If the output gets too large here, the notebook may fail to save. Normally I would use a redirect like 2&>1
, but this does not work with the main.py method. An alternative here is to open a terminal and run it there.
-%%capture inference
+%%capture inference
import time
from fairchem.core.common.tutorial_utils import fairchem_main
@@ -734,7 +845,7 @@ Fast batched inference
-with open('mass-inference.txt', 'wb') as f:
+with open('mass-inference.txt', 'wb') as f:
f.write(inference.stdout.encode('utf-8'))
@@ -742,15 +853,20 @@ Fast batched inference
-! grep "Total time taken:" 'mass-inference.txt'
+! grep "Total time taken:" 'mass-inference.txt'
+
+2024-05-17 17:57:55 (INFO): Total time taken: 8.80666995048523
+
+
-The mass inference approach takes 1-2 minutes to run. See the output here.
+
+The mass inference approach takes 1-2 minutes to run. See the output here.
-results = ! grep " results_dir:" mass-inference.txt
+results = ! grep " results_dir:" mass-inference.txt
d = results[0].split(':')[-1].strip()
@@ -758,27 +874,39 @@ Fast batched inference
-import numpy as np
+import numpy as np
results = np.load(f'{d}/ocp_predictions.npz', allow_pickle=True)
results.files
+
+['energy', 'forces', 'chunk_idx', 'ids']
+
+
+
It is not obvious, but the data from mass inference is not in the same order. We have to get an id from the mass inference, and then “resort” the results so they are in the same order.
-inds = np.array([int(r.split('_')[0]) for r in results['ids']])
+inds = np.array([int(r.split('_')[0]) for r in results['ids']])
sind = np.argsort(inds)
inds[sind]
+
+array([ 0, 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])
+
+
+
To compare this with the results, we need to get the energy data from the ase db.
-from ase.db import connect
+from ase.db import connect
db = connect('data.db')
energies = np.array([row.energy for row in db.select('natoms>5,xc=PBE')])
@@ -790,7 +918,7 @@ Fast batched inferenceNow, we can see the predictions. They are only ok here; that is not surprising, the data set has lots of Au configurations that have never been seen by this model. Fine-tuning would certainly help improve this.
-import matplotlib.pyplot as plt
+
+
+
+
@@ -809,15 +940,26 @@ The ASE calculator way
-from fairchem.core.common.relaxation.ase_utils import OCPCalculator
+from fairchem.core.common.relaxation.ase_utils import OCPCalculator
calc = OCPCalculator(checkpoint_path=checkpoint_path, cpu=False)
+
+WARNING:root:Detected old config, converting to new format. Consider updating to avoid potential incompatibilities.
+
+
+WARNING:root:Scale factor comment not found in model
+
+
+WARNING:root:No seed has been set in modelcheckpoint or OCPCalculator! Results may not be reproducible on re-run
+
+
+
-import time
+