Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ repos:
- "#"
- --allow-past-years
types: [python]
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries=80, --wrap-descriptions=80]
- repo: https://github.com/PyCQA/pydocstyle
hooks:
- id: pydocstyle
Expand Down
6 changes: 5 additions & 1 deletion compose_rl/algorithms/online/model_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ def policy_loss(
logits=gen_logits,
)
assert token_entropies.shape == batch['action_mask'].shape, (
f'Token entropies shape {token_entropies.shape} does not match action mask shape {batch["action_mask"].shape}.',
'Token entropies shape {token_entropies_shape} does not match action mask shape {action_mask_shape}.'
.format(
token_entropies_shape=token_entropies.shape,
action_mask_shape=batch['action_mask'].shape,
),
)
seq_entropies = utils.get_sequence_entropies(
token_entropies=token_entropies,
Expand Down
2 changes: 1 addition & 1 deletion compose_rl/algorithms/reward_modeling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def forward(
batch['input_ids'],
attention_mask=batch['attention_mask'],
).logits
logits = logits[:, :, self.eos_token_id]
logits = logits[:, :, self.eos_token_id] # type: ignore
if self.min_threshold is not None and self.max_threshold is not None:
logits: torch.Tensor = torch.clamp(
logits,
Expand Down
Loading