| |
| """Publish SecureCodePairs to Hugging Face Hub under ismailtasdelen/SecureCodePairs.""" |
| import os |
| from huggingface_hub import HfApi |
| from huggingface_hub.utils import RepositoryNotFoundError |
|
|
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| REPO_ID = "ismailtasdelen/SecureCodePairs" |
| TOKEN = os.environ["HF_TOKEN"] |
|
|
| api = HfApi(token=TOKEN) |
|
|
| |
| try: |
| api.repo_info(repo_id=REPO_ID, repo_type="dataset") |
| print(f"Repo {REPO_ID} already exists.") |
| except RepositoryNotFoundError: |
| api.create_repo(repo_id=REPO_ID, repo_type="dataset", private=False, exist_ok=True) |
| print(f"Created repo {REPO_ID}.") |
|
|
| |
| api.upload_folder( |
| repo_id=REPO_ID, |
| repo_type="dataset", |
| folder_path=ROOT, |
| ignore_patterns=["*.pyc", "__pycache__/*", ".git/*", "scripts/__pycache__/*", |
| "validation/*.json", "statistics/*"], |
| commit_message="Release v1.2.0: SecureCodePairs (470 code pairs + 30 LLM security trajectories)", |
| ) |
| print("Upload complete.") |
|
|
| |
| try: |
| api.create_tag( |
| repo_id=REPO_ID, |
| repo_type="dataset", |
| tag="v1.2.0", |
| tag_message="SecureCodePairs v1.2.0", |
| ) |
| print("Hub tag v1.1.0 created.") |
| except Exception as e: |
| print("Tag note:", e) |
|
|
| print("URL: https://huggingface.co/datasets/" + REPO_ID) |
|
|