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

Homogeneize generation params #428

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

clefourrier
Copy link
Member

@clefourrier clefourrier commented Dec 9, 2024

This PR does 3 things:

  • Provide an homogeneized API for people to use to provide model generation parameters in model configs. Those parameters are notably provided to all models which can take them (vllm, open ai, tgi, transformers, ...)
  • Renames BaseModel to TransformersModel
  • Also allows TransformersModels to use a transformers.GenerationConfig object directly, when created programmatically

I would put system_prompt, fewshot_seeds, and use_chat_template in the GenerationParameters too since they are generation parameters logically, but it can be another PR

Closes #16

@clefourrier clefourrier changed the base branch from main to refacto_model December 9, 2024 14:31
@HuggingFaceDocBuilderDev
Copy link
Collaborator

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@clefourrier clefourrier force-pushed the clem_homogeneize_generation_params branch from 071d502 to 286668f Compare December 10, 2024 13:55
@clefourrier
Copy link
Member Author

Interestingly, using an explicit generation config seems to mess up this quite a lot

@clefourrier clefourrier requested a review from NathanHB December 12, 2024 13:14
Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Great! I only reviewed it partially. Some comments below.

src/lighteval/models/transformers/transformers_model.py Outdated Show resolved Hide resolved
src/lighteval/models/transformers/transformers_model.py Outdated Show resolved Hide resolved
Co-authored-by: Nathan Habib <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
@clefourrier clefourrier requested a review from NathanHB December 18, 2024 14:34
Copy link
Member

@NathanHB NathanHB left a comment

Choose a reason for hiding this comment

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

nice to have a coherent config, few nits and good to go

src/lighteval/models/vllm/vllm_model.py Outdated Show resolved Hide resolved
src/lighteval/models/transformers/transformers_model.py Outdated Show resolved Hide resolved
src/lighteval/models/transformers/transformers_model.py Outdated Show resolved Hide resolved
@@ -124,6 +127,8 @@ class BaseModelConfig:
model at a quantized precision. Needed for 4-bit and 8-bit precision.
trust_remote_code (bool): Whether to trust remote code during model
loading.
generation_parameters (GenerationParameters): Range of parameters which will affect the generation.
generation_config (GenerationConfig): GenerationConfig object (only passed during manual creation)
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why we have both generation paramaters and config ?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you want to manually create/load your own model (in Python, not using the CLI), you might want to provide it's generation_config directly instead of using the ligtheval generation parameters class

src/lighteval/main_accelerate.py Show resolved Hide resolved
src/lighteval/models/model_input.py Outdated Show resolved Hide resolved
src/lighteval/models/model_input.py Outdated Show resolved Hide resolved
src/lighteval/models/model_input.py Outdated Show resolved Hide resolved
src/lighteval/main_endpoint.py Outdated Show resolved Hide resolved
@clefourrier clefourrier requested a review from NathanHB December 26, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing a GenerationConfig for generative evals
4 participants