[fix]update license check, update transformers (#10632)

This commit is contained in:
浮梦
2026-07-13 17:30:36 +08:00
committed by GitHub
parent b61140db3e
commit 8489928769
3 changed files with 12 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ dependencies = [
"torch>=2.4.0",
"torchvision>=0.19.0",
"torchaudio>=2.4.0",
"transformers>=4.55.0,<=5.7.0,!=4.57.0,!=5.6.0",
"transformers>=4.55.0,<=5.8.0,!=4.57.0,!=5.6.0",
"datasets>=2.16.0,<=4.0.0",
"accelerate>=1.3.0,<=1.11.0",
"peft>=0.18.0,<=0.18.1",

View File

@@ -94,9 +94,7 @@ def check_version(requirement: str, mandatory: bool = False) -> None:
def check_dependencies() -> None:
r"""Check the version of the required packages."""
check_version("transformers>=4.55.0,<=5.7.0")
check_version("transformers!=4.57.0")
check_version("transformers!=5.6.0")
check_version("transformers>=4.55.0,<=5.8.0,!=4.57.0,!=5.6.0")
check_version("datasets>=2.16.0,<=4.0.0")
check_version("accelerate>=1.3.0,<=1.15.0")
check_version("peft>=0.18.0,<=0.20.0")

View File

@@ -16,7 +16,8 @@ import sys
from pathlib import Path
KEYWORDS = ("Copyright", "2025", "LlamaFactory")
KEYWORDS = ("Copyright", "LlamaFactory")
VALID_YEARS = tuple(str(year) for year in range(2023, 2027))
def main():
@@ -30,8 +31,15 @@ def main():
if not file_content[0]:
continue
first_line = file_content[0]
print(f"Check license: {path}")
assert all(keyword in file_content[0] for keyword in KEYWORDS), f"File {path} does not contain license."
has_keywords = all(keyword in first_line for keyword in KEYWORDS)
has_valid_year = any(year in first_line for year in VALID_YEARS)
assert has_keywords and has_valid_year, (
f"File {path} does not contain a valid license. "
f"Expected 'Copyright', 'LlamaFactory' and a year between 2023-2026 in the first line."
)
if __name__ == "__main__":