mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
Sync run_eval with benchmarking script (#260)
* added new .sh script for eval; removed old python script * fixed changing dataset * done refactoring eval script
This commit is contained in:
1 parent
2b1d9b6d2b
commit
0d6060e0f0
5 files changed
+126
-162
No files matched your search
Executable
+76
@@ -0,0 +1,76 @@
|
||||
helpFunction_launch_eval()
|
||||
{
|
||||
echo "Usage: $0 -c config_name -g gpu_list"
|
||||
echo -e "\t-c name of method to benchmark (e.g. graph_mipnerf, graph_instant_ngp)"
|
||||
echo -o "\t-o base directory for where all the benchmarks are stored (e.g. outputs/)"
|
||||
echo -e "\t-m month of the benchmark of format xx (e.g. 08)"
|
||||
echo -e "\t-d date of the benchmark of format xx (e.g. 01)"
|
||||
echo -e "\t-y year of the benchmark of format xxxx (e.g. 2022)"
|
||||
echo -e "\t-s second timestamp of the benchmark of format xxxxxx (e.g. 003603)"
|
||||
echo -e "\t-g list of space-separated gpu numbers to launch train on (e.g. 0 2 4 5)"
|
||||
exit 1 # Exit program after printing help
|
||||
}
|
||||
|
||||
while getopts "c:o:m:d:y:s:g" opt; do
|
||||
case "$opt" in
|
||||
c ) config_name="$OPTARG" ;;
|
||||
o ) output_dir="$OPTARG" ;;
|
||||
m ) month="$OPTARG" ;;
|
||||
d ) date="$OPTARG" ;;
|
||||
y ) year="$OPTARG" ;;
|
||||
s ) seconds="$OPTARG" ;;
|
||||
g ) gpu_list="$OPTARG" ;;
|
||||
? ) helpFunction_launch_eval ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$config_name" ]; then
|
||||
echo "Missing method name"
|
||||
helpFunction_launch_train
|
||||
fi
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# Deal with gpu's. If passed in, use those.
|
||||
GPU_IDX=("$@")
|
||||
if [ -z "$GPU_IDX" ]; then
|
||||
echo "no gpus set... finding available gpus"
|
||||
# Find available devices
|
||||
num_device=$(nvidia-smi --query-gpu=name --format=csv,noheader | wc -l)
|
||||
START=0
|
||||
END=${num_device}-1
|
||||
GPU_IDX=()
|
||||
|
||||
for (( id=$START; id<$END; id++ )); do
|
||||
free_mem=$(nvidia-smi --query-gpu=memory.free --format=csv -i $id | grep -Eo [0-9]+)
|
||||
if [[ $free_mem -gt 10000 ]]; then
|
||||
GPU_IDX+=( $id )
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo available gpus... ${GPU_IDX[@]}
|
||||
|
||||
DATASETS=("mic" "ficus" "chair" "hotdog" "materials" "drums" "ship" "lego")
|
||||
idx=0
|
||||
len=${#GPU_IDX[@]}
|
||||
((len=len-1))
|
||||
|
||||
for dataset in ${DATASETS[@]}; do
|
||||
export CUDA_VISIBLE_DEVICES=${GPU_IDX[$idx]}
|
||||
base_config_name=${config_name/"graph_"/""}
|
||||
checkpoint_dir="${output_dir}/blender_${dataset}_${month}-${date}-${year}/${base_config_name}/${year}-${month}-${date}_${seconds}/nerfactory_models/"
|
||||
python scripts/run_eval.py --config-name ${config_name} \
|
||||
--checkpoint-dir ${checkpoint_dir} \
|
||||
--rendered-output-name rgb \
|
||||
--output-filename ${output_dir}/${base_config_name}/blender_${dataset}_${month}-${date}-${year}_${seconds}.json \
|
||||
--config-overrides data.dataset_inputs_train.data_directory=data/blender/${dataset} data.dataset_inputs_eval.data_directory=data/blender/${dataset} &
|
||||
echo "Launched ${checkpoint_dir} on gpu ${GPU_IDX[$idx]}"
|
||||
|
||||
# update gpu
|
||||
if [ $idx == $len ]; then
|
||||
idx=0
|
||||
else
|
||||
((idx=idx+1))
|
||||
fi
|
||||
|
||||
done
|
||||
Reference in new issue
Block a user