[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
3400654afc
commit
41b103adee
3 changed files with 37 additions and 24 deletions
|
|
@ -405,10 +405,7 @@ def run_training_process(
|
|||
# (Qwen3.5, Gemma 4, etc.) are native and do NOT need it — enabling it
|
||||
# bypasses the compiler (disabling fused CE).
|
||||
_lowered = model_name.lower()
|
||||
if (
|
||||
"nemotron" in _lowered
|
||||
and not config.get("trust_remote_code", False)
|
||||
):
|
||||
if "nemotron" in _lowered and not config.get("trust_remote_code", False):
|
||||
config["trust_remote_code"] = True
|
||||
logger.info(
|
||||
"Auto-enabled trust_remote_code for Nemotron model: %s",
|
||||
|
|
|
|||
|
|
@ -206,7 +206,10 @@ class TestCheckConfigNeeds550:
|
|||
|
||||
def test_gemma4_architecture(self, tmp_path: Path):
|
||||
"""config.json with Gemma4ForConditionalGeneration should return True."""
|
||||
cfg = {"architectures": ["Gemma4ForConditionalGeneration"], "model_type": "gemma4"}
|
||||
cfg = {
|
||||
"architectures": ["Gemma4ForConditionalGeneration"],
|
||||
"model_type": "gemma4",
|
||||
}
|
||||
(tmp_path / "config.json").write_text(json.dumps(cfg))
|
||||
|
||||
assert _check_config_needs_550(str(tmp_path)) is True
|
||||
|
|
@ -272,7 +275,10 @@ class TestGetTransformersTier:
|
|||
|
||||
def test_gemma4_config_json_returns_550(self, tmp_path: Path):
|
||||
"""Local checkpoint with Gemma4 architecture → 550."""
|
||||
cfg = {"architectures": ["Gemma4ForConditionalGeneration"], "model_type": "gemma4"}
|
||||
cfg = {
|
||||
"architectures": ["Gemma4ForConditionalGeneration"],
|
||||
"model_type": "gemma4",
|
||||
}
|
||||
(tmp_path / "config.json").write_text(json.dumps(cfg))
|
||||
|
||||
assert get_transformers_tier(str(tmp_path)) == "550"
|
||||
|
|
@ -289,15 +295,20 @@ class TestGetTransformersTier:
|
|||
"utils.transformers_version._check_config_needs_550",
|
||||
return_value = False,
|
||||
):
|
||||
assert get_transformers_tier("mistralai/Ministral-3-8B-Instruct-2512") == "530"
|
||||
assert (
|
||||
get_transformers_tier("mistralai/Ministral-3-8B-Instruct-2512") == "530"
|
||||
)
|
||||
|
||||
def test_llama_returns_default(self):
|
||||
with patch(
|
||||
"utils.transformers_version._check_config_needs_550",
|
||||
return_value = False,
|
||||
), patch(
|
||||
"utils.transformers_version._check_tokenizer_config_needs_v5",
|
||||
return_value = False,
|
||||
with (
|
||||
patch(
|
||||
"utils.transformers_version._check_config_needs_550",
|
||||
return_value = False,
|
||||
),
|
||||
patch(
|
||||
"utils.transformers_version._check_tokenizer_config_needs_v5",
|
||||
return_value = False,
|
||||
),
|
||||
):
|
||||
assert get_transformers_tier("meta-llama/Llama-3-8B") == "default"
|
||||
|
||||
|
|
@ -314,11 +325,14 @@ class TestGetTransformersTier:
|
|||
return_value = False,
|
||||
):
|
||||
assert needs_transformers_5("Qwen/Qwen3.5-9B") is True
|
||||
with patch(
|
||||
"utils.transformers_version._check_config_needs_550",
|
||||
return_value = False,
|
||||
), patch(
|
||||
"utils.transformers_version._check_tokenizer_config_needs_v5",
|
||||
return_value = False,
|
||||
with (
|
||||
patch(
|
||||
"utils.transformers_version._check_config_needs_550",
|
||||
return_value = False,
|
||||
),
|
||||
patch(
|
||||
"utils.transformers_version._check_tokenizer_config_needs_v5",
|
||||
return_value = False,
|
||||
),
|
||||
):
|
||||
assert needs_transformers_5("meta-llama/Llama-3-8B") is False
|
||||
|
|
|
|||
|
|
@ -279,9 +279,7 @@ def _check_config_needs_550(model_name: str) -> bool:
|
|||
_config_needs_550_cache[model_name] = result
|
||||
return result
|
||||
except Exception as exc:
|
||||
logger.debug(
|
||||
"Could not fetch config.json for '%s': %s", model_name, exc
|
||||
)
|
||||
logger.debug("Could not fetch config.json for '%s': %s", model_name, exc)
|
||||
_config_needs_550_cache[model_name] = False
|
||||
return False
|
||||
|
||||
|
|
@ -507,12 +505,16 @@ def _ensure_venv_dir(venv_dir: str, packages: tuple[str, ...], label: str) -> bo
|
|||
|
||||
def _ensure_venv_t5_530_exists() -> bool:
|
||||
"""Ensure .venv_t5_530/ exists with transformers 5.3.0."""
|
||||
return _ensure_venv_dir(_VENV_T5_530_DIR, _VENV_T5_530_PACKAGES, "transformers 5.3.0")
|
||||
return _ensure_venv_dir(
|
||||
_VENV_T5_530_DIR, _VENV_T5_530_PACKAGES, "transformers 5.3.0"
|
||||
)
|
||||
|
||||
|
||||
def _ensure_venv_t5_550_exists() -> bool:
|
||||
"""Ensure .venv_t5_550/ exists with transformers 5.5.0."""
|
||||
return _ensure_venv_dir(_VENV_T5_550_DIR, _VENV_T5_550_PACKAGES, "transformers 5.5.0")
|
||||
return _ensure_venv_dir(
|
||||
_VENV_T5_550_DIR, _VENV_T5_550_PACKAGES, "transformers 5.5.0"
|
||||
)
|
||||
|
||||
|
||||
def _ensure_venv_t5_exists() -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue