Files
photoprism/docker/tensorflow/create_archive.sh
raystlin 0ff942342f AI: Improve TensorFlow for C build images and scripts (#4922)
* Fixed create_archive.sh

The previous version followed symlinks on doing the copy to a temporary
folder, so the resulting size was 3 times what it should be. Also
*.param files have been excluded from the final tar.gz file.

* Migrated tensorflow image to jammy

So as to build against an older version of glibc and support more OS
versions.

* Extend new create_archive.sh to all build types

The changes on the main create_archive.sh are now on all the other
versions.
2025-04-04 11:36:36 +02:00

27 lines
837 B
Bash
Executable File

#!/usr/bin/env bash
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Usage: $0 [platform] [tf-version]" 1>&2
exit 1
fi
echo "Creating 'libtensorflow-$1-$2.tar.gz'...";
rm -rf tmp
mkdir -p tmp/lib/
mkdir -p tmp/include/tensorflow/c/eager/
mkdir -p tmp/include/tensorflow/core/platform
mkdir -p tmp/include/tsl/platform
mkdir -p tmp/include/xla/tsl/c
cp -av bazel-bin/tensorflow/libtensorflow* tmp/lib/
cp tensorflow/c/eager/*.h tmp/include/tensorflow/c/eager/
cp tensorflow/c/*.h LICENSE tmp/include/tensorflow/c/
cp tensorflow/core/platform/*.h tmp/include/tensorflow/core/platform
cp third_party/xla/third_party/tsl/tsl/platform/*.h tmp/include/tsl/platform
cp third_party/xla/xla/tsl/c/*.h tmp/include/xla/tsl/c
(cd tmp && tar --exclude=*.params -czf ../libtensorflow-$1-$2.tar.gz .)
du -h libtensorflow-$1-$2.tar.gz
echo "Done"