[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-07-27 03:12:01 +00:00
commit 8a0b7bb5b3
2 changed files with 10 additions and 11 deletions

View file

@ -21,7 +21,7 @@ def download():
from huggingface_hub import snapshot_download
os.environ.setdefault("HF_HOME", str(CACHE_ROOT))
path = snapshot_download(REPO, cache_dir=str(CACHE_ROOT / "hub"))
path = snapshot_download(REPO, cache_dir = str(CACHE_ROOT / "hub"))
print("cached at", path)
@ -35,14 +35,14 @@ def run_tests():
"tests/saving/test_offline_gguf_real_cache_integration.py",
"-q",
]
raise SystemExit(subprocess.call(cmd, cwd=str(Path(__file__).resolve().parents[2])))
raise SystemExit(subprocess.call(cmd, cwd = str(Path(__file__).resolve().parents[2])))
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--download-only", action="store_true")
parser.add_argument("--download-only", action = "store_true")
args = parser.parse_args()
download()
if not args.download_only:

View file

@ -47,12 +47,11 @@ def _offline_env(monkeypatch):
def _resolve_snapshot(cache_dir: Path) -> Path:
from huggingface_hub import hf_hub_download
path = hf_hub_download(
REPO,
"tokenizer_config.json",
cache_dir=str(cache_dir),
local_files_only=True,
cache_dir = str(cache_dir),
local_files_only = True,
)
return Path(path).parent
@ -78,7 +77,7 @@ def test_real_cached_tokenizer_loads_from_snapshot_not_repo_id(monkeypatch):
from transformers import PreTrainedTokenizerFast
snap = _resolve_snapshot(CACHE_ROOT / "hub")
tok = PreTrainedTokenizerFast.from_pretrained(str(snap), local_files_only=True)
tok = PreTrainedTokenizerFast.from_pretrained(str(snap), local_files_only = True)
assert tok.vocab_size > 0
# Repo-id path is what triggered model_info() offline in #7481; snapshot path is the fix.
@ -89,7 +88,7 @@ def test_real_cached_tokenizer_loads_from_snapshot_not_repo_id(monkeypatch):
@pytest.mark.integration
@pytest.mark.skipif(
os.environ.get("UNSLOTH_INTEGRATION_IMPORT") != "1",
reason="full unsloth import needs GPU host; set UNSLOTH_INTEGRATION_IMPORT=1 to enable",
reason = "full unsloth import needs GPU host; set UNSLOTH_INTEGRATION_IMPORT=1 to enable",
)
def test_real_cached_unsloth_helpers_offline(monkeypatch):
_require_cached_repo()
@ -103,8 +102,8 @@ def test_real_cached_unsloth_helpers_offline(monkeypatch):
tok = _load_pretrained_tokenizer_fast(
REPO,
local_files_only=True,
cache_dir=str(CACHE_ROOT / "hub"),
local_files_only = True,
cache_dir = str(CACHE_ROOT / "hub"),
)
assert tok.vocab_size > 0
assert _has_tokenizer_model(SimpleNamespace(name_or_path=REPO, tokenizer=None)) is True
assert _has_tokenizer_model(SimpleNamespace(name_or_path = REPO, tokenizer = None)) is True