-
Notifications
You must be signed in to change notification settings - Fork 25
70 lines (66 loc) · 2.28 KB
/
tensorflow-to-larod-artpec8.yml
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
66
67
68
69
70
name: Build tensorflow-to-larod-artpec8 application
on:
workflow_dispatch:
push:
paths:
- 'tensorflow-to-larod-artpec8/**'
- '!tensorflow-to-larod-artpec8/README.md'
- '.github/workflows/tensorflow-to-larod-artpec8.yml'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: aarch64
chip: artpec8
axis-os: 11.5.64
env:
EXREPO: acap-native-examples
EXNAME: tensorflow-to-larod-artpec8
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- name: Build ${{ env.example }} application
env:
example: ${{ env.EXNAME }}
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
run: |
docker image rm -f $imagetag
cd $EXNAME
docker build --no-cache --tag $imagetag . --build-arg TRAIN_EPOCHS=1 --build-arg TUNE_EPOCHS=1
- name: Check if model file exists and its size
env:
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
buildpath: /env/training/models
modeldir: model
modelname: converted_model.tflite
run: |
found_error=no
[ -d $modeldir ] && rm -rf $modeldir
mkdir -p ./$modeldir
docker cp $(docker create $imagetag):$buildpath/$modelname ./$modeldir
if [ -f $modeldir/$modelname ]; then
echo "Model file exists"
# Check the file size
filesize=$(stat --printf="%s" $modeldir/$modelname)
minsize=$((1*1024*1024)) # 1MB
maxsize=$((10*1024*1024*1024)) # 10GB
if [ $filesize -ge $minsize ] && [ $filesize -le $maxsize ]; then
echo "Model file size ($filesize bytes) is within the expected range"
else
echo "Model file size ($filesize bytes) is out of the expected range"
found_error=yes
fi
else
echo "Model file does not exist, build directory contains"
ls -la $modeldir
found_error=yes
fi
# Cleanup
[ -d $modeldir ] && rm -rf $modeldir
docker image rm -f $imagetag
[ "$found_error" = no ] || {
echo "Error found during tests"
exit 1
}