Scale factor error - Using the IS2RE gemet model -

Running into this error when running tutorial on IS2RE

ValueError: Scale factor OutBlock_4_sum (out_blocks.4.scale_sum) is not fitted. Please make sure that you either (1) load a checkpoint with fitted scale factors, (2) explicitly load scale factors using the model.scale_file attribute, or (3) fit the scale factors using the fit.py script.

Could you help

Hey @dkiiml, it looks like you’re trying to run a GemNet-dT or GemNet-OC model without first fitting scaling factors, hence the error.

These scaling factors are fit on a few batches of data prior to training in order to stabilize the variance of activations. See Sec. 6 in the GemNet paper for more details on this.

We provide some set of scaling factors as part of the ocp codebase that you can reuse by passing the scale_file parameter in the YAML config. For example:

If you change any of the model architecture hyperparameters or the dataset, you should refit these scaling factors:

python ocpmodels/modules/scaling/fit.py \
    --config-yml path/to/my/config.yml \
    --checkpoint path/to/save/checkpoint.pt \
    --mode train

This will recalculate the scaling factors and save them in a checkpoint file path/to/save/checkpoint.pt, that you can then load and launch training from:

python main.py \
    --config-yml path/to/my/config.yml \
    --checkpoint path/to/save/checkpoint.pt \
    --mode train

thank you for your reply

i tried it and it still says scaling is not set.

I’m using IS2RE model
i noticed the training model uses - configs/s2ef/all/gemnet/scaling_factors/gemnet-dT.json

should it use a different json for scaling e.g.

https://github.com/TUM-DAML/gemnet_pytorch/blob/master/scaling_factors.json

The scaling/config/yaml links you shared were from s2ef model - not sure if isre has its a different yaml?

my error still remains on scaling - 2023-09-10 00:28:40 (WARNING): Scale factor OutBlock_0_had not found in model