Download code/scripts/download.py from KeremTT/OPUS-5.5-DATABASE: direct link, hf CLI and curl.
- Browser
- Download file 905 Bytes
-
https://huggingface.co/datasets/KeremTT/OPUS-5.5-DATABASE/resolve/main/code/scripts/download.py
- Command line
-
hf download hf://datasets/KeremTT/OPUS-5.5-DATABASE/code/scripts/download.py
-
curl -L -o download.py https://huggingface.co/datasets/KeremTT/OPUS-5.5-DATABASE/resolve/main/code/scripts/download.py
905 Bytes
| """Download every upstream file listed in opusdb.sources into RAW_DIR (resumable).""" | |
| import os | |
| import sys | |
| from concurrent.futures import ThreadPoolExecutor | |
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) | |
| from huggingface_hub import hf_hub_download # noqa: E402 | |
| from opusdb.sources import SOURCES # noqa: E402 | |
| RAW_DIR = os.environ.get("OPUSDB_RAW", "raw") | |
| def fetch(job): | |
| repo, path = job | |
| local = hf_hub_download(repo, path, repo_type="dataset", | |
| local_dir=os.path.join(RAW_DIR, repo.replace("/", "__"))) | |
| print(f"ok {repo}/{path} {os.path.getsize(local)/1e6:.1f} MB", flush=True) | |
| return local | |
| if __name__ == "__main__": | |
| jobs = sorted({(s.repo, f) for s in SOURCES for f in s.files}, key=lambda j: j[1].startswith(("sample", "data/tur"))) | |
| with ThreadPoolExecutor(4) as pool: | |
| list(pool.map(fetch, jobs)) | |
| print("DONE") | |