Feature suggestion: lifecycle hooks for user-defined callbacks during simulations

Abierto
#397 9 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
28/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python, pytorch

Línea de trabajo

This is a design request for user callbacks on the simulation step path (the issue sketches step_func(..., callbacks=...) and a SimState check). Start by locating how steps, neighbor tiling, and convergence are implemented in the torch-sim codebase and how SimState is passed today. Done means a documented, extensible hook API plus tests that a callback can inspect state, mutate params, or abort with a reason—not a one-off tiling guard. Expect maintainer design discussion before coding.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

api ecosystem enhancement feature

context

about 1 in 1e5 geometry optimizations goes off the rails (usually an issue with FIRE step size or MLIP stress preds) causing the cell to distort in strange ways, volume collapses, edge count explodes → OOM. this can bring down nodes doing long-running structure searches.

a possible current workaround is modifying the convergence check to monitor how many times the cell gets tiled for neighbor list construction and abort if it exceeds some threshold (e.g. 1k).

proposal

would be useful to have a general concept of lifecycle hooks in torch-sim that allows users to pass arbitrary callback functions. these could:

  • perform custom sanity checks at every N-th step (N user-defined) (based on as many sim params as torch-sim can provide: cell volume, edge count, neighbor list tiling, etc.)
  • modify sim params on the fly (e.g. reduce timestep if things look unstable)
  • abort early with a user-intelligible reason if sim looks unrecoverable

something like:

def my_check(state: SimState) -> bool | str:
    if state.neighbor_tiles > 1000:
        return "cell tiling exceeded 1k, aborting"
    return True  # continue

result = step_func(state, model, ..., callbacks=[my_check])

a general callback mechanism would let:

  • users define domain-specific guardrails
  • future tools (think custodian for MD) tap into the sim lifecycle
  • debugging/logging without modifying torch-sim internals

tagging @kyonofx who brought up the dying nodes in our cluster, briefly discussed this with @abhijeetgangan

Lenguaje dominante
Python
Estrellas
502
Forks
108
Merge medio
1 d 1 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TorchSim/torch-sim

Todos los issues de TorchSim/torch-sim

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.