-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
70 lines (58 loc) · 2.3 KB
/
setup.sh
File metadata and controls
70 lines (58 loc) · 2.3 KB
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
63
64
65
66
67
68
69
70
#!/bin/bash
# setup.sh - Automated environment setup for SpatialTranscriptFormer (Linux/HPC)
set -e
echo "--- SpatialTranscriptFormer Setup ---"
ENV_NAME="SpatialTranscriptFormer"
# Check if conda exists
if ! command -v conda &> /dev/null; then
echo "Error: conda was not found. Please ensure Conda is installed and in your PATH."
exit 1
fi
# Check if conda environment exists
if ! conda env list | grep -q "$ENV_NAME"; then
echo "Creating conda environment '$ENV_NAME' with Python 3.9..."
conda create -n $ENV_NAME python=3.9 -y
else
echo "Conda environment '$ENV_NAME' already exists."
fi
echo "Installing PyTorch (CUDA 11.8)..."
conda run -n $ENV_NAME pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
echo "Installing/Updating package in editable mode..."
conda run -n $ENV_NAME pip install -e .[dev]
echo "Checking Hugging Face authentication..."
# Temporarily disable exit on error for this check
set +e
HF_STATUS=$(conda run -n $ENV_NAME huggingface-cli whoami 2>&1)
HF_EXIT=$?
set -e
if [ $HF_EXIT -ne 0 ] || [[ "$HF_STATUS" == *"Not logged in"* ]]; then
HF_NEED_LOGIN=true
else
HF_NEED_LOGIN=false
echo "Hugging Face authentication found: $HF_STATUS"
fi
echo ""
echo "========================================="
echo " SETUP COMPLETE! "
echo "========================================="
echo ""
echo "IMPORTANT: You must activate the environment before using the tools:"
echo " conda activate $ENV_NAME"
echo ""
if [ "$HF_NEED_LOGIN" = true ]; then
echo "------------------------------------------------------------"
echo "DATASET ACCESS REQUIRES AUTHENTICATION"
echo "The HEST-1k dataset on Hugging Face is gated. You must provide an access token."
echo "Please do ONE of the following before downloading data:"
echo " Option A (Persistent): Run 'conda run -n $ENV_NAME huggingface-cli login' and paste your token."
echo " Option B (Temporary): Run 'export HF_TOKEN=your_token_here'"
echo "Get your token from: https://huggingface.co/settings/tokens"
echo "------------------------------------------------------------"
echo ""
fi
echo "You can then use the following commands:"
echo " stf-download --help"
echo " stf-split --help"
echo " stf-build-vocab --help"
echo ""
echo "To run tests, use: ./test.sh"