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]
Ensure that model log gets saved to file
Kilian Lieret08fe652668bd
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex 14d369e9..c4d510a6 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -295,7 +295,7 @@ class Agent:@propertydef attempt_model_stats(self) -> InstanceStats:"""Model stats of the current attempt"""- total_stats = self.model.stats+ total_stats = copy.deepcopy(self.model.stats)for attempt_idx in range(self._i_attempt):total_stats -= InstanceStats.model_validate(self._info_by_attempt[attempt_idx]["model_stats"]) # type: ignorereturn total_stats@@ -321,6 +321,12 @@ class Agent:"""self._problem_statement = problem_statementself._env = env+ iid = self._problem_statement.id+ try:+ # This ensures that the file handler is added to the model's logger+ self.model.logger.name = f"swea-lm-{iid}"+ except AttributeError:+ pass# Save/reset some attributesself.traj_path = output_dir / (self._problem_statement.id + ".traj")