Skip to content

Commit c4a3128

Browse files
authored
pip 0.3.4 (#697)
* Update project version to 0.3.4 and enhance setup for license file inclusion in setup.py * lint
1 parent a863517 commit c4a3128

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

lmms_eval/api/task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ def _download_from_youtube(path):
952952
)
953953
zip_files = glob(os.path.join(cache_path, "**/*.zip"), recursive=True)
954954
tar_files = glob(os.path.join(cache_path, "**/*.tar*"), recursive=True)
955-
955+
956956
def unzip_video_data(zip_file):
957957
import os
958958
import zipfile
@@ -995,7 +995,7 @@ def concat_tar_parts(tar_parts, output_tar):
995995
# Group tar parts together
996996
for tar_file in tar_files:
997997
base_name = tar_file.split(".tar")[0]
998-
base_name = re.sub(r'_\d+$', '', base_name)
998+
base_name = re.sub(r"_\d+$", "", base_name)
999999
if base_name not in tar_parts_dict:
10001000
tar_parts_dict[base_name] = []
10011001
tar_parts_dict[base_name].append(tar_file)

lmms_eval/tasks/videoevalpro/utils.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import os
44
import re
55
import sys
6+
import time
67
from collections import defaultdict
78
from pathlib import Path
89
from typing import Dict, List, Optional, Union
910

1011
import cv2
1112
import numpy as np
13+
import openai
1214
import yaml
1315
from loguru import logger as eval_logger
14-
import openai
15-
import time
1616

1717
from lmms_eval.tasks._task_utils.file_utils import generate_submission_file
1818

@@ -71,19 +71,12 @@ def __call__(self, question: str, target: str, predicted_answer: str) -> bool:
7171
Grade the predicted answer ofthe question as one of: A: CORRECT B: INCORRECT C: NOT_ATTEMPTED Just return the letter "A", "B", or "C", with no text around it.
7272
""".strip()
7373

74-
response = self.client.chat.completions.create(
75-
model=self.model_name,
76-
messages=[
77-
{"role": "user", "content": prompt}
78-
],
79-
temperature=0,
80-
max_tokens=5
81-
)
74+
response = self.client.chat.completions.create(model=self.model_name, messages=[{"role": "user", "content": prompt}], temperature=0, max_tokens=5)
8275

8376
answer = response.choices[0].message.content.strip()
8477
# print(f"---------------------->>>>gpt answer: {answer}")
8578
return answer[0].upper() == "A"
86-
79+
8780

8881
def safe_judge_with_retry(model, question, gt, pred, max_retries=10, delay=2):
8982
for attempt in range(max_retries):
@@ -95,9 +88,11 @@ def safe_judge_with_retry(model, question, gt, pred, max_retries=10, delay=2):
9588
print(f"All {max_retries} attempts failed.")
9689
return {"correct": False, "reason": "Failed after multiple retries"}
9790

91+
9892
def safe_strip(x):
9993
return x.strip() if isinstance(x, str) else ""
10094

95+
10196
def videoevalpro_process_results(doc, results):
10297
"""
10398
Args:
@@ -141,14 +136,14 @@ def videoevalpro_aggregate_results(results):
141136
# overall score
142137
category2score["overall"]["answered"] += 1
143138
category2score["overall"]["correct"] += result["judge_result"] == True
144-
139+
145140
final_scores = {}
146141
for task_type, score in category2score.items():
147142
if score["answered"] > 0:
148143
final_scores[task_type] = score["correct"] / score["answered"]
149144
else:
150145
final_scores[task_type] = 0.0
151-
146+
152147
eval_logger.info(f"Final scores: {final_scores}")
153-
148+
154149
return final_scores

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "lmms_eval"
10-
version = "0.3.0"
10+
version = "0.3.4"
1111
authors = [
1212
{ name = "LMMMs-Lab Evaluation Team", email = "[email protected]" },
1313
]
1414
description = "A framework for evaluating large multi-modality language models"
1515
readme = "README.md"
16+
license = { file = "LICENSE" }
1617
classifiers = [
1718
"Programming Language :: Python :: 3",
1819
"License :: OSI Approved :: MIT License",
1920
"Operating System :: OS Independent",
2021
]
2122
requires-python = ">=3.12"
22-
license = { text = "MIT" }
2323
dependencies = [
2424
"accelerate>=0.29.1",
2525
"black>=24.1.0",

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import setuptools
2+
from setuptools import setup
23

34
# This is to make sure that the package supports editable installs
4-
setuptools.setup()
5+
if __name__ == "__main__":
6+
setuptools.setup(
7+
license_files=["LICENSE"],
8+
)

0 commit comments

Comments
 (0)