[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
6ec6ca39ef
commit
a41a315d7e
4 changed files with 17 additions and 25 deletions
|
|
@ -47,12 +47,10 @@ def test_bnb_functional_4bit(tag: str):
|
|||
"bitsandbytes/functional.py",
|
||||
"bitsandbytes/functional/__init__.py",
|
||||
]
|
||||
hit = first_match(
|
||||
"bitsandbytes-foundation/bitsandbytes", tag, candidates
|
||||
)
|
||||
assert hit is not None, (
|
||||
f"{tag}: bitsandbytes/functional[.py|/__init__.py] both missing"
|
||||
)
|
||||
hit = first_match("bitsandbytes-foundation/bitsandbytes", tag, candidates)
|
||||
assert (
|
||||
hit is not None
|
||||
), f"{tag}: bitsandbytes/functional[.py|/__init__.py] both missing"
|
||||
_, src = hit
|
||||
needed = ("dequantize_4bit", "quantize_4bit")
|
||||
missing = [n for n in needed if not has_def(src, n, "func") and n not in src]
|
||||
|
|
|
|||
|
|
@ -87,9 +87,7 @@ def test_peft_lora_config_class(tag: str):
|
|||
src = fetch_text("huggingface/peft", tag, p)
|
||||
if src is not None and has_def(src, "LoraConfig", "class"):
|
||||
found_in.append(p)
|
||||
assert found_in, (
|
||||
f"{tag}: peft.tuners.lora.LoraConfig not in any of {candidates}"
|
||||
)
|
||||
assert found_in, f"{tag}: peft.tuners.lora.LoraConfig not in any of {candidates}"
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
|
@ -111,9 +109,7 @@ def test_get_peft_model_function(tag: str):
|
|||
src = fetch_text("huggingface/peft", tag, p)
|
||||
if src is not None and has_def(src, "get_peft_model", "func"):
|
||||
return
|
||||
pytest.fail(
|
||||
f"{tag}: def get_peft_model(...) not found in any of {candidates}"
|
||||
)
|
||||
pytest.fail(f"{tag}: def get_peft_model(...) not found in any of {candidates}")
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ ST_TAGS = [
|
|||
|
||||
@pytest.mark.parametrize("tag", ST_TAGS)
|
||||
def test_st_top_level_exports(tag: str):
|
||||
src = fetch_text("UKPLab/sentence-transformers", tag, "sentence_transformers/__init__.py")
|
||||
assert src is not None, (
|
||||
f"{tag}: sentence_transformers/__init__.py missing"
|
||||
src = fetch_text(
|
||||
"UKPLab/sentence-transformers", tag, "sentence_transformers/__init__.py"
|
||||
)
|
||||
assert src is not None, f"{tag}: sentence_transformers/__init__.py missing"
|
||||
needed = ("SentenceTransformer", "SentenceTransformerTrainer")
|
||||
missing = [n for n in needed if n not in src]
|
||||
assert not missing, (
|
||||
|
|
@ -192,9 +192,9 @@ def test_st_util_helpers(tag: str):
|
|||
"sentence_transformers/util/__init__.py",
|
||||
]
|
||||
hit = first_match("UKPLab/sentence-transformers", tag, candidates)
|
||||
assert hit is not None, (
|
||||
f"{tag}: sentence_transformers/util[.py|/__init__.py] both missing"
|
||||
)
|
||||
assert (
|
||||
hit is not None
|
||||
), f"{tag}: sentence_transformers/util[.py|/__init__.py] both missing"
|
||||
_path, src = hit
|
||||
for fn in ("import_from_string", "load_dir_path"):
|
||||
defined_here = has_def(src, fn, "func")
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ def test_grpo_trainer_class_canonical_path(tag: str):
|
|||
f"{tag}: trl/trainer/grpo_trainer.py missing — "
|
||||
f"unsloth.models.rl._patch_trl_rl_trainers('grpo_trainer') breaks"
|
||||
)
|
||||
assert has_def(src, "GRPOTrainer", "class"), (
|
||||
f"{tag}: trl.trainer.grpo_trainer.GRPOTrainer not defined as a class"
|
||||
)
|
||||
assert has_def(
|
||||
src, "GRPOTrainer", "class"
|
||||
), f"{tag}: trl.trainer.grpo_trainer.GRPOTrainer not defined as a class"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("tag", TRL_TAGS)
|
||||
|
|
@ -211,9 +211,7 @@ def test_trl_experimental_openenv_gated(tag: str):
|
|||
pytest.skip(f"{tag}: trl.experimental.openenv not present (OK)")
|
||||
# Module exists -> at minimum, `utils` submodule must be importable
|
||||
# because unsloth patches via `import trl.experimental.openenv.utils`.
|
||||
utils_src = fetch_text(
|
||||
"huggingface/trl", tag, "trl/experimental/openenv/utils.py"
|
||||
)
|
||||
utils_src = fetch_text("huggingface/trl", tag, "trl/experimental/openenv/utils.py")
|
||||
assert utils_src is not None, (
|
||||
f"{tag}: trl.experimental.openenv exists but utils.py missing; "
|
||||
f"unsloth/models/rl_replacements.py:1765 imports openenv.utils explicitly"
|
||||
|
|
@ -273,7 +271,7 @@ def test_trl_version_parseable(tag: str):
|
|||
src,
|
||||
re.MULTILINE,
|
||||
)
|
||||
and re.search(r'^\s*__version__\s*=\s*version\s*\(', src, re.MULTILINE)
|
||||
and re.search(r"^\s*__version__\s*=\s*version\s*\(", src, re.MULTILINE)
|
||||
)
|
||||
assert has_literal or has_subimport or has_metadata, (
|
||||
f"{tag}: trl.__version__ not exported via any known mechanism; "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue