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

Added logprobs to vllm and nemo #264

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
691a0c6
Allow for not passing prompt config/template
shtoshni Nov 5, 2024
c1d49d5
Allow for not passing prompt config/template
shtoshni Nov 5, 2024
0f24697
Merge branch 'main' into gen_rm
shtoshni Nov 6, 2024
805ed64
Prompt config for math generative RM
shtoshni Nov 7, 2024
2df0e4b
Merge branch 'main' into gen_rm
shtoshni Nov 11, 2024
73a77a1
added include_generation parameter to generation config
i-vainn Nov 11, 2024
52e4290
modified conf template
i-vainn Nov 12, 2024
9d7e9ae
make vllm return logprobs
i-vainn Nov 15, 2024
d03a33f
Merge branch 'main' into imoshkov/continue_generation
i-vainn Nov 22, 2024
34185ad
new prompt template
i-vainn Nov 22, 2024
8e06822
merged with main
i-vainn Nov 25, 2024
ea6691e
added logprobs param
i-vainn Nov 25, 2024
f55bfc2
added logprobs param
i-vainn Nov 25, 2024
fca3203
Merge branch 'main' into imoshkov/continue_generation
i-vainn Nov 25, 2024
0244e1b
Merge branch 'imoshkov/continue_generation' into imoshkov/debiasing_a…
i-vainn Nov 25, 2024
c25368f
added logprobs inference param
i-vainn Nov 25, 2024
12add35
attempted to add nemo logprobs
i-vainn Nov 25, 2024
1bbaf6d
removed exp files from commit
i-vainn Nov 25, 2024
d779ef1
added template
i-vainn Nov 26, 2024
326b2d5
Merging with main
shtoshni Dec 5, 2024
8f95d7a
Merging with main
shtoshni Dec 6, 2024
b27a08f
Merge branch 'gen_rm' into imoshkov/debiasing_answer
shtoshni Dec 6, 2024
c56227d
Fixing model implementation
shtoshni Dec 6, 2024
d6525a1
merged with main
i-vainn Dec 9, 2024
5d52ebf
Merge branch 'main' into imoshkov/debiasing_answer
shtoshni Dec 19, 2024
ba944fe
Merge branch 'main' into imoshkov/debiasing_answer
shtoshni Dec 19, 2024
5fb2ace
Logprobs for gen rm
shtoshni Dec 22, 2024
51147e0
Reward model score support
shtoshni Jan 13, 2025
3dd9e54
merged
i-vainn Jan 14, 2025
0bfe6f0
merged with main
i-vainn Jan 14, 2025
cc0d128
merged with main
i-vainn Feb 3, 2025
c4b5cda
fix merge
i-vainn Feb 3, 2025
8fdd18b
fix merge
i-vainn Feb 3, 2025
acae93f
fix
i-vainn Feb 3, 2025
4a0701e
enabled trt logprobs
i-vainn Feb 3, 2025
013613f
enabled trt logprobs
i-vainn Feb 3, 2025
8ab3732
modified include generation logic
i-vainn Feb 3, 2025
35b85ae
fix
i-vainn Feb 3, 2025
7b2f5af
minor fixes
i-vainn Feb 4, 2025
470b4a1
started logporbs refactoring, wip
i-vainn Feb 4, 2025
835decb
trt fix
i-vainn Feb 4, 2025
7aff1d5
trt fix
i-vainn Feb 4, 2025
dedc694
Merge branch 'imoshkov/debiasing_answer' into imoshkov/logprobs_wip
i-vainn Feb 4, 2025
470e955
completed refactoring
i-vainn Feb 4, 2025
d00ffe4
quick fix
i-vainn Feb 4, 2025
ba91774
quick fix
i-vainn Feb 4, 2025
bad1fab
quick fix
i-vainn Feb 4, 2025
e6e9a3e
merged with main
i-vainn Feb 4, 2025
e0a33ff
minor naming fixes
i-vainn Feb 5, 2025
4944d66
removed rm related things from pr
i-vainn Feb 5, 2025
0aafec4
make nemo return full tokens
i-vainn Feb 5, 2025
7d5c82b
fixed nemo generation handling
i-vainn Feb 6, 2025
0afb319
added inference tests
i-vainn Feb 6, 2025
395d561
merged with main
i-vainn Feb 6, 2025
f2aecfe
fixed tests
i-vainn Feb 7, 2025
190ffca
fixed tests
i-vainn Feb 7, 2025
4379a29
removed tmp change
i-vainn Feb 7, 2025
ed9bc8d
merged with main
i-vainn Feb 10, 2025
a944d33
fixed logprobs tests
i-vainn Feb 10, 2025
03e515b
fixed tests
i-vainn Feb 10, 2025
a31fbcf
fixed nemo num_generated_tokens issue
i-vainn Feb 11, 2025
2daad96
fixed logprobs test
i-vainn Feb 11, 2025
a0738d8
Merge branch 'main' into imoshkov/debiasing_answer
i-vainn Feb 11, 2025
5e52e19
fixed logprobs tests
i-vainn Feb 11, 2025
d74d046
Merge branch 'main' into imoshkov/debiasing_answer
i-vainn Feb 13, 2025
d1d54b7
minor fixes
i-vainn Feb 13, 2025
83fbe29
Merge branch 'main' into imoshkov/debiasing_answer
i-vainn Feb 16, 2025
ca6b979
test fixes
i-vainn Feb 16, 2025
e521b5a
test fix
i-vainn Feb 16, 2025
b3fc4c2
test fix
i-vainn Feb 17, 2025
9870151
fix
i-vainn Feb 17, 2025
2dc56f8
fix
i-vainn Feb 18, 2025
281e137
fix
i-vainn Feb 18, 2025
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
3 changes: 3 additions & 0 deletions nemo_skills/inference/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class InferenceConfig:
random_seed: int = 0
tokens_to_generate: int = 2048
repetition_penalty: float = 1.0
top_logprobs: int | None = None


