Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Enh: Make sure shuffle order is deterministic

Kilian Lieret0124d47aad2e
diff --git a/sweagent/run/batch_instances.py b/sweagent/run/batch_instances.py
index 3439645a..09d42b6c 100644
--- a/sweagent/run/batch_instances.py
+++ b/sweagent/run/batch_instances.py
@@ -61,7 +61,7 @@ def _filter_batch_items(
instances: list[BatchInstance], *, filter_: str, slice_: str = "", shuffle: bool = False
) -> list[BatchInstance]:
if shuffle:
- instances = instances.copy()
+ instances = sorted(instances.copy(), key=lambda x: random.random())
random.seed(42)
random.shuffle(instances)
before_filter = len(instances)