#!/usr/bin/env python3 # /// script # dependencies = ["lighteval", "torch", "transformers", "datasets", "accelerate"] # /// import sys, os MODEL = "Nanthasit/sakthai-plus-1.5b" BASELINE = "Qwen/Qwen2.5-1.5B-Instruct" TASKS = os.environ.get("TASKS") or (sys.argv[2] if len(sys.argv) > 2 else "mmlu|0,gsm8k|0,hellaswag|0,winogrande|0") COMPARE = "--compare" in sys.argv models = [MODEL] if COMPARE: models.append(BASELINE) from lighteval.logging.evaluation_tracker import EvaluationTracker from lighteval.models.transformers.transformers_model import TransformersModelConfig from lighteval.pipeline import ParallelismManager, Pipeline, PipelineParameters for model in models: name = model.split("/")[-1] print(f"\n=== Evaluating {name} ===") evaluation_tracker = EvaluationTracker( output_dir=f"./results/{name}", save_details=True, push_to_hub=False, ) pipeline_params = PipelineParameters( launcher_type=ParallelismManager.ACCELERATE, ) model_config = TransformersModelConfig( model_name=model, dtype="bfloat16", ) pipeline = Pipeline( tasks=TASKS, pipeline_parameters=pipeline_params, evaluation_tracker=evaluation_tracker, model_config=model_config, ) pipeline.evaluate() pipeline.show_results() pipeline.save_and_push_results() results = pipeline.get_results() print(f"\nResults: {results}")