Skip to content

Commit 1d77989

Browse files
committed
Run formatter, bump version
1 parent 2fd4f6b commit 1d77989

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

prompting/llms/vllm_llm.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ async def generate_logits(
138138
return {}
139139

140140
logprobs = outputs[0].outputs[0].logprobs[0]
141-
token_logprobs = {
142-
self.tokenizer.decode([token]): logprob.logprob for token, logprob in logprobs.items()
143-
}
141+
token_logprobs = {self.tokenizer.decode([token]): logprob.logprob for token, logprob in logprobs.items()}
144142
sorted_token_logprobs = dict(sorted(token_logprobs.items(), key=lambda item: item[1], reverse=True))
145143
return sorted_token_logprobs, prompt
146144

prompting/rewards/exact_match.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import random
22

33
import numpy as np
4-
from loguru import logger
5-
from openai.types.chat import ChatCompletionChunk
64
import torch
75
import torch.nn.functional as F
6+
from loguru import logger
7+
from openai.types.chat import ChatCompletionChunk
88

99
from prompting.llms.model_manager import ModelManager
1010
from prompting.rewards.reward import BaseRewardModel, BatchRewardOutput
@@ -18,7 +18,7 @@
1818
INCORRECT_PENALTY = -2
1919
MIN_SMOOTH_PENALTY_SCALE = 0.6
2020
MIN_TIME_PENALTY_SCALE = 0.3
21-
VERIFICATION_THRESH_CONTAINS = 0.90
21+
VERIFICATION_THRESH_CONTAINS = 0.92
2222
VERIFICATION_THRESH_SIM = 0.90
2323
MIN_VERIFY_TOKENS = 10
2424
MAX_VERIFY_TOKENS = 30
@@ -177,7 +177,7 @@ async def reward(
177177
)
178178
logger.debug(f"Logits rewards: {reward_output.model_dump()}")
179179
return reward_output
180-
180+
181181
@staticmethod
182182
def sample_verification_indices(completion_length: int) -> list[int]:
183183
"""Sample random indices for verification, always add eos_token index."""
@@ -245,7 +245,7 @@ def verify_logit_similarity(
245245
"""Similarity between candidate and ground-truth logprobs."""
246246
if not gt_logits:
247247
return 0.0
248-
248+
249249
if len(candidate_logits) != len(gt_logits):
250250
return 0.0
251251

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "prompting"
3-
version = "2.19.0"
3+
version = "2.19.1"
44
description = "Subnetwork 1 runs on Bittensor and is maintained by Macrocosmos. It's an effort to create decentralised AI"
55
authors = ["Kalei Brady, Dmytro Bobrenko, Felix Quinque, Steffen Cruz, Richard Wardle"]
66
readme = "README.md"

tests/prompting/rewards/test_exact_match.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,4 @@ def test_sample_verification_indices_properties(completion_length):
301301
sample_indices = indices[:-1]
302302
assert all(0 <= idx < completion_length for idx in sample_indices)
303303
# No duplicates overall.
304-
assert len(set(indices)) == len(indices)
304+
assert len(set(indices)) == len(indices)

0 commit comments

Comments
 (0)