Download scripts/launch.sh from AjayRangoji/Translation_Guided_Sandhi_Splitting_Experiment_Guide: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/datasets/AjayRangoji/Translation_Guided_Sandhi_Splitting_Experiment_Guide/resolve/main/scripts/launch.sh
- Command line
-
hf download hf://datasets/AjayRangoji/Translation_Guided_Sandhi_Splitting_Experiment_Guide/scripts/launch.sh
-
curl -L -o launch.sh https://huggingface.co/datasets/AjayRangoji/Translation_Guided_Sandhi_Splitting_Experiment_Guide/resolve/main/scripts/launch.sh
1.53 kB
| # Launch training on a remote node, pinning CUDA_VISIBLE_DEVICES. | |
| # Usage: scripts/launch.sh <node-ip> <config> <seed> [gpu-index-or-auto] | |
| # Default "auto" claims the first GPU with no compute processes. | |
| set -euo pipefail | |
| NODE=$1; CONFIG=$2; SEED=$3; GPU=${4:-auto} | |
| REPO=/fsx/ajay-stu/Translation_Guided_Sandhi_Splitting_Experiment_Guide | |
| NAME=$(basename "$CONFIG" .yaml)_seed${SEED} | |
| LOG=$REPO/outputs/logs/${NAME}.log | |
| if [ "$GPU" = "auto" ]; then | |
| # Combine "no compute app" with "< 100 MiB" so a just-launched job counts busy. | |
| GPU=$(ssh -o BatchMode=yes -o StrictHostKeyChecking=no "$NODE" \ | |
| 'python3 -c " | |
| import subprocess | |
| busy=set() | |
| for l in subprocess.check_output([\"nvidia-smi\",\"--query-compute-apps=gpu_uuid\",\"--format=csv,noheader\"],text=True).splitlines(): | |
| busy.add(l.strip()) | |
| uuid={} | |
| for l in subprocess.check_output([\"nvidia-smi\",\"--query-gpu=index,uuid,memory.used\",\"--format=csv,noheader,nounits\"],text=True).splitlines(): | |
| i,u,m=[x.strip() for x in l.split(\",\")] | |
| if u not in busy and int(m)<100: print(i); break | |
| "') | |
| fi | |
| if [ -z "$GPU" ]; then echo "NO FREE GPU on $NODE"; exit 1; fi | |
| echo "node=$NODE gpu=$GPU config=$CONFIG seed=$SEED -> $LOG" | |
| ssh -o BatchMode=yes -o StrictHostKeyChecking=no "$NODE" bash -lc "' | |
| cd $REPO | |
| export PYTHONNOUSERSITE=1 HF_HOME=/fsx/ajay-stu/hf_cache | |
| export CUDA_VISIBLE_DEVICES=$GPU TOKENIZERS_PARALLELISM=false | |
| nohup ./.conda-env/bin/python -I src/splitter/train.py \ | |
| --config $CONFIG --seed $SEED > $LOG 2>&1 & | |
| echo started pid \$! | |
| '" | |