from huggingface_hub import login
login(token="YOUR_HF_TOKEN")
Download Script
import os
from huggingface_hub import snapshot_download
defdownload_superfocus_dataset(ids=None, local_dir="./superfocus_prediction"):
""" Downloads files from the yaolu-huggingface/SuperFocus dataset. Parameters: - ids (list of str or str): Prefix IDs to filter files (e.g., ['INT13', 'MEND142'] or 'NCBI2'). If None, the entire dataset will be downloaded. - local_dir (str): The local directory where files should be saved. """
repo_id = "yaolu-huggingface/SuperFocus"
repo_type = "dataset"# Ensure the local directory exists
os.makedirs(local_dir, exist_ok=True)
# Handle the filtering pattern if ids are providediflen(ids)>0:
# Build wildcard patterns (e.g., ['INT13*', 'MEND142*'])
allow_patterns = [f"{prefix}*"for prefix in ids]
print(f"Downloading files matching prefixes {ids} from {repo_id}...")
else:
allow_patterns = "*"print(f"Downloading the entire dataset from {repo_id} (Warning: total size is ~221 GB)...")
# Download using snapshot_download
path = snapshot_download(
repo_id=repo_id,
repo_type=repo_type,
local_dir=local_dir,
allow_patterns=allow_patterns
)
print(f"Download complete. Files saved to: {path}")
return# --- Example Usage ---# 1. Download only specific subsets (e.g., files starting with INT13 or MEND142)# download_superfocus_dataset(ids=["INT13", "MEND142"])# 2. Download files matching a single ID prefix# download_superfocus_dataset(ids="NCBI2")# 3. Download everything (Make sure you have 221+ GB of free space!)# download_superfocus_dataset(ids=None)