File size: 1,840 Bytes
5b6fa6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Download script for Central Florida Native Plants dataset
# This script downloads language embeddings and token mappings from Google Cloud Storage

DATASET_NAME="central_florida_native_plants"
GCS_BUCKET="gs://deepearth"
GCS_PATH="${GCS_BUCKET}/encodings/language/taxa"
LOCAL_DIR="$(dirname "$0")"

echo "======================================"
echo "Central Florida Native Plants Dataset"
echo "======================================"
echo ""

# Check if gsutil is installed
if ! command -v gsutil &> /dev/null; then
    echo "Error: gsutil is not installed."
    echo "Please install Google Cloud SDK: https://cloud.google.com/sdk/install"
    exit 1
fi

# Check authentication
echo "Checking Google Cloud authentication..."
if ! gsutil ls "$GCS_BUCKET" &> /dev/null; then
    echo ""
    echo "Authentication required. Please run:"
    echo "  gcloud auth login"
    echo ""
    echo "Then try this script again."
    exit 1
fi

echo "Downloading ${DATASET_NAME} dataset..."
echo "Source: ${GCS_PATH}"
echo "Destination: ${LOCAL_DIR}"

# Create local directories
mkdir -p "${LOCAL_DIR}/embeddings"
mkdir -p "${LOCAL_DIR}/tokens"

# Download embeddings
echo ""
echo "Downloading embeddings (.pt files)..."
gsutil -m cp "${GCS_PATH}/embeddings/*.pt" "${LOCAL_DIR}/embeddings/"

# Download token mappings
echo ""
echo "Downloading token mappings (.csv files)..."
gsutil -m cp "${GCS_PATH}/tokens/*.csv" "${LOCAL_DIR}/tokens/"

# Download metadata
echo ""
echo "Downloading metadata..."
gsutil cp "${GCS_PATH}/metadata.json" "${LOCAL_DIR}/"

# Count downloaded files
echo ""
echo "Download complete!"
echo "Embeddings: $(ls -1 ${LOCAL_DIR}/embeddings/*.pt 2>/dev/null | wc -l) files"
echo "Token mappings: $(ls -1 ${LOCAL_DIR}/tokens/*.csv 2>/dev/null | wc -l) files"
echo ""
echo "Total size: $(du -sh ${LOCAL_DIR} | cut -f1)"