essir-xlir / download_miracl.py
DylanJHJ's picture
Upload folder using huggingface_hub
909c530 verified
raw
history blame
1.81 kB
import os
from huggingface_hub import hf_hub_download
# ALL langauges
langs = {
'train': ['ar', 'bn', 'en', 'es', 'fa', 'fi', 'fr', 'hi', 'id', 'ja', 'ko', 'ru', 'sw', 'te', 'th', 'zh'],
'dev': ['ar', 'bn', 'en', 'es', 'fa', 'fi', 'fr', 'hi', 'id', 'ja', 'ko', 'ru', 'sw', 'te', 'th', 'zh'],
'testA': ['ar', 'bn', 'en', 'fi', 'id', 'ja', 'ko', 'ru', 'sw', 'te', 'th']
}
# the langauges we used in ESSIR
langs = {'train': ['en', 'fa', 'ru', 'zh'], 'dev': ['en', 'fa', 'ru', 'zh']}
for split in ['train', 'dev']:
for lang in langs[split]:
# # topic
# hf_hub_download('miracl/miracl',
# filename=f'topics.miracl-v1.0-{lang}-{split}.tsv',
# subfolder=f'miracl-v1.0-{lang}/topics',
# repo_type='dataset',
# cache_dir='/home/dju/datasets/essir-xlir/miracl/topics',
# force_filename=f'topics.miracl-v1.0-{lang}-{split}.tsv'
# )
#
# # qrels
# hf_hub_download('miracl/miracl',
# filename=f'qrels.miracl-v1.0-{lang}-{split}.tsv',
# subfolder=f'miracl-v1.0-{lang}/qrels',
# repo_type='dataset',
# cache_dir='/home/dju/datasets/essir-xlir/miracl/qrels',
# force_filename=f'qrels.miracl-v1.0-{lang}-{split}.tsv'
# )
# topic
hf_hub_download('miracl/miracl-corpus',
filename=f'topics.miracl-v1.0-{lang}-{split}.tsv',
subfolder=f'miracl-v1.0-{lang}/topics',
repo_type='dataset',
cache_dir='/home/dju/datasets/essir-xlir/miracl/topics',
force_filename=f'topics.miracl-v1.0-{lang}-{split}.tsv'
)
cmd = f'rm -rvf /home/dju/datasets/essir-xlir/miracl/*/*lock'
os.system(cmd)
languages2filesize = { 'en': 66 , 'fa': 5, 'ru': 20, 'zh': 10, }