Skip to content

Commit 222ca5c

Browse files
authored
Merge pull request #352 from jondea/fix-dockerize-and-deduplicate
pytorch: fix dockerize and deduplicate build logic
2 parents d6d1b2d + c503aa9 commit 222ca5c

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

ML-Frameworks/pytorch-aarch64/build.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,4 @@ torch_wheel_name=$(grep -o "torch-.*.whl" $build_log | head -n -1 | tail -n 1)
5050
# Use the second to last match, otherwise grep finds itself
5151
torch_ao_wheel_name=$(grep -o "torchao-.*.whl" $build_log | head -n -1 | tail -n 1)
5252

53-
docker build -t toolsolutions-pytorch:latest \
54-
--build-arg TORCH_WHEEL=results/$torch_wheel_name \
55-
--build-arg DOCKER_IMAGE_MIRROR \
56-
--build-arg TORCH_AO_WHEEL=ao/dist/$torch_ao_wheel_name \
57-
--build-arg USERNAME=ubuntu \
58-
.
53+
./dockerize.sh "results/$torch_wheel_name" "ao/dist/$torch_ao_wheel_name" --build-only

ML-Frameworks/pytorch-aarch64/dockerize.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@
1717
# limitations under the License.
1818
# *******************************************************************************
1919

20-
help_str="dockerize.sh takes a PyTorch wheel as the first argument and an ao wheel as second argument. It \
21-
installs the wheel inside a Docker container with examples and requirements."
22-
if [ "$#" -ne 2 ]; then
20+
help_str="dockerize.sh takes a PyTorch wheel as the first argument and an ao wheel
21+
as the second argument. It installs the wheel inside a Docker container with examples
22+
and requirements. The docker image will then be run unless you pass in the optional
23+
--build-only argument"
24+
25+
if [ "$#" -lt 2 ]; then
2326
echo $help_str
2427
exit 1
2528
fi
2629

2730
if ! [ -e "$1" ] || ! [ -e "$2" ]; then
28-
echo "I couldn't find a wheel at $1 or $2"
31+
echo "I couldn't find wheels at $1 and $2"
2932
echo $help_str
3033
exit 1
3134
fi
@@ -34,5 +37,8 @@ docker build -t toolsolutions-pytorch:latest \
3437
--build-arg TORCH_WHEEL=$1 \
3538
--build-arg DOCKER_IMAGE_MIRROR \
3639
--build-arg TORCH_AO_WHEEL=$2 \
40+
--build-arg USERNAME=ubuntu \
3741
.
42+
43+
[[ $* == *--build-only* ]] && exit 0
3844
docker run --rm -it toolsolutions-pytorch:latest

0 commit comments

Comments
 (0)