| | import os |
| | import tarfile |
| | from huggingface_hub import HfApi |
| |
|
| | |
| | api = HfApi() |
| | |
| | source_dir = "/workspace/logs/codebooks/kmeans/stable_vae_16384" |
| | output_filename = "vq_codebook.tar.gz" |
| | print(f"Creating tar.gz archive from {source_dir}...") |
| | |
| | with tarfile.open(output_filename, "w:gz") as tar: |
| | tar.add(source_dir, arcname=os.path.basename(source_dir)) |
| | print("Archive created successfully") |
| |
|
| | |
| | print("Uploading to Hugging Face Hub...") |
| | api.upload_file( |
| | path_or_fileobj=output_filename, |
| | path_in_repo=output_filename, |
| | repo_id="seungheondoh/model_temp", |
| | repo_type="model" |
| | ) |
| |
|
| | print("Upload completed successfully") |
| |
|
| | |
| | os.remove(output_filename) |
| | print("Local archive cleaned up") |
| |
|