Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kirupang-code
Copy link
Contributor

Description of changes: I created a new configurable parameter called logical_operator that accepts "OR" (as default) and "AND" in FactualKnowledgeConfig. I added checks so that when the logical_operator is "AND", all possible target outputs must be included in model generation in order for the answer to be correct. I also updated all of the current configurations, and created new unit tests to check for behavior given invalid configurations and scores for valid inputs.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@xiaoyi-cheng xiaoyi-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good, just some minor fixes needed

:param output_key: The key corresponding to the factual knowledge score that
will be added to the input record.
:param target_output_delimiter: See the docstring in `FactualKnowledgeConfig`.
:param logical_operator: See the docstring in `FactualKnowledgeConfig`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not refer to other config param.

raise EvalAlgorithmClientError(
"Empty target_output_delimiter is provided. Please either provide a non-empty string, or set it to None."
)
if self.logical_operator != "OR" and self.logical_operator != "AND":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

if self.logical_operator not in ["OR", "AND"]:

os.environ["PARALLELIZATION_FACTOR"] = "2"

config = FactualKnowledgeConfig("<OR>")
config = FactualKnowledgeConfig("<OR>", "OR")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do not change this config, the exist tests should also pass, right?

Copy link
Contributor Author

@kirupang-code kirupang-code Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup! I just wanted to add "OR" becuase "<OR>" was also there

polaschwoebel
polaschwoebel previously approved these changes Jul 12, 2024
Copy link
Contributor

@polaschwoebel polaschwoebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one comment:

As discussed before, in my opinion the user experience would be better if target_output_delimiter and logical_operator where linked:

  • logical_operator = "OR" implies target_output_delimiter=<OR> and
  • logical_operator = "AND" implies target_output_delimiter=<AND>.

Is it possible to set the default target_output_delimiter dynamically based on the logical_operator? Alternatively we could raise a warning when the user modifies the logical_operator to "AND" but keeps the target_output_delimiter as <OR>.

model_input="Who is Andrew R. Jassy?",
model_output="Chief Executive Officer of Amazon.com Inc.",
target_output="Chief Executive Officer of Amazon.com, Inc.",
delimiter="<OR",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delimiter is different here (doesn't matter functionally but could be confusing?)

Copy link
Contributor

@xiaoyi-cheng xiaoyi-cheng Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@polaschwoebel We will work towards to change target_output (ground_truth) a list as the Ray issue is solved, then the delimiter should go away and there won't be conflict.
Similar to context(s): #305

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Here, I simply meant "" vs "<OR" (small typo in the code above).

Copy link
Contributor

@xiaoyi-cheng xiaoyi-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, just couple changes needed to improve the unit test

Copy link
Contributor

@xiaoyi-cheng xiaoyi-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing all the comments! LGTM

Copy link
Contributor

@polaschwoebel polaschwoebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments addressed!

@xiaoyi-cheng xiaoyi-cheng merged commit 5e70ca7 into aws:main Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants