Skip to content

Overhauling perturbations to support custom perturbations#26

Merged
iterix merged 10 commits intomainfrom
feature/perturbation_overhaul
Jul 3, 2023
Merged

Overhauling perturbations to support custom perturbations#26
iterix merged 10 commits intomainfrom
feature/perturbation_overhaul

Conversation

@iterix
Copy link
Contributor

@iterix iterix commented Jun 28, 2023

This PR introduces Perturbations base class that can be inherited to create custom perturbations this addressing #15

As part of this I also re-wrote the Paraphrase perturbations and fixed the error reported in #23 by @mshergad

return Paraphrase._process_similar_sentence_reponse(response)

@staticmethod
def _process_similar_sentence_reponse(response):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mshergad This should address the bug you reported for paraphrasing single sentences. At a later point we should add a class that can paraphrase multi-line prompts.

@iterix iterix self-assigned this Jun 28, 2023
@iterix iterix added the enhancement New feature or request label Jun 28, 2023
This was linked to issues Jun 28, 2023
@iterix
Copy link
Contributor Author

iterix commented Jun 28, 2023

@tspthomas @lior-fiddler This PR allows users to define their own perturbations. Let me know if you have any thoughts


def test_paraphrase(self):
for prompt in TRUTHFUL_DATASET:
sim_prompt = self.perturber.perturb(prompt)
Copy link
Contributor

@lior-fiddler lior-fiddler Jun 29, 2023

Choose a reason for hiding this comment

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

under the hood the test will hit openai APIs, no ? should we mock out the openai call and return a pre-canned sample response ? i.e. avoid any side effects and slowness of calling external APIs in a test (assuming what we really want to test here is the parsing logic and the handling of the response)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we need to de-couple unit-tests from end-to-end testing. I created a separate ticket to resolve this #27

@iterix iterix merged commit 483e508 into main Jul 3, 2023
@iterix iterix deleted the feature/perturbation_overhaul branch July 3, 2023 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sentence parsing has a bug Add support for custom perturbations

2 participants