-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare
executable file
·45 lines (31 loc) · 1.05 KB
/
prepare
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# Call to prepare akua dev environment
cd `dirname "$0"`
cd src/jsclient
############################################################################
# TENSORFLOW BACKEND
tf_backend="TF-JS"
tf_module=""
if cat /proc/cpuinfo | grep avx 2>/dev/null >/dev/null; then
tf_backend="TF-NODE"
#if lspci | grep VGA | grep NVIDIA 2>/dev/null >/dev/null; then
# tf_backend="TF-GPU"
#fi
fi
if test "$tf_backend" = "TF-NODE"; then
tf_module='tfjs-node'
elif test "$tf_backend" = "TF-GPU"; then
tf_module='tfjs-node-gpu'
elif test "$tf_backend" = "TF-JS"; then
tf_module='tfjs'
fi
echo "export * from '@tensorflow/$tf_module';" > server/service_impl/tf.ts
cat package.json | sed -r "/tfjs-converter/ ! s/^(.*\")@tensorflow.*(\":.*)$/\\1@tensorflow\\/$tf_module\\2/g" > package.json-new || exit 2
mv package.json-new package.json
echo ""
echo "USING $tf_backend (@tensorflow/$tf_module) AS BACKEND FOR TENSORFLOW."
echo ""
#######################################################################
# NPM
echo "Preparing npm"
npm install