Skip to content

Commit

Permalink
Support file size == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelikefeet committed Sep 10, 2024
1 parent 96e3387 commit b3e3b68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modelscope/hub/file_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,14 +591,18 @@ def download_file(url, file_meta, temporary_cache_dir, cache, headers,
headers=headers,
cookies=None if cookies is None else cookies.get_dict(),
file_size=file_meta['Size'])
else:
elif file_meta['Size'] > 0:
http_get_model_file(
url,
temporary_cache_dir,
file_meta['Path'],
file_size=file_meta['Size'],
headers=headers,
cookies=cookies)
else:
with open(os.path.join(temporary_cache_dir, file_meta['Path']),
'w') as f:
f.write('')

# check file integrity
temp_file = os.path.join(temporary_cache_dir, file_meta['Path'])
Expand Down

0 comments on commit b3e3b68

Please sign in to comment.