mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-07-28 11:46:09 +08:00
[fix]update license check, update transformers (#10632)
This commit is contained in:
@@ -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__":
|
||||
|
||||
Reference in New Issue
Block a user