Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions areal/api/reward_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def reward_fn(
:param completion_ids: The token IDs of the trajectory generated by the model.
:param kwargs: Other attributes of the data in the dataset, such as solutions, input_outputs, etc.
Any other attributes in the dataset will be passed as keyword arguments to this function.
:rtype: float
:rtype: float | dict[str, float]
"""


Expand Down Expand Up @@ -135,7 +135,7 @@ def _recreate_executor(cls, executor_key, max_workers):
return cls._executors[executor_key]
return None

async def __call__(self, *args, **kwargs) -> float:
async def __call__(self, *args, **kwargs) -> float | dict[str, float]:
last_exception = None

for attempt in range(self.max_retries + 1):
Expand Down
6 changes: 6 additions & 0 deletions areal/infra/remote_inf_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ async def arun_episode(
"trajectories returned None, using remaining results"
)

aggregate_group_results = getattr(
self.workflow, "aggregate_group_results", None
)
if callable(aggregate_group_results):
return aggregate_group_results(valid_results)

# Check if results are InteractionWithTokenLogpReward dicts
first = valid_results[0]
if (
Expand Down
Loading