From 50e0b716907a464bd5a21c3bfc4e687950c96bf5 Mon Sep 17 00:00:00 2001 From: kingbri Date: Tue, 30 Apr 2024 01:13:06 -0400 Subject: [PATCH] Downloader: Fix handling of include pattern If an include or exclude pattern is provided, include should include all files by default. Signed-off-by: kingbri --- common/downloader.py | 2 +- endpoints/OAI/types/download.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/downloader.py b/common/downloader.py index 97f4d55..a5c66d2 100644 --- a/common/downloader.py +++ b/common/downloader.py @@ -121,7 +121,7 @@ async def hf_repo_download( repo_type = "lora" if include or exclude: - include_patterns = unwrap(include, []) + include_patterns = unwrap(include, ["*"]) exclude_patterns = unwrap(exclude, []) file_list = [ diff --git a/endpoints/OAI/types/download.py b/endpoints/OAI/types/download.py index 63ca26f..ac681bf 100644 --- a/endpoints/OAI/types/download.py +++ b/endpoints/OAI/types/download.py @@ -2,6 +2,10 @@ from pydantic import BaseModel, Field from typing import List, Optional +def _generate_include_list(): + return ["*"] + + class DownloadRequest(BaseModel): """Parameters for a HuggingFace repo download.""" @@ -10,7 +14,7 @@ class DownloadRequest(BaseModel): folder_name: Optional[str] = None revision: Optional[str] = None token: Optional[str] = None - include: List[str] = Field(default_factory=list) + include: List[str] = Field(default_factory=_generate_include_list) exclude: List[str] = Field(default_factory=list) chunk_limit: Optional[int] = None