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:
@@ -40,7 +40,7 @@ dependencies = [
|
|||||||
"torch>=2.4.0",
|
"torch>=2.4.0",
|
||||||
"torchvision>=0.19.0",
|
"torchvision>=0.19.0",
|
||||||
"torchaudio>=2.4.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",
|
"datasets>=2.16.0,<=4.0.0",
|
||||||
"accelerate>=1.3.0,<=1.11.0",
|
"accelerate>=1.3.0,<=1.11.0",
|
||||||
"peft>=0.18.0,<=0.18.1",
|
"peft>=0.18.0,<=0.18.1",
|
||||||
|
|||||||
@@ -94,9 +94,7 @@ def check_version(requirement: str, mandatory: bool = False) -> None:
|
|||||||
|
|
||||||
def check_dependencies() -> None:
|
def check_dependencies() -> None:
|
||||||
r"""Check the version of the required packages."""
|
r"""Check the version of the required packages."""
|
||||||
check_version("transformers>=4.55.0,<=5.7.0")
|
check_version("transformers>=4.55.0,<=5.8.0,!=4.57.0,!=5.6.0")
|
||||||
check_version("transformers!=4.57.0")
|
|
||||||
check_version("transformers!=5.6.0")
|
|
||||||
check_version("datasets>=2.16.0,<=4.0.0")
|
check_version("datasets>=2.16.0,<=4.0.0")
|
||||||
check_version("accelerate>=1.3.0,<=1.15.0")
|
check_version("accelerate>=1.3.0,<=1.15.0")
|
||||||
check_version("peft>=0.18.0,<=0.20.0")
|
check_version("peft>=0.18.0,<=0.20.0")
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
KEYWORDS = ("Copyright", "2025", "LlamaFactory")
|
KEYWORDS = ("Copyright", "LlamaFactory")
|
||||||
|
VALID_YEARS = tuple(str(year) for year in range(2023, 2027))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -30,8 +31,15 @@ def main():
|
|||||||
if not file_content[0]:
|
if not file_content[0]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
first_line = file_content[0]
|
||||||
print(f"Check license: {path}")
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user