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

Đang mở
#397 9 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
28/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python, pytorch
Lĩnh vực
backend, machine-learning

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
502
Fork
108
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TorchSim/torch-sim

Tất cả issue của TorchSim/torch-sim

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.