[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
04bd9b2da5
commit
63f3faf022
3 changed files with 9 additions and 14 deletions
|
|
@ -338,8 +338,9 @@ def _scrub_validation_obj(value):
|
|||
# ``{"hf_xxxxx": "owner/repo"}``. Scrub string keys too so the
|
||||
# token does not leak through the 422 response body.
|
||||
return {
|
||||
(_scrub_validation_obj(k) if isinstance(k, str) else k):
|
||||
_scrub_validation_obj(v)
|
||||
(
|
||||
_scrub_validation_obj(k) if isinstance(k, str) else k
|
||||
): _scrub_validation_obj(v)
|
||||
for k, v in value.items()
|
||||
}
|
||||
return value
|
||||
|
|
|
|||
|
|
@ -1681,19 +1681,11 @@ async def unload_model(
|
|||
llama_matches_request = (
|
||||
loaded_identifier == request.model_path
|
||||
or loading_identifier == request.model_path
|
||||
or is_registered_native_path_label(
|
||||
loaded_identifier, request.model_path
|
||||
)
|
||||
or is_registered_native_path_label(
|
||||
loading_identifier, request.model_path
|
||||
)
|
||||
or is_registered_native_path_label(loaded_identifier, request.model_path)
|
||||
or is_registered_native_path_label(loading_identifier, request.model_path)
|
||||
)
|
||||
if (
|
||||
getattr(llama_backend, "is_active", False)
|
||||
or loading_identifier
|
||||
) and (
|
||||
llama_matches_request
|
||||
or not getattr(llama_backend, "is_loaded", False)
|
||||
if (getattr(llama_backend, "is_active", False) or loading_identifier) and (
|
||||
llama_matches_request or not getattr(llama_backend, "is_loaded", False)
|
||||
):
|
||||
# Round 19 P1 #6: previously this called
|
||||
# ``llama_backend.unload_model()`` and unconditionally
|
||||
|
|
|
|||
|
|
@ -398,9 +398,11 @@ def _install_fake_diffusers(monkeypatch, *, raise_on_pipeline = False):
|
|||
# ``subfolder="transformer"``) so existing tests that exercise
|
||||
# the GGUF path do not hit a TypeError from the fake signature.
|
||||
fake_hub = types.ModuleType("huggingface_hub")
|
||||
|
||||
def _fake_download(repo_id, filename, token = None, subfolder = None, **_kwargs):
|
||||
sub = f"{subfolder}/" if subfolder else ""
|
||||
return f"/fake/{repo_id}/{sub}{filename}"
|
||||
|
||||
fake_hub.hf_hub_download = _fake_download
|
||||
monkeypatch.setitem(sys.modules, "huggingface_hub", fake_hub)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue