From dd9954b4f3ab8bf10f058eafe5ddfac201fe0094 Mon Sep 17 00:00:00 2001 From: Atsunori Fujita Date: Fri, 18 Oct 2024 09:33:03 +0000 Subject: [PATCH 1/2] Fix #349 Signed-off-by: Atsunori Fujita --- examples/nlp/data/steerlm/attribute_annotate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/nlp/data/steerlm/attribute_annotate.py b/examples/nlp/data/steerlm/attribute_annotate.py index 51af3dbdf..36cab2c11 100644 --- a/examples/nlp/data/steerlm/attribute_annotate.py +++ b/examples/nlp/data/steerlm/attribute_annotate.py @@ -71,7 +71,8 @@ def get_reward( reward_out = output_dict["rewards"].flatten().tolist() all_rewards.append(reward_out) - all_exceeded += output_dict["exceeded"].tolist() + if output_dict.get('exceeded', None) is not None: + all_exceeded += output_dict["exceeded"].tolist() return all_rewards, all_exceeded From 891959de77a08868d42f1c7b603768d2c253adad Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:54:29 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/nlp/data/steerlm/attribute_annotate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nlp/data/steerlm/attribute_annotate.py b/examples/nlp/data/steerlm/attribute_annotate.py index 36cab2c11..4aec4bd48 100644 --- a/examples/nlp/data/steerlm/attribute_annotate.py +++ b/examples/nlp/data/steerlm/attribute_annotate.py @@ -71,7 +71,7 @@ def get_reward( reward_out = output_dict["rewards"].flatten().tolist() all_rewards.append(reward_out) - if output_dict.get('exceeded', None) is not None: + if output_dict.get("exceeded", None) is not None: all_exceeded += output_dict["exceeded"].tolist() return all_rewards, all_exceeded