Skip to content

Commit

Permalink
fix bos download (#9023)
Browse files Browse the repository at this point in the history
* fix bos download

* add test

* update
  • Loading branch information
westfish authored Sep 2, 2024
1 parent 90863b1 commit 116841a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions paddlenlp/utils/download/bos_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ def bos_download(

storage_folder = os.path.join(cache_dir, repo_id)
os.makedirs(storage_folder, exist_ok=True)
if subfolder is not None:
storage_sub_folder = os.path.join(storage_folder, subfolder)
os.makedirs(storage_sub_folder, exist_ok=True)

if url is None:
url = bos_url(repo_id, filename, repo_type=REPO_TYPE, endpoint=endpoint)
Expand Down
8 changes: 8 additions & 0 deletions tests/transformers/load_subfolder/test_image_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ def test_clip_load(self):
clip_processor = AutoImageProcessor.from_pretrained(
"aistudio/paddlenlp-test-model", subfolder="clip-vit-base-patch32", from_aistudio=True
)


class ImageProcessorSubfolderLoadTester(unittest.TestCase):
def test_clip_subfolder_load(self):
logger.info("Download model with subfolder")
clip_processor = CLIPImageProcessor.from_pretrained( # noqa: F841
"runwayml/stable-diffusion-v1-5", subfolder="feature_extractor"
)

0 comments on commit 116841a

Please sign in to comment.