Open
Conversation
PaParaZz1
requested changes
Nov 15, 2023
ding/bonus/ppof.py
Outdated
| from .model import PPOFModel | ||
| from .config import get_instance_config, get_instance_env, get_hybrid_shape | ||
| from ding.bonus.common import TrainingReturn, EvalReturn | ||
| from ..framework.middleware.collector import ChatCollector |
| """ | ||
| Overview: | ||
| The class of the collector running by steps, including model inference and transition \ | ||
| process. Use the `__call__` method to execute the whole collection process. |
ding/model/common/utils.py
Outdated
|
|
||
| def top_p_logits(logits, topp=0.9, filter_value=0, min_topk=1): | ||
| """ | ||
| Filter a distribution of logits using nucleus (top-p) filtering |
Member
There was a problem hiding this comment.
polish comments add add unittest
ding/model/common/utils.py
Outdated
| if topp > 0: | ||
| logits_sorted, inds = torch.sort(logits, dim=-1, descending=True) | ||
| mask = (logits_sorted.cumsum(dim=-1) - logits_sorted) >= topp | ||
| mask[:, :min_topk] = False |
ding/model/template/vac.py
Outdated
| @@ -1,4 +1,7 @@ | |||
| from typing import Union, Dict, Optional | |||
|
|
|||
Member
There was a problem hiding this comment.
move these modifications to a new single file: lm_vac.py
|
|
||
| def __init__(self, config, opt, tokenizer): | ||
| super().__init__(config) | ||
| self.opt = opt |
| else: | ||
| logits = self.reward_head(output.last_hidden_state).squeeze(-1) | ||
|
|
||
| return (logits, ) |
| self._init_flag = False | ||
|
|
||
| def reset(self): | ||
| self.last_batch = next(self.generator) |
Member
There was a problem hiding this comment.
Do you need to restrat generatore here?
|
|
||
| class LlamaRewardModel(LlamaForCausalLM): | ||
|
|
||
| def __init__(self, config, opt, tokenizer): |
Member
There was a problem hiding this comment.
Should we move the creation of tokenizer insides the constructor of RM?
| @@ -0,0 +1,50 @@ | |||
| from easydict import EasyDict | |||
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #748 +/- ##
==========================================
+ Coverage 76.78% 76.83% +0.04%
==========================================
Files 671 674 +3
Lines 53196 53935 +739
==========================================
+ Hits 40847 41440 +593
- Misses 12349 12495 +146
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue
TODO
Check List