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

Add Doc Strings to Config Files #465

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

Conversation

ParagEkbote
Copy link
Contributor

@ParagEkbote ParagEkbote commented Dec 19, 2024

As discussed in #247, I've added docstrings to the config class of the required files and updated some of them for enhanced clarity.

Please let me know if any further corrections are needed and I will make the necessary changes.

partially fixes #247

cc: @clefourrier

@ParagEkbote ParagEkbote marked this pull request as ready for review December 20, 2024 10:18
@ParagEkbote ParagEkbote changed the title Add Documentation to Config Files Add Doc Strings to Config Files Dec 20, 2024
Copy link
Member

@clefourrier clefourrier left a comment

Choose a reason for hiding this comment

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

Very nice first draft!
In general, you need to homogeneize a bit (and remove useless words, I explained in the first class but you can apply it to all :)

examples/model_configs/serverless_model.yaml Outdated Show resolved Hide resolved
examples/model_configs/quantized_model.yaml Outdated Show resolved Hide resolved
examples/model_configs/peft_model.yaml Outdated Show resolved Hide resolved
examples/model_configs/base_model.yaml Outdated Show resolved Hide resolved
src/lighteval/models/endpoints/endpoint_model.py Outdated Show resolved Hide resolved
src/lighteval/models/endpoints/tgi_model.py Outdated Show resolved Hide resolved
src/lighteval/models/endpoints/tgi_model.py Outdated Show resolved Hide resolved
src/lighteval/models/transformers/adapter_model.py Outdated Show resolved Hide resolved
src/lighteval/models/transformers/adapter_model.py Outdated Show resolved Hide resolved
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.

thanks for the doc ! Only need to adress a the few comment and this will be good to merge :)

examples/model_configs/quantized_model.yaml Outdated Show resolved Hide resolved
examples/model_configs/serverless_model.yaml Outdated Show resolved Hide resolved
@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.

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.

The syntax of the docstrings is not right. Please note, that the docstring parser is very strict with the syntax conventions: tabs, colons, parentheses,...

You have the syntax examples in the docs-builder repo: https://github.com/huggingface/doc-builder

Also the formatter raises errors: please run make style to align with the linter/formatter conventions.

@ParagEkbote
Copy link
Contributor Author

I will update this PR as draft to fix the syntax errors and update the docstrings correctly as mentioned before.

cc: @albertvillanova

@ParagEkbote ParagEkbote marked this pull request as draft December 31, 2024 11:30
@ParagEkbote ParagEkbote marked this pull request as ready for review January 11, 2025 16:00
@ParagEkbote
Copy link
Contributor Author

Could you please review the changes?

cc: @albertvillanova

@@ -27,7 +27,7 @@
import torch
from transformers import AutoModelForCausalLM, PreTrainedTokenizer

from lighteval.models.transformers.transformers_model import TransformersModel, TransformersModelConfig
from lighteval.models.transformers.base_model import BaseModel, BaseModelConfig
Copy link
Member

Choose a reason for hiding this comment

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

This path is incorrect

Comment on lines +79 to +81
"""
Integrates the adapter models with a pre-trained base model.
"""
Copy link
Member

Choose a reason for hiding this comment

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

To be informative, it would be good to explain what adapter weights are.

Comment on lines +108 to +112
Args:
config(AdapterModelConfig): An instance of AdapterModelConfig.
env_config(EnvConfig): An instance of EnvConfig.

Returns: AutoModelForCasualLM
Copy link
Member

Choose a reason for hiding this comment

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

This is not adding new information, you should remove it

Comment on lines +41 to +43
"""
This class is used to manage the configuration class for delta models.
"""
Copy link
Member

Choose a reason for hiding this comment

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

Explain what delta weights are

Comment on lines +69 to +73
Args:
config(AdapterModelConfig): An instance of AdapterModelConfig.
env_config(EnvConfig): An instance of EnvConfig.

Returns: AutoModelForCasualLM
Copy link
Member

Choose a reason for hiding this comment

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

The args and returns are not adding new ifnformation, remove

env_configs(EnvConfig): An instance of EnvConfig.

Returns:
Any: Result of the configuration initialization.
Copy link
Member

Choose a reason for hiding this comment

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

This is not informative, expand or remove


Attributes:
inference_server_address (str, required):Endpoint address of the inference server hosting the model.
inference_server_auth (str, required): Authentication credentials or tokens required to access the server.
Copy link
Member

Choose a reason for hiding this comment

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

I think it should only be a token

@@ -251,7 +284,7 @@ def _loglikelihood_tokens(
), "Only single token continuations are supported when using openai API."

for i in range(len(dataset)):
logit_bias = {tok: 100 for tok in dataset[i].tokenized_continuation}
logit_bias = dict.fromkeys(dataset[i].tokenized_continuation, 100)
Copy link
Member

Choose a reason for hiding this comment

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

Please leave initial formulation

override_bs (int, optional): Override the batch size for generation. Defaults to None.

Returns:
list[GenerativeResponse]: list of generated responses.
list [GenerativeResponse]: list of generated responses.
Copy link
Member

Choose a reason for hiding this comment

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

Remove extra space

@@ -1,6 +1,6 @@
model:
base_params:
model_args: "pretrained=HuggingFaceTB/SmolLM-1.7B,revision=main" # pretrained=model_name,trust_remote_code=boolean,revision=revision_to_use,model_parallel=True ...
model_args: "pretrained=HuggingFaceH4/zephyr-7b-beta,revision=main" # pretrained=model_name,trust_remote_code=boolean,revision=revision_to_use,model_parallel=True ...
Copy link
Member

Choose a reason for hiding this comment

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

Don't change the default model

@davidberenstein1957
Copy link
Member

@ParagEkbote great job!

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.

[DOC] Document the custom model config files
6 participants