IntelLabs/matsciml

[Feature request]: Allow user specified reductions for embeddings

laserkelvin opened this issue · 1 comments

Feature/behavior summary

In certain instances it is desirable to have some flexibility in choice of embedding/output reduction. This line shows that mean reduction is hardcoded for process_embeddings.

Request attributes

  • Would this be a refactor of existing code?
  • Does this proposal require new package dependencies?
  • Would this change break backwards compatibility?
  • Does this proposal include a new model?
  • Does this proposal include a new dataset?
  • Does this proposal include a new task/workflow?

Related issues

#72 model definition uses a summation over intermediate layer energies/embeddings for their definition.

Solution description

The proposal is to provide an hparams argument for setting the reduction:

reduce_method = self.hparams.get("embedding_reduction", "mean")
output = reduce(output, "b ... d -> b d", reduction=reduce_method)

Additional notes

@Vaibhav525 this will need to be merged to get the "proper" MACE behavior. This doesn't prevent #72 from being merged now since the changes are modular.

Addressed by #86