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

Use the programmatic interface using an already in memory loaded model #390

Merged
merged 9 commits into from
Nov 19, 2024

Conversation

clefourrier
Copy link
Member

@clefourrier clefourrier commented Nov 12, 2024

To test the PR

import lighteval
import os
from datetime import timedelta
from transformers import AutoModelForCausalLM

from lighteval.logging.evaluation_tracker import EvaluationTracker
from lighteval.logging.hierarchical_logger import hlog_warn, htrack
from lighteval.models.model_config import create_model_config
from lighteval.pipeline import EnvConfig, ParallelismManager, Pipeline, PipelineParameters
from lighteval.utils.imports import is_accelerate_available, is_tgi_available

TOKEN = os.getenv("HF_TOKEN")
    
model = AutoModelForCausalLM.from_pretrained("trl-lib/Qwen2-0.5B-DPO")

env_config = EnvConfig(token=TOKEN, cache_dir="~/tmp")
evaluation_tracker = EvaluationTracker(
    output_dir="~/tmp",
    save_details=False,
    push_to_hub=False,
    push_to_tensorboard=False,
    public=False,
    hub_results_org=False,
)
pipeline_params = PipelineParameters(
    launcher_type=ParallelismManager.ACCELERATE,
    env_config=env_config,
    job_id=1,
    override_batch_size=1,
    num_fewshot_seeds=0,
    max_samples=10,
    use_chat_template=False,
)

pipeline = Pipeline(
    tasks="leaderboard|arc:challenge|0|0",
    pipeline_parameters=pipeline_params,
    evaluation_tracker=evaluation_tracker,
    model=model
)

pipeline.evaluate()

pipeline.show_results()

@clefourrier
Copy link
Member Author

clefourrier commented Nov 12, 2024

Ideally, we would want to migrate a bunch of params from the ModelParams to the PipelineParams:

  • multichoice_continuations_start_space
  • pairwise_tokenization
  • add_special_tokens
  • use_chat_template
  • trust_remote_code
  • batch_size

Would simplify model config code. Wdyt @NathanHB ? (Should probably be another PR)

src/lighteval/models/base_model.py Show resolved Hide resolved
src/lighteval/models/base_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.

Tested it locally and looks great !!

@clefourrier
Copy link
Member Author

Cool! Waiting for some last feedback from Lewis and will merge afterwards

@clefourrier clefourrier merged commit db609f7 into main Nov 19, 2024
2 checks passed
hynky1999 pushed a commit that referenced this pull request Nov 29, 2024
#390)



---------

Co-authored-by: Nathan Habib <30601243+NathanHB@users.noreply.github.com>
@clefourrier clefourrier mentioned this pull request Nov 30, 2024
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.

2 participants