File size: 1,840 Bytes
ed3aeeb | 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
uv_bin="${repo_root}/environment/bin/uv"
converter_root="${repo_root}/environment/converters/tf2onnx"
converter_venv="${converter_root}/.venv"
cache_dir="${repo_root}/environment/cache"
cd "${repo_root}"
if [[ ! -x "${uv_bin}" ]]; then
printf 'missing pinned uv executable: %s\n' "${uv_bin}" >&2
exit 2
fi
mkdir -p "${converter_root}"
if [[ ! -x "${converter_venv}/bin/python" ]]; then
"${uv_bin}" venv "${converter_venv}" --python 3.12.13 --seed --cache-dir "${cache_dir}"
fi
"${uv_bin}" pip install \
--python "${converter_venv}/bin/python" \
--cache-dir "${cache_dir}" \
--requirements "${converter_root}/requirements.lock"
"${uv_bin}" pip freeze --python "${converter_venv}/bin/python" \
| LC_ALL=C sort > "${converter_root}/installed-packages.txt"
sha256sum "${converter_root}/installed-packages.txt" > "${converter_root}/installed-packages.sha256"
"${converter_venv}/bin/python" - <<'PY'
import json
import platform
from pathlib import Path
import flatbuffers
import numpy
import onnx
import requests
import tf2onnx
import tensorflow as tf
from google.protobuf import __version__ as protobuf_version
root = Path.cwd() / "environment" / "converters" / "tf2onnx"
report = {
"python": platform.python_version(),
"tf2onnx": tf2onnx.__version__,
"tensorflow": tf.__version__,
"onnx": onnx.__version__,
"numpy": numpy.__version__,
"protobuf": protobuf_version,
"flatbuffers": flatbuffers.__version__,
"requests": requests.__version__,
}
(root / "tool_versions.json").write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
print(json.dumps(report, sort_keys=True))
PY
sha256sum "${converter_root}/tool_versions.json" > "${converter_root}/tool_versions.sha256"
|