7254f7b4d1
Build / Build (macos-latest) (push) Has been cancelled
Build / Build (ubuntu-latest) (push) Has been cancelled
Build / Build (windows-latest) (push) Has been cancelled
Build / Analyze (javascript) (push) Has been cancelled
Build / Analyze (python) (push) Has been cancelled
66 lines
1.6 KiB
Bash
Executable File
66 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
|
|
|
|
case "${OSTYPE}" in
|
|
msys*|cygwin*|mingw*) python="winpty python";;
|
|
*) python="python";;
|
|
esac
|
|
|
|
venv() {
|
|
env_dir=./third_party/env/keras
|
|
[ -d "${env_dir}" ] || ${python} -m venv ${env_dir}
|
|
case "${OSTYPE}" in
|
|
msys*|cygwin*|mingw*) source ${env_dir}/Scripts/activate;;
|
|
*) source ${env_dir}/bin/activate;;
|
|
esac
|
|
${python} -m pip install --quiet --upgrade pip
|
|
}
|
|
|
|
clean() {
|
|
echo "keras clean"
|
|
rm -rf "./third_party/env/keras"
|
|
rm -rf "./third_party/source/keras"
|
|
}
|
|
|
|
sync() {
|
|
echo "keras sync"
|
|
[ -d "./third_party/source/keras" ] || git clone --quiet https://github.com/keras-team/keras.git "./third_party/source/keras"
|
|
git -C "./third_party/source/keras" pull --quiet --prune
|
|
}
|
|
|
|
install() {
|
|
echo "keras install"
|
|
venv
|
|
${python} -m pip install --quiet --upgrade packaging
|
|
${python} -m pip install --quiet --upgrade scikit-learn
|
|
${python} -m pip install --quiet --upgrade keras-nightly
|
|
${python} -m pip install --quiet --upgrade jax
|
|
deactivate
|
|
}
|
|
|
|
metadata() {
|
|
echo "keras metadata"
|
|
if [[ "$(uname -s)" == *ARM64* ]]; then
|
|
return
|
|
fi
|
|
venv
|
|
if [[ $(grep -U $'\x0D' ./source/keras-metadata.json) ]]; then crlf=1; else crlf=; fi
|
|
${python} ./tools/keras_script.py
|
|
if [[ -n ${crlf} ]]; then
|
|
unix2dos --quiet --newfile ./source/keras-metadata.json ./source/keras-metadata.json
|
|
fi
|
|
deactivate
|
|
}
|
|
|
|
while [ "$#" != 0 ]; do
|
|
command="$1" && shift
|
|
case "${command}" in
|
|
"clean") clean;;
|
|
"sync") sync;;
|
|
"install") install;;
|
|
"metadata") metadata;;
|
|
esac
|
|
done
|