[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

@@ -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__":