Commit
·
ba42011
1
Parent(s):
44e63ee
Add hf-transfer to uvx dependencies for faster downloads
Browse files- atlas-export.py +7 -4
atlas-export.py
CHANGED
|
@@ -27,8 +27,9 @@ Example usage:
|
|
| 27 |
--sample 10000
|
| 28 |
|
| 29 |
# Run on HF Jobs with GPU (requires HF token for Space deployment)
|
| 30 |
-
|
| 31 |
-
|
|
|
|
| 32 |
https://huggingface.co/datasets/uv-scripts/build-atlas/raw/main/atlas-export.py \
|
| 33 |
my-dataset \
|
| 34 |
--space-name my-atlas \
|
|
@@ -72,7 +73,8 @@ def check_gpu_available() -> bool:
|
|
| 72 |
def build_atlas_command(args) -> list:
|
| 73 |
"""Build the embedding-atlas command with all parameters."""
|
| 74 |
# Use uvx to run embedding-atlas with required dependencies
|
| 75 |
-
|
|
|
|
| 76 |
cmd.append(args.dataset_id)
|
| 77 |
|
| 78 |
# Add all optional parameters
|
|
@@ -443,7 +445,8 @@ if __name__ == "__main__":
|
|
| 443 |
print("# With custom model and sampling:")
|
| 444 |
print("uv run atlas-export.py my-dataset --space-name my-viz --model nomic-ai/nomic-embed-text-v1.5 --sample 10000\n")
|
| 445 |
print("# For HF Jobs with GPU (experimental UV support):")
|
| 446 |
-
print("
|
|
|
|
| 447 |
print("# Local generation only:")
|
| 448 |
print("uv run atlas-export.py dataset --space-name test --local-only --output-dir ./atlas-output")
|
| 449 |
sys.exit(0)
|
|
|
|
| 27 |
--sample 10000
|
| 28 |
|
| 29 |
# Run on HF Jobs with GPU (requires HF token for Space deployment)
|
| 30 |
+
# Get your token: python -c "from huggingface_hub import get_token; print(get_token())"
|
| 31 |
+
hf jobs uv run --flavor t4-small \
|
| 32 |
+
-s HF_TOKEN=your-token-here \
|
| 33 |
https://huggingface.co/datasets/uv-scripts/build-atlas/raw/main/atlas-export.py \
|
| 34 |
my-dataset \
|
| 35 |
--space-name my-atlas \
|
|
|
|
| 73 |
def build_atlas_command(args) -> list:
|
| 74 |
"""Build the embedding-atlas command with all parameters."""
|
| 75 |
# Use uvx to run embedding-atlas with required dependencies
|
| 76 |
+
# Include hf-transfer for faster downloads when HF_HUB_ENABLE_HF_TRANSFER is set
|
| 77 |
+
cmd = ["uvx", "--with", "datasets", "--with", "hf-transfer", "embedding-atlas"]
|
| 78 |
cmd.append(args.dataset_id)
|
| 79 |
|
| 80 |
# Add all optional parameters
|
|
|
|
| 445 |
print("# With custom model and sampling:")
|
| 446 |
print("uv run atlas-export.py my-dataset --space-name my-viz --model nomic-ai/nomic-embed-text-v1.5 --sample 10000\n")
|
| 447 |
print("# For HF Jobs with GPU (experimental UV support):")
|
| 448 |
+
print("# First get your token: python -c \"from huggingface_hub import get_token; print(get_token())\"")
|
| 449 |
+
print("hf jobs uv run --flavor t4-small -s HF_TOKEN=your-token-here https://huggingface.co/datasets/uv-scripts/build-atlas/raw/main/atlas-export.py dataset --space-name viz --model sentence-transformers/all-mpnet-base-v2\n")
|
| 450 |
print("# Local generation only:")
|
| 451 |
print("uv run atlas-export.py dataset --space-name test --local-only --output-dir ./atlas-output")
|
| 452 |
sys.exit(0)
|