#!/bin/bash source /root/miniconda3/etc/profile.d/conda.sh && conda activate rae_v2 export https_proxy=http://10.140.15.68:3128 http_proxy=http://10.140.15.68:3128 HF_DATASETS_CACHE=/data/temp/qinshengqian/c3/hf_cache export DINOV3_CKPT_DIR=/data/temp/qinshengqian/c3 DINOV3_REPO_DIR=/data/temp/qinshengqian/c3/dinov3 PYTHONPATH=src PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True cd /data/temp/qinshengqian/c3/Code/RAEv2 for p in $(ps -eo pid,args | grep "sample_perclass.py" | grep -v grep | awk '{print $1}'); do kill -9 $p 2>/dev/null; done sleep 3 OUT=/data/temp/qinshengqian/c3/aug_synth_dinov3raev2; rm -rf $OUT; mkdir -p $OUT CFG=configs/stage2/sampling/ISIC/dinov3l-k23.yaml CLS=(AK BCC BKL DF MEL NV SCC VASC) for i in ${!CLS[@]}; do c=${CLS[$i]} CUDA_VISIBLE_DEVICES=$i setsid python sample_perclass.py $CFG $OUT 2000 80 $c $c > results/logs/sample_$c.log 2>&1 & done wait echo "ALL_SAMPLE_DONE $(date '+%T')" head -1 $OUT/synth_AK.csv > $OUT/synth.csv for c in ${CLS[@]}; do tail -n +2 $OUT/synth_$c.csv >> $OUT/synth.csv 2>/dev/null; done echo "MERGED rows=$(($(wc -l < $OUT/synth.csv)-1))" touch $OUT/SAMPLE_ALL_DONE