Skip to content

Feat: add natom upper limit for binary search #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lambench/tasks/calculator/calculator_tasks.yml
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ inference_efficiency:
test_data: /bohr/lambench-efficiency-rg7a/v3/efficiency
calculator_params:
warmup_ratio: 0.1
natoms_upper_limit: 850
torsionnet:
test_data: /bohr/lambench-torsionnet-e4sc/v2/torsionnet500_wB97m
calculator_params: null
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@


def run_inference(
model: ASEModel, test_data: Path, warmup_ratio: float
model: ASEModel, test_data: Path, warmup_ratio: float, natoms_upper_limit: int
) -> dict[str, dict[str, float]]:
"""
Inference for all trajectories, return average time and success rate for each system.
@@ -26,7 +26,9 @@ def run_inference(
for traj in trajs:
system_name = traj.name
try:
system_result = run_one_inference(model, traj, warmup_ratio)
system_result = run_one_inference(
model, traj, warmup_ratio, natoms_upper_limit
)
average_time = system_result["average_time"]
std_time = system_result["std_time"]
success_rate = system_result["success_rate"]
@@ -52,6 +54,7 @@ def run_one_inference(
model: ASEModel,
test_traj: Path,
warmup_ratio: float,
natoms_upper_limit: int,
) -> dict[str, float]:
"""
Infer for one trajectory, return averaged time and success rate, starting timing at warmup_ratio.
@@ -65,7 +68,7 @@ def run_one_inference(
efficiency = []
for i, atoms in enumerate(test_atoms):
# find maximum allowed natoms
max_natoms = binary_search_max_natoms(model, atoms)
max_natoms = binary_search_max_natoms(model, atoms, natoms_upper_limit)
# on-the-fly expand atoms
scaling_factor = np.int32(np.floor(max_natoms / len(atoms)))
while 1 in find_even_factors(scaling_factor) and scaling_factor > 1: