CoolFace
Modelpublic

MintplexLabs/multilingual-e5-small

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes2.9kdownloads
sync.py35 linesDownload Raw Back to root
1from huggingface_hub import HfApi2import os3 4REPO_ID = "MintplexLabs/multilingual-e5-small"5LOCAL_PATH = "."  # your local directory6 7api = HfApi()8 9# Get list of files in repo10remote_files = {f for f in api.list_repo_files(repo_id=REPO_ID)}11 12# Delete .DS_Store files if present in remote13ds_store_files = {f for f in remote_files if f.endswith('.DS_Store')}14for file in ds_store_files:15    print(f"Deleting {file} from repo...")16    api.delete_file(path_in_repo=file, repo_id=REPO_ID)17 18# Get list of files locally (recursively)19local_files = set()20for root, _, files in os.walk(LOCAL_PATH):21    for file in files:22        full_path = os.path.join(root, file)23        relative_path = os.path.relpath(full_path, LOCAL_PATH)24        local_files.add(relative_path.replace("\\", "/"))25 26# Find files that exist remotely but not locally27files_to_delete = remote_files - local_files28 29# Delete them30for file in files_to_delete:31    print(f"Deleting {file} from repo...")32    api.delete_file(path_in_repo=file, repo_id=REPO_ID)33 34# Now re-upload local files using the CLI35print(f"huggingface-cli upload {REPO_ID} {LOCAL_PATH}")