-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.mlperf.sh
executable file
·65 lines (51 loc) · 2.3 KB
/
save.mlperf.sh
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
60
61
62
63
64
65
#/bin/bash
#
# Copyright (c) 2024 Krai Ltd.
#
# SPDX-License-Identifier: MIT.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
_SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd ${_SCRIPT_DIR}
source ./functions.sh
if [[ $# < 1 ]]; then
echo "Please enter the model name to save the krai/{mlperf,axs} Docker images for (one of: bert, resnet50, retinanet, sdxl).";
exit 1;
fi
function exit_if_error() {
if [ "${?}" != "0" ]; then exit 1; fi
}
MODEL=$1
echo "Saving 'krai/{mlperf,axs}.${MODEL}' images ..."
_WORKSPACE_DIR=${WORKSPACE_DIR:-"/local/mnt/workspace"}
_DOCKER_BACKUP_DIR=${DOCKER_BACKUP_DIR:-"${_WORKSPACE_DIR}/docker_backup"}
_DOCKER_OS=${DOCKER_OS:-"deb"}
_SDK_VER=${SDK_VER:-"1.14.2.0"}
_TIMESTAMP="$(date +'%Y%m%d')"
if [[ "${MODEL}" == "resnet50" ]]; then
IMAGENET_SUFFIX=".full"
fi
_FILENAME=${FILENAME:-"${_DOCKER_BACKUP_DIR}/mlperf.${MODEL}.${_DOCKER_OS}_${_SDK_VER}_${_TIMESTAMP}.tar"}
MLPERF_IMAGE_NAME="krai/mlperf.${MODEL}${IMAGENET_SUFFIX}:${_DOCKER_OS}_${_SDK_VER}"
AXS_IMAGE_NAME="krai/axs.${MODEL}${IMAGENET_SUFFIX}:${_DOCKER_OS}_latest"
time docker save -o "${_FILENAME}" \
$(docker image ls ${MLPERF_IMAGE_NAME} --format "{{.Repository}}:{{.Tag}}") \
$(docker image ls ${AXS_IMAGE_NAME} --format "{{.Repository}}:{{.Tag}}")
echo
echo "DONE (saving '${_FILENAME}')"
echo