[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
11612f6dc9
commit
050240b27a
3 changed files with 7 additions and 13 deletions
|
|
@ -405,9 +405,7 @@ class LlamaCppBackend:
|
|||
files = list_repo_files(hf_repo, token = hf_token)
|
||||
variant_lower = hf_variant.lower()
|
||||
boundary = re.compile(
|
||||
r"(?<![a-zA-Z0-9])"
|
||||
+ re.escape(variant_lower)
|
||||
+ r"(?![a-zA-Z0-9])"
|
||||
r"(?<![a-zA-Z0-9])" + re.escape(variant_lower) + r"(?![a-zA-Z0-9])"
|
||||
)
|
||||
gguf_files = sorted(
|
||||
f
|
||||
|
|
@ -445,9 +443,7 @@ class LlamaCppBackend:
|
|||
|
||||
from huggingface_hub import get_paths_info
|
||||
|
||||
path_infos = list(
|
||||
get_paths_info(hf_repo, all_gguf_files, token = hf_token)
|
||||
)
|
||||
path_infos = list(get_paths_info(hf_repo, all_gguf_files, token = hf_token))
|
||||
total_download_bytes = sum((p.size or 0) for p in path_infos)
|
||||
|
||||
if total_download_bytes > 0:
|
||||
|
|
@ -506,11 +502,7 @@ class LlamaCppBackend:
|
|||
|
||||
logger.info(
|
||||
f"Downloading GGUF: {hf_repo}/{gguf_filename}"
|
||||
+ (
|
||||
f" (+{len(gguf_extra_shards)} shards)"
|
||||
if gguf_extra_shards
|
||||
else ""
|
||||
)
|
||||
+ (f" (+{len(gguf_extra_shards)} shards)" if gguf_extra_shards else "")
|
||||
)
|
||||
try:
|
||||
if self._cancel_event.is_set():
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ class InferenceOrchestrator:
|
|||
if resp.status_code == 200:
|
||||
models = resp.json()
|
||||
gguf_ids = [
|
||||
m["id"] for m in models
|
||||
if m.get("id", "").upper().endswith("-GGUF")
|
||||
m["id"] for m in models if m.get("id", "").upper().endswith("-GGUF")
|
||||
][:4]
|
||||
if gguf_ids:
|
||||
self._top_gguf_cache = gguf_ids
|
||||
|
|
|
|||
|
|
@ -14,11 +14,14 @@ import structlog
|
|||
from loggers import get_logger
|
||||
|
||||
import re as _re
|
||||
|
||||
_VALID_REPO_ID = _re.compile(r"^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$")
|
||||
|
||||
|
||||
def _is_valid_repo_id(repo_id: str) -> bool:
|
||||
return bool(_VALID_REPO_ID.fullmatch(repo_id))
|
||||
|
||||
|
||||
# Add backend directory to path
|
||||
backend_path = Path(__file__).parent.parent.parent
|
||||
if str(backend_path) not in sys.path:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue