Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelikefeet committed Sep 14, 2024
1 parent 9ee9b72 commit f805f9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions modelscope/hub/file_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def http_get_model_file(
desc='Downloading [' + file_name + ']',
)
if file_size == 0:
# Avoid empty file server request
with open(temp_file_path, 'w'):
progress.update(1)
progress.close()
Expand Down
2 changes: 1 addition & 1 deletion tests/hub/test_hub_empty_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def tearDown(self):
shutil.rmtree(self.work_dir, ignore_errors=True)

def test_download_empty_file(self):
model_dir = snapshot_download('AI-ModelScope/GroundingDINO', cache_dir=self.work_dir)
model_dir = snapshot_download('tastelikefeet/test_empty_download', cache_dir=self.work_dir)
self.assertTrue(model_dir is not None)
self.assertTrue(os.path.exists(os.path.join(model_dir, '1.txt')))
self.assertTrue(os.path.exists(os.path.join(model_dir, 'configuration.json')))
Expand Down

0 comments on commit f805f9e

Please sign in to comment.