ACEsuit / mace

MACE - Fast and accurate machine learning interatomic potentials with higher order equivariant message passing.
Other
412 stars 155 forks source link

select pretrained configs for multihead replay with or without replacement? #432

Open bernstei opened 1 month ago

bernstei commented 1 month ago

https://github.com/ACEsuit/mace/blob/f1be21e1fbd742ab53448b3851b5e1d50abfc04f/mace/cli/fine_tuning_select.py#L243

np.random.choice defaults to replace=True. Do we really want that for this selection call (and the nearby ones)?

bernstei commented 1 month ago

Also, this call fails when the objects in the list are Atoms.

bash-4.4$ cat t
import numpy as np
from ase.atoms import Atoms

l = [Atoms('H2'), Atoms('He2')]
np.random.choice(l, 1)

bash-4.4$ python3 t
Traceback (most recent call last):
  File "/home/cluster2/bernstei/src/work/NiOxHy/fit_iterative_stage_010/_expyre/run_070_MACE_fit_NiOxHy_MACE_fit_lPgYyu05kGnYajeJu5wzBxuJV1094EXFnTzKyVYkb4Y=_pnjs9mxr/run_020_MD_sample/070_MACE_fit/t", line 5, in <module>
    np.random.choice(l, 1)
  File "numpy/random/mtrand.pyx", line 946, in numpy.random.mtrand.RandomState.choice
ValueError: a must be 1-dimensional
bernstei commented 1 month ago

I can fix in a PR, but the answer to the replace=True question affects the way to do it (np.random.randint vs. np.random.choice(list(range(len(...))))