Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
nauyisu022 committed Jan 31, 2024
1 parent db747de commit 24fe16f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Binary file modified dataset/dataset.zip
Binary file not shown.
13 changes: 13 additions & 0 deletions trustllm_pkg/trustllm/dataset_download.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests
import os
import zipfile
def download_dataset(save_path=None):
"""
Download a dataset from Hugging Face and save it locally.
Expand Down Expand Up @@ -36,6 +37,18 @@ def download_dataset(save_path=None):
print(f"Skipping {item['name']}, as it's not a file.")
else:
print("Failed to fetch repository data.")


zip_path = os.path.join(save_path, "dataset.zip")

with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(save_path)

# Delete the ZIP file after extraction
os.remove(zip_path)





if __name__ == "__main__":
Expand Down

0 comments on commit 24fe16f

Please sign in to comment.