Skip to content

Commit 98c3455

Browse files
westfishMangodadada
authored andcommitted
fix bos download (PaddlePaddle#9023)
* fix bos download * add test * update
1 parent a4144ff commit 98c3455

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

β€Žpaddlenlp/utils/download/bos_download.pyβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ def bos_download(
190190

191191
storage_folder = os.path.join(cache_dir, repo_id)
192192
os.makedirs(storage_folder, exist_ok=True)
193+
if subfolder is not None:
194+
storage_sub_folder = os.path.join(storage_folder, subfolder)
195+
os.makedirs(storage_sub_folder, exist_ok=True)
193196

194197
if url is None:
195198
url = bos_url(repo_id, filename, repo_type=REPO_TYPE, endpoint=endpoint)

β€Žtests/transformers/load_subfolder/test_image_processor.pyβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ def test_clip_load(self):
5858
clip_processor = AutoImageProcessor.from_pretrained(
5959
"aistudio/paddlenlp-test-model", subfolder="clip-vit-base-patch32", from_aistudio=True
6060
)
61+
62+
63+
class ImageProcessorSubfolderLoadTester(unittest.TestCase):
64+
def test_clip_subfolder_load(self):
65+
logger.info("Download model with subfolder")
66+
clip_processor = CLIPImageProcessor.from_pretrained( # noqa: F841
67+
"runwayml/stable-diffusion-v1-5", subfolder="feature_extractor"
68+
)

0 commit comments

Comments
Β (0)