@nested_dataclass(kw_only=True)
Expand All @@ -56,6 +57,7 @@ class GenerateSolutionsConfig:
prompt_template: str | None = None # not required for OpenAI server
prompt_config: str | None = None # we will fetch it from dataset dir if not provided
prefix_generation_to_response: bool = False # whether to include "generation" as prefix to the response
continue_prefix_generation: bool = False # if True, model will be prompted to continue "generation" without closing assistant tag

examples_type: str | None = None # to be able to customize few-shot examples
inference: InferenceConfig = field(default_factory=InferenceConfig) # LLM call parameters
Expand Down Expand Up @@ -318,6 +320,7 @@ def fill_prompt(self, data_point, data):
data_point,
multi_turn_key=self.cfg.multi_turn_key,
prefix_generation_to_response=self.cfg.prefix_generation_to_response,
continue_prefix_generation=self.cfg.continue_prefix_generation,
)

def llm_generate(self, data_points, data, is_async=False):
Expand Down
6 changes: 6 additions & 0 deletions nemo_skills/inference/server/code_execution_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ def _generate_single(
repetition_penalty: float,
random_seed: int,
stop_phrases: list[str] | None = None,
top_logprobs: int | None = None,
):
if not isinstance(prompt, str):
raise NotImplementedError("OpenAI API is not supported yet.")
if top_logprobs is not None: # TODO: add this
raise NotImplementedError("top_logprobs is not supported yet.")

if stop_phrases is None:
stop_phrases = []
Expand Down Expand Up @@ -133,6 +136,7 @@ def generate_async(
random_seed: int | list[int] = 0,
stop_phrases: list[str] | list[list[str]] | None = None,
remove_stop_phrases: bool = True,
top_logprobs: int | list[int] | None = None,
) -> list[dict]:
"""For any generation parameter you can specify a list of values that needs to match the number of prompts.

Expand All @@ -141,6 +145,8 @@ def generate_async(
# TODO: currently nemo server would get separate 1-batch requests, which is likely really inefficient
# but the alternative is to have a fully separate implementation, which is also not nice
# If we find ourselves needing to use nemo with code execution often, we should fix this
if top_logprobs is not None: # TODO: add this
raise NotImplementedError("top_logprobs is not supported yet.")
kwargs = {
'code_begin': code_begin,
'code_end': code_end,
Expand Down
Loading
Loading