Skip to content

Commit 895f81d

Browse files
committed
fix for run on windows's conda
1 parent 0d0f719 commit 895f81d

6 files changed

+37
-6
lines changed

python/selfplay/distributed/download_and_upload_and_shuffle_and_export_loop.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ shift
3232
RATING_ONLY="$1"
3333
shift
3434

35+
PYTHON_BIN=python3
36+
if [ ${OS} == "Windows_NT" ] && [ ! -z "${CONDA_PYTHON_EXE}" ]; then
37+
PYTHON_BIN=python
38+
fi
39+
3540
#We're not really using gating, but the upload script expects them to be where gating would put them
3641
#and using gating disables the export script from making extraneous selfplay data dirs.
3742
USEGATING=1
@@ -67,7 +72,7 @@ cp -r "$GITROOTDIR"/python/selfplay "$DATED_ARCHIVE"
6772
cd "$basedir"/scripts
6873
while true
6974
do
70-
time python3 ./summarize_old_selfplay_files.py "$basedir"/selfplay/ \
75+
time ${PYTHON_BIN} ./summarize_old_selfplay_files.py "$basedir"/selfplay/ \
7176
-old-summary-file-to-assume-correct "$basedir"/selfplay.summary.json \
7277
-new-summary-file "$basedir"/selfplay.summary.json.tmp
7378
mv "$basedir"/selfplay.summary.json.tmp "$basedir"/selfplay.summary.json

python/selfplay/distributed/upload_model_for_selfplay.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ shift
2323
RATING_ONLY="$1"
2424
shift
2525

26+
27+
PYTHON_BIN=python3
28+
if [ ${OS} == "Windows_NT" ] && [ ! -z "${CONDA_PYTHON_EXE}" ]; then
29+
PYTHON_BIN=python
30+
fi
31+
2632
#------------------------------------------------------------------------------
2733

2834
mkdir -p "$BASEDIR"/modelstobetested
@@ -84,7 +90,7 @@ function uploadStuff() {
8490
do
8591
set +e
8692
set -x
87-
python3 ./upload_model.py \
93+
${PYTHON_BIN} ./upload_model.py \
8894
-run-name "$RUNNAME" \
8995
-model-name "$RUNNAME"-"$NAME" \
9096
-model-file "$TMPDST"/"$RUNNAME"-"$NAME".bin.gz \

python/selfplay/export_model_for_selfplay.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ shift
2121
USEGATING="$1"
2222
shift
2323

24+
PYTHON_BIN=python3
25+
if [ ${OS} == "Windows_NT" ] && [ ! -z "${CONDA_PYTHON_EXE}" ]; then
26+
PYTHON_BIN=python
27+
fi
28+
2429
#------------------------------------------------------------------------------
2530

2631
mkdir -p "$BASEDIR"/tfsavedmodels_toexport
@@ -64,7 +69,7 @@ function exportStuff() {
6469
mkdir "$TMPDST"
6570

6671
set -x
67-
python3 ./export_model.py \
72+
${PYTHON_BIN} ./export_model.py \
6873
-saved-model-dir "$SRC"/saved_model \
6974
-export-dir "$TMPDST" \
7075
-model-name "$NAMEPREFIX""-""$NAME" \

python/selfplay/shuffle.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ shift
2323
BATCHSIZE="$1"
2424
shift
2525

26+
PYTHON_BIN=python3
27+
if [ ${OS} == "Windows_NT" ] && [ ! -z "${CONDA_PYTHON_EXE}" ]; then
28+
PYTHON_BIN=python
29+
fi
30+
2631
#------------------------------------------------------------------------------
2732

2833
OUTDIR=$(date "+%Y%m%d-%H%M%S")
@@ -37,7 +42,7 @@ echo "Beginning shuffle at" $(date "+%Y-%m-%d %H:%M:%S")
3742

3843
#set -x
3944
(
40-
time python3 ./shuffle.py \
45+
time ${PYTHON_BIN} ./shuffle.py \
4146
"$BASEDIR"/selfplay/ \
4247
-expand-window-per-row 0.4 \
4348
-taper-window-exponent 0.65 \

python/selfplay/shuffle_loop.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ shift
2020
BATCHSIZE="$1"
2121
shift
2222

23+
PYTHON_BIN=python3
24+
if [ ${OS} == "Windows_NT" ] && [ ! -z "${CONDA_PYTHON_EXE}" ]; then
25+
PYTHON_BIN=python
26+
fi
27+
2328
GITROOTDIR="$(git rev-parse --show-toplevel)"
2429

2530
basedir="$(realpath "$BASEDIRRAW")"
@@ -42,7 +47,7 @@ cp -r "$GITROOTDIR"/python/selfplay "$DATED_ARCHIVE"
4247
while true
4348
do
4449
rm -f "$basedir"/selfplay.summary.json.tmp
45-
time python3 ./summarize_old_selfplay_files.py "$basedir"/selfplay/ \
50+
time ${PYTHON_BIN} ./summarize_old_selfplay_files.py "$basedir"/selfplay/ \
4651
-old-summary-file-to-assume-correct "$basedir"/selfplay.summary.json \
4752
-new-summary-file "$basedir"/selfplay.summary.json.tmp
4853
mv "$basedir"/selfplay.summary.json.tmp "$basedir"/selfplay.summary.json

python/selfplay/train.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ shift
2828
EXPORTMODE="$1"
2929
shift
3030

31+
PYTHON_BIN=python3
32+
if [ ${OS} == "Windows_NT" ] && [ ! -z "${CONDA_PYTHON_EXE}" ]; then
33+
PYTHON_BIN=python
34+
fi
35+
3136
GITROOTDIR="$(git rev-parse --show-toplevel)"
3237

3338
#------------------------------------------------------------------------------
@@ -65,7 +70,7 @@ else
6570
exit 1
6671
fi
6772

68-
time python3 "$GITROOTDIR"/python/train.py \
73+
time ${PYTHON_BIN} "$GITROOTDIR"/python/train.py \
6974
-traindir "$BASEDIR"/train/"$TRAININGNAME" \
7075
-datadir "$BASEDIR"/shuffleddata/current/ \
7176
-exportdir "$BASEDIR"/"$EXPORT_SUBDIR" \

0 commit comments

Comments
 (0)