Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/track raw score #63

Merged
merged 27 commits into from
Nov 9, 2023

Conversation

isabella618033
Copy link
Collaborator

No description provided.

@isabella618033 isabella618033 changed the base branch from main to features/ngram-blacklist November 8, 2023 00:13
Copy link
Contributor

@p-ferreira p-ferreira left a comment

Choose a reason for hiding this comment

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

What if we streamline the whole process into an abstraction where:

  • get_rewards return a BaseRewardEvent,
  • BaseRewardModel.apply returns a BaseRewardEvent
  • BaseRewardEvent has the logic to convert it itself into a dictionary, from which we can spread its properties later in the forward call and in the event schema
  • Complement the event schema with the expected new fields

prompting/validators/reward/dahoas.py Outdated Show resolved Hide resolved
prompting/validators/forward.py Outdated Show resolved Hide resolved
prompting/validators/reward/diversity.py Outdated Show resolved Hide resolved
prompting/validators/reward/nsfw.py Outdated Show resolved Hide resolved
Copy link
Contributor

@p-ferreira p-ferreira left a comment

Choose a reason for hiding this comment

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

LGTM (BTW I set the PR as ready for review by accident, apologies for that)

One thing missing though:

  • Fixing branch conflicts

@p-ferreira p-ferreira marked this pull request as ready for review November 8, 2023 22:26
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
prompting/validators/reward/dpo.py Outdated Show resolved Hide resolved
with torch.no_grad():
inputs = self.tokenizer(prompt, completion, return_tensors="pt").to(
self.device
)
return float(self.model(**inputs).logits[0].cpu().detach())
reward_event.reward = float(self.model(**inputs).logits[0].cpu().detach())
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be reward_event.score since its float? where is reward_event.reward:Bool?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

rlhf is a reward model (not filter model), so there is no bool reward, and the score = reward

isabella618033 and others added 7 commits November 8, 2023 18:32
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
isabella618033 and others added 3 commits November 8, 2023 18:34
Co-authored-by: Steffen Cruz <steffenjcruz@gmail.com>
@p-ferreira p-ferreira mentioned this pull request Nov 9, 2023
@p-ferreira p-ferreira merged commit beab14a into features/ngram-blacklist Nov 9, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants