Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
d9f771e
convert softmax lambda to keras layer
doronHarnoy Feb 1, 2021
02e2b79
fix keras layer naming (: is not a valid name for keras layer)
doronHarnoy Feb 1, 2021
db883ec
update README and setup
doronHarnoy Feb 8, 2021
6b26800
change version in setup
doronHarnoy Feb 9, 2021
b280e66
adding setup.cfg
doronHarnoy Feb 9, 2021
edd8d11
update version
doronHarnoy Feb 9, 2021
7ea8883
change lib name
doronHarnoy Feb 9, 2021
8bef26c
update download_url
doronHarnoy Feb 9, 2021
dd5133f
change zero initializers to default keras init
doronHarnoy Feb 10, 2021
e9f9631
remove empty expand operations
doronHarnoy Mar 14, 2021
8feaff0
fix version 28 - add missing return
doronHarnoy Mar 14, 2021
a3f07e0
fix conv1d data format and padding bug
doronHarnoy Jun 17, 2021
40eed64
skip empty padding
doronHarnoy Jun 17, 2021
283d2b7
fix avgpooling padding issue
doronHarnoy Jun 17, 2021
7c0dde6
add avg pool 1d
doronHarnoy Jun 17, 2021
06d5571
bump version
doronHarnoy Jun 17, 2021
db2b2af
add attach weights name option
doronHarnoy Jul 14, 2021
6c3454a
Add custom onnx layers package (#12)
doronHarnoy May 23, 2022
465f1fe
Use our data format converter in model tests (#18)
doronHarnoy May 24, 2022
611ca26
add test for mobilenetv3 (#19)
tip3x May 24, 2022
68a37a0
add group convolutions
doronHarnoy May 24, 2022
6f1fc15
fix flatten layer
doronHarnoy May 24, 2022
cf60074
reformat
doronHarnoy May 24, 2022
f59dd08
Add reduce mean operation (#22)
doronHarnoy May 26, 2022
f7151cd
move data format converter to dev dependecy (#24)
doronHarnoy May 26, 2022
e20983d
add default for keepdims in reduce mean (#26)
doronHarnoy May 29, 2022
f44110d
add all torch classification models (#25)
doronHarnoy May 29, 2022
8279376
Add Erf operation layer (#27)
doronHarnoy May 29, 2022
f8c1b87
Add Sqrt operation layer use oplambda for power (#30)
doronHarnoy May 30, 2022
60d5791
multiple axes slicing support (#31)
tip3x Jun 1, 2022
7089936
Add support of gather and unsqueezed + Fix inception (#33)
tip3x Jun 2, 2022
fabb03c
add all resnet models
doronHarnoy May 31, 2022
b8b6f8d
reformat
doronHarnoy Jun 2, 2022
e17e2a2
add pre trained weights to resnet
doronHarnoy Jun 2, 2022
5666366
rename resnet test
doronHarnoy Jun 2, 2022
195bd25
add softmax at the end of the network to fix instable values
doronHarnoy Jun 2, 2022
2e24cc6
add pretrained tests (#35)
doronHarnoy Jun 6, 2022
44583ea
upgrade keras data format converter version (#37)
tip3x Jun 13, 2022
ad1ea73
Add unsupported layer exception (#40)
tip3x Jun 30, 2022
3b34d50
Use tensorflow-macos for arm64
yotamazriel Jul 3, 2022
f0f10c9
Soppurt m1
yotamazriel Jul 5, 2022
8426996
Bump pckg version
yotamazriel Jul 5, 2022
0a171e7
Update keras-data-format-converter (#43)
yotamazriel Jul 12, 2022
d263ea4
updata keras data format converter package (#44)
tip3x Jul 13, 2022
d8d26c5
update keras-data-format-converter package (#45)
tip3x Jul 17, 2022
24e82b2
Caffe (#39)
tomkoren21 Jul 17, 2022
0d74373
configure onnx only for x86_64 (#46)
doronHarnoy Jul 18, 2022
e810afd
expose inner keras layer (#48)
doronHarnoy Jul 31, 2022
881dfb8
Albert huggingface (#47)
tomkoren21 Aug 4, 2022
f595cc9
Fix numpy array on gather bug (#50)
tomkoren21 Aug 4, 2022
9ab4310
change onnx ver (#51)
doronHarnoy Aug 4, 2022
d21ea61
update data format converter (#49)
tip3x Aug 7, 2022
ae39fb0
lower onnx (#52)
doronHarnoy Aug 7, 2022
f600f6b
update keras-data-converter (#53)
tomkoren21 Aug 11, 2022
6ad0073
Support yolov7 (#54)
tip3x Sep 22, 2022
ce24b3a
Cityscapes (#55)
tomkoren21 Oct 3, 2022
f88c45e
Add bert support (#56)
tomkoren21 Oct 3, 2022
7e248d0
Add vit support (#58)
tomkoren21 Oct 3, 2022
627e593
Add ci (#59)
tomkoren21 Oct 6, 2022
91769fc
add ci seeds (#60)
tomkoren21 Oct 6, 2022
812cccb
replace H,W to represent real scale
tomkoren21 Oct 11, 2022
7ad5cdd
add abs
doronHarnoy Oct 19, 2022
bccb996
0.0.56
doronHarnoy Oct 19, 2022
41cdf22
Add abs (#63)
doronHarnoy Oct 19, 2022
317ca44
fix transpose of batch 0
doronHarnoy Oct 19, 2022
9cd0376
0.0.58
doronHarnoy Oct 19, 2022
7996913
test abs layer
tomkoren21 Oct 19, 2022
bb3df92
test transpose batch layer
tomkoren21 Oct 19, 2022
324c56a
Add support for multiple None shape values and Neg op (#67)
tip3x Oct 23, 2022
59492d8
Fix maxpool (#68)
tomkoren21 Oct 31, 2022
4b3c2ca
remove shufflenet from test due to wrong Pytorch->Onnx export (#71)
tomkoren21 Oct 31, 2022
57aba6a
skip vit test permanantly (#73)
tomkoren21 Oct 31, 2022
0eb4739
Support yolox (#74)
tip3x Nov 15, 2022
49e74b2
conv 3d (#75)
doronHarnoy Nov 17, 2022
046cfe7
fix slash name (#76)
doronHarnoy Nov 17, 2022
cc13f95
update data converter package (#77)
tip3x Dec 8, 2022
e95dea7
Fix padding 3d (#78)
tomkoren21 Dec 12, 2022
c698809
update tf (#79)
doronHarnoy Jan 10, 2023
8d125f6
Add x3d conv3d (#80)
tomkoren21 Jan 10, 2023
7a4e6f0
upgrade keras data format converter (#82)
tip3x Jan 19, 2023
c144886
fix split opset 14
tomkoren21 Mar 5, 2023
756b90b
add split test
tomkoren21 Mar 5, 2023
c8e5751
Add LSTM support , and fix some onnx2keras bugs (#85)
tip3x Mar 29, 2023
e5fcfba
get deault param if none
doronHarnoy Apr 2, 2023
a852c34
0.0.82
doronHarnoy Apr 2, 2023
2c9e3c9
Raft (#89)
tomkoren21 Apr 24, 2023
d5c6403
support raft (#91)
doronHarnoy May 7, 2023
ee7856e
Lstm 1 (#92)
tomkoren21 May 9, 2023
7fa8618
fixed a bug in convert_equal (#94)
RanHomri May 28, 2023
455a1e2
Fix convert expand for boolean input (#96)
RanHomri May 28, 2023
6107e2e
fix gridsampler (#95)
doronHarnoy May 28, 2023
037c34c
added convert_not layer (#99)
RanHomri May 28, 2023
0a4b66c
Add convert cosine layer (#100)
RanHomri May 28, 2023
8ec93fe
remove elipsis grid sample (#101)
doronHarnoy Jun 5, 2023
a12d49c
Modifications to support ludwig model (#102)
RanHomri Jun 7, 2023
ecd40bd
Bugfix in ludwig modifications (#103)
RanHomri Jun 8, 2023
8828906
Support heatmaps for OnnxLSTM layer (#104)
tip3x Jun 12, 2023
923388f
Bugfix | dynamic batch lstm (#105)
tip3x Jun 13, 2023
f0e9d29
fix lstm states shape (#106)
doronHarnoy Jun 14, 2023
08d3823
add logical operations layers (#107)
doronHarnoy Jul 4, 2023
aa617d7
Fix mult and embedding (#109)
tomkoren21 Jul 6, 2023
13c6f92
add trilu op (#108)
doronHarnoy Jul 6, 2023
4fbf821
Add ops: sign, sin, sinh, cosh (#110)
tip3x Jul 11, 2023
fb8da47
Add easy ops (#111)
tip3x Jul 12, 2023
d1114d5
remove ensure_numpy_type (#112)
doronHarnoy Jul 19, 2023
cd0c26f
Support one hot (#113)
tomkoren21 Jul 24, 2023
313858a
Add onnx ops (#114)
tomkoren21 Jul 27, 2023
5b1ec40
modification for wav2vec conversion (#115)
RanHomri Jul 30, 2023
5596384
onnx2keras version 0.0.112 (#116)
RanHomri Jul 30, 2023
df3ea2b
add support for nonzero and gathernd (#118)
doronHarnoy Aug 15, 2023
477a1aa
add more activation functions (#119)
doronHarnoy Aug 22, 2023
7767328
Add ops no UI (#122)
tomkoren21 Sep 4, 2023
65ffafe
add support map for onnx functions (#121)
doronHarnoy Sep 4, 2023
c0979b0
fix cast (#123)
doronHarnoy Sep 10, 2023
6bd290e
fix layer name issues
doronHarnoy Sep 13, 2023
b285c69
replace custom reduce by keras reduce
doronHarnoy Sep 13, 2023
83d34ef
add default axis for gather
doronHarnoy Sep 13, 2023
fb4ffc3
handle tensor with negative indices
doronHarnoy Sep 13, 2023
979cd4c
0.0.116
doronHarnoy Sep 13, 2023
e49f397
Fix dino (#125)
tomkoren21 Oct 2, 2023
6f55bea
fixes-for-clip-conversion (#126)
RanHomri Oct 11, 2023
511db17
Glpn (#120)
daniellebenbashat Nov 2, 2023
fbd8f34
support dynamic shape (#127)
yotamazriel Nov 8, 2023
7eba7b8
Glpn quickfix (#128)
tomkoren21 Nov 13, 2023
7f3156d
remove weights less custom layers
doronHarnoy Nov 26, 2023
1086cf8
return half model (#130)
doronHarnoy Dec 10, 2023
5bc29e9
bugfix in convert reduce l2 target layer (#131)
RanHomri Dec 20, 2023
fdc7aa7
replace if parsing by flattening onnx graph
tomkoren21 Jan 16, 2024
6d780c7
add roialign
tomkoren21 Jan 16, 2024
9649acb
add if conversion
tomkoren21 Jan 18, 2024
60cfd1a
fix reshape
tomkoren21 Jan 18, 2024
4b1c4a5
support dynamic in flatten
tomkoren21 Jan 18, 2024
d4d77c5
support unknown shape in slice
tomkoren21 Jan 18, 2024
665f9a2
add if and roialign to layers
tomkoren21 Jan 16, 2024
eacf99c
add tf dtype to support serialization issues
tomkoren21 Jan 16, 2024
603f3b6
add reshape before dynamic channels conv - otherwise does not seriali…
tomkoren21 Jan 16, 2024
3335330
do not run any(pads) on kerastensor since it raises error
tomkoren21 Jan 16, 2024
7e70e78
support 6 length padding and avoid using len on pads - is not support…
tomkoren21 Jan 16, 2024
579c9a1
safe access to axis
tomkoren21 Jan 16, 2024
e025e7b
fix reduce_prod to support default axes and cast keepdims to correct …
tomkoren21 Jan 16, 2024
316b582
the _outputs param should not be used when splits is of len(0) - then…
tomkoren21 Jan 16, 2024
de41a45
support np.bool
tomkoren21 Jan 16, 2024
5aec608
support shape of an unknown shaped vector
tomkoren21 Jan 16, 2024
695d674
support dynamic gather
tomkoren21 Jan 16, 2024
7dbfc0f
unknown shaped tensor should be concat using tf.concat
tomkoren21 Jan 16, 2024
6108fcb
skip dynamic reshape when input_0 shape is flat/unknown
tomkoren21 Jan 16, 2024
3a88428
refactor
tomkoren21 Jan 18, 2024
7a23db8
refactor
tomkoren21 Jan 18, 2024
8482201
cast k to int32 and support serialization for eager tensor in topk
tomkoren21 Jan 18, 2024
dbd74ee
rename outputs to support expected output names
tomkoren21 Jan 18, 2024
f36d81f
remove elipsis from nms to support leap-model-parser call args
tomkoren21 Jan 18, 2024
8790d09
bump versions
tomkoren21 Feb 5, 2024
1ee56f1
Fix ci aws (#133)
tomkoren21 Feb 28, 2024
1a44a5d
Some fixes to reshape converter (#135)
tip3x Mar 10, 2024
63224aa
wip (#134)
RanHomri Mar 19, 2024
213889b
Add develop flag (#137)
tomkoren21 Mar 20, 2024
98aa6f5
remove force type change (#138)
tomkoren21 Mar 20, 2024
46a3665
Revert int32 casting removal (#139)
tomkoren21 Mar 20, 2024
0759929
0.0.124
tomkoren21 Mar 26, 2024
6c0eaca
gardin fixes (#141)
RanHomri Apr 14, 2024
98532c8
casablanca fixes (#142)
RanHomri Apr 15, 2024
ae540cb
not all tensors has rank property, taking length instead
tomkoren21 Apr 24, 2024
35573dc
float*int = int in tensorleap. inner multipication should be on float…
tomkoren21 Apr 24, 2024
769e202
add dinov2 test
tomkoren21 Apr 24, 2024
b572c56
bump version
tomkoren21 Apr 24, 2024
eff9bce
por additional fixes (#145)
RanHomri May 2, 2024
0f88359
up version (#146)
RanHomri May 2, 2024
5aa15cb
add percentage to debug logging
tomkoren21 Jun 13, 2024
982afb2
allow optional inputs in GRU
tomkoren21 Jun 13, 2024
bfea0c0
add GRU support
tomkoren21 Jun 13, 2024
1624b12
allow result to be an array
tomkoren21 Jun 13, 2024
f1ca854
support GRU
tomkoren21 Jun 13, 2024
06d1f19
add test for iconqa
tomkoren21 Jun 13, 2024
1bd4319
up version
tomkoren21 Jun 17, 2024
8e9fba5
ensure float in nms iou_th
tomkoren21 Jun 18, 2024
a8c3e09
added reshape to topk to prevent needless dynamic k
tomkoren21 Jun 18, 2024
a0c2613
added broadcasting and fixed faulty ensure_tf_type usage
tomkoren21 Jun 18, 2024
047071b
optimize gather for sertialization of long constant arrays
tomkoren21 Jun 18, 2024
dfa38fd
support both scalar iou_th and array
tomkoren21 Jun 18, 2024
33c97f5
support integer indices in gather
tomkoren21 Jun 18, 2024
8af3b69
fix nh/nw calculation for roialign
tomkoren21 Jun 19, 2024
ade8dc3
fix nearest_mode equals floor rounding for convert_resize
tomkoren21 Jun 19, 2024
9aafbc4
add test
tomkoren21 Jun 19, 2024
79e2631
adjust prob th
tomkoren21 Jun 19, 2024
b1f1f02
bump o2k version
tomkoren21 Jun 20, 2024
24861a0
add line comments to plainly explain what blocks are doing
tomkoren21 Jun 20, 2024
d9f7738
leap-model-parser cant handle tensorshape
tomkoren21 Jun 20, 2024
2246820
up version
tomkoren21 Jun 20, 2024
0daf60a
bugfix in resize (#153)
RanHomri Jun 23, 2024
32124a5
remove broadcast and convert_to_tensor
tomkoren21 Jun 25, 2024
c073cce
fix tensor-identity-cast by upcasting then downcasting
tomkoren21 Jun 25, 2024
0707a28
fix tensor-identity-cast on convert_less
tomkoren21 Jun 25, 2024
c1f6b71
propogate_name_to_cast
tomkoren21 Jun 25, 2024
7d7db1b
increase version
tomkoren21 Jun 25, 2024
da71139
add env variable that would allow local testing
tomkoren21 Jun 25, 2024
d209cb2
fix layer testing
tomkoren21 Jul 1, 2024
9e65e72
fix k reshaping for non-flat shapres and axis!=-1
tomkoren21 Jul 3, 2024
75c7cf8
add layer unit testing
tomkoren21 Jul 3, 2024
29353e9
seperate layers and models testing
tomkoren21 Jul 3, 2024
f251296
up version - no build
tomkoren21 Jul 7, 2024
a03fcee
support KerasTensor params in Resize (#161)
RanHomri Jul 14, 2024
5b13491
change order in poetry - ignore
tomkoren21 Jul 16, 2024
fd16a10
wrap tfopslambda with a wrapper that allows naming
tomkoren21 Jul 16, 2024
d2be38a
use cleaned_name param to pass node names to layers
tomkoren21 Jul 16, 2024
b267a19
add traffic light test
tomkoren21 Jul 16, 2024
9992a65
rename all layers
tomkoren21 Jul 16, 2024
424b1ed
replace keras_name with new naming
tomkoren21 Jul 4, 2024
9758155
apply suggestions
tomkoren21 Jul 21, 2024
283f1df
up version - no build
tomkoren21 Jul 21, 2024
5771067
add ci and leap-parser dynamic tests (#162)
tomkoren21 Jul 25, 2024
1d4a483
Test ci (#163)
tomkoren21 Jul 25, 2024
75a232a
remove non tensors from middle layers (#160)
doronHarnoy Jul 28, 2024
5942e44
Add swin (#165)
tomkoren21 Aug 6, 2024
2e76e8d
add conversion script (#166)
RanHomri Aug 6, 2024
389f984
add commit message (#168)
tomkoren21 Aug 7, 2024
6cde5c2
remove tests and add end2end yml (#169)
tomkoren21 Aug 7, 2024
432cf10
add sha and commit status (#171)
tomkoren21 Aug 9, 2024
afab0a7
change permission (#172)
tomkoren21 Aug 27, 2024
396519b
Fix gpx (#173)
tomkoren21 Aug 28, 2024
01ed1a5
fix einsum (#174)
tip3x Sep 22, 2024
0e52254
fix clip (#177)
tip3x Oct 9, 2024
a3ef47c
handling constants with a custom layer (mul) (#179)
RanHomri Nov 10, 2024
7ec48a1
correct channels calculation when groups appear (#181)
tomkoren21 Nov 26, 2024
dd9b326
Grasp v2 (#183)
tomkoren21 Dec 10, 2024
a0070fc
add pick tests (#184)
tomkoren21 Dec 15, 2024
82532da
pixellot fixes (#185)
RanHomri Dec 15, 2024
25e7db9
Mac branch (#186)
tomkoren21 Jan 14, 2025
c0dc4f3
Fix Copyright
yotamazriel Jan 29, 2025
862293f
Fix ci (#188)
tomkoren21 Feb 10, 2025
1645beb
up cache action version (#189)
tomkoren21 Mar 9, 2025
051b51e
Yolov11 (#190)
yamtawachi Mar 9, 2025
077a8db
Yolov11 fixed (#192)
yamtawachi Mar 12, 2025
8f37b2f
Llama test sentiment analysis (#194)
NirBenZikri Jun 4, 2025
80b6599
Fix railvision (#195)
tomkoren21 Jun 15, 2025
e0f7ef3
Update convert_slice function (#196)
Chen-Roth Jun 23, 2025
b207b76
Fix mnist onnx (#197)
tomkoren21 Jun 23, 2025
93f9160
latent space for lstm (#198)
tip3x Jun 25, 2025
48bf57d
Bugfix | index out of range in slice op (#199)
tip3x Aug 5, 2025
1a3c07b
Bugfix | gather with minus in indices (#200)
tip3x Nov 5, 2025
6eba7a5
adding ctformer and interfuser models
or-tensorleap Nov 16, 2025
88591e3
fixed error col2im
or-tensorleap Nov 16, 2025
ac0138b
refacctor file
or-tensorleap Nov 16, 2025
316f22f
ctformer o2k version
Nov 18, 2025
5b18a05
adding interfuser test to private models
or-tensorleap Nov 19, 2025
cf1c0fd
update toml
or-tensorleap Nov 19, 2025
9cfba74
aws s3 imports
or-tensorleap Nov 19, 2025
71b1ea9
cleanning ctformer functions
or-tensorleap Nov 19, 2025
dc1d091
dev version
or-tensorleap Nov 20, 2025
2427e64
update data-format-convertor
or-tensorleap Nov 20, 2025
abf4291
update data-format-convertor
or-tensorleap Nov 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI
on: [push]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
python-setup:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-24.04]
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.8
#---------------------------#
- name: Compute Cache Key (Ignoring Only [tool.poetry] version)
id: compute-cache-key
run: |
awk '
/^\[tool.poetry\]/ {p=1}
/^\[/ && !/^\[tool.poetry\]/ {p=0}
p && /^[[:space:]]*version[[:space:]]*=/ {next}
{print}
' pyproject.toml | sha256sum | cut -d " " -f1 > cache_key.txt
echo "cache_key=venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-$(cat cache_key.txt)" >> $GITHUB_OUTPUT
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: ${{ steps.compute-cache-key.outputs.cache_key }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with=dev
- name: Debug Poetry Environment
run: |
poetry env info
ls -l .venv/bin/pytest
outputs:
python-version: ${{ steps.setup-python.outputs.python-version }}
cache_key: ${{ steps.compute-cache-key.outputs.cache_key }}
test:
runs-on: ubuntu-latest
needs: python-setup
strategy:
matrix:
os: [ubuntu-24.04]
pytest_target: [models, layers]
name: test-${{ matrix.pytest_target }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Poetry in Test Job
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv from setup job
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: ${{ needs.python-setup.outputs.cache_key }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.1
with:
role-to-assume: arn:aws:iam::898022457080:role/github-action-test-s3-access-role
aws-region: us-east-1
- name: Test with pytest
run: |
source .venv/bin/activate
pytest test/${{ matrix.pytest_target }}/
182 changes: 182 additions & 0 deletions .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: Start End2End test
on:
workflow_dispatch:
inputs:
model_name:
description: 'Model name'
required: true
cloud_dir:
description: 'Cloud directory'
required: true
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
issues: write # permits an action to add a comment to an issue.
pull-requests: write
jobs:
update-leap-model-parser:
runs-on: ubuntu-latest
steps:
- name: Check branch name
id: check_branch
run: |
if [ "${{ github.event.inputs.branch }}" = "master" ]; then
echo "::error::Manual runs not allowed from master branch."
exit 1
fi
- name: Extract branch name
id: extract_branch
run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/})"
- name: Check out repository
uses: actions/checkout@v2
- name: Get package version from pyproject.toml
id: package_version
run: |
PACKAGE_VERSION=$(awk -F' = ' '$1 == "version" {gsub(/"/, "", $2); print $2}' pyproject.toml | head -n 1)
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "$PACKAGE_VERSION"
- name: Set up python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.8.12
- name: Set Poetry Lock Hash
run: |
echo "POETRY_HASH=$(sha256sum poetry.lock | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache/restore@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ env.POETRY_HASH }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Save cache
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ env.POETRY_HASH }}
- name: Check if version exists on PyPI
id: check_version
run: |
URL="https://pypi.org/pypi/onnx2kerastl/$PACKAGE_VERSION/json"
echo "URL: $URL"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ $RESPONSE -eq 200 ]; then
echo "Version $PACKAGE_VERSION already exists on PyPI."
echo "IS_O2K_PUBLISHED=true" >> $GITHUB_ENV
else
echo "Version $PACKAGE_VERSION does not exist on PyPI."
echo "IS_O2K_PUBLISHED=false" >> $GITHUB_ENV
fi
- name: Build and publish O2K package
if: success() # Only run this step if the previous steps were successful
run: |
if [ "$IS_O2K_PUBLISHED" != "true" ]; then
poetry build
poetry publish -u __token__ -p ${{ secrets.PYPI_O2K }}
echo "Published O2K version $PACKAGE_VERSION"
else
echo "Skipping publishing as version already exists on PyPI."
fi
- name: checkout leap model parser
uses: actions/checkout@v4
with:
token: ${{ secrets.TENSORLEAP_OPS_GITHUB_TOKEN }}
repository: tensorleap/leap-model-parser
path: leap-model-parser
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.1
with:
role-to-assume: arn:aws:iam::898022457080:role/github-action-test-s3-access-role
aws-region: us-east-1
- name: Configure GIT credentials
run: |
git config --global user.email github-actions@github.com
git config --global user.name github-actions
- name: leap-model-parser test and push
working-directory: leap-model-parser
id: parser_test
env:
PYTHONPATH: ${{ env.PYTHONPATH }}:${{ github.workspace }}/leap-model-parser
run: | #fetch or create branch, update-o2k-version
echo "Project version is $PACKAGE_VERSION"
BRANCH="${{ steps.extract_branch.outputs.branch_name }}-from-o2k"
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
if git ls-remote --exit-code --heads origin "$BRANCH" >/dev/null 2>&1; then
git fetch origin "$BRANCH"
git checkout "$BRANCH"
else
git checkout -b "$BRANCH"
fi
# add packages with retry
clear_cache() {
echo "Clearing Poetry cache..."
poetry cache clear . --all --no-interaction
}
add_packages() {
poetry add onnx2kerastl==$PACKAGE_VERSION
}
max_retries=3
attempt=0
# Try to add packages
while [ $attempt -lt $max_retries ]; do
echo "Attempt $(($attempt + 1)) to add the package..."

# Attempt to add the package
if add_packages; then
echo "Package added successfully."
break
else
echo "Package add failed."

# Clear the cache before retrying
clear_cache

# Increment the attempt counter
attempt=$((attempt + 1))

# If this was the last attempt, exit with failure
if [ $attempt -ge $max_retries ]; then
echo "Failed to add the package after $max_retries attempts."
exit 1
fi
fi
done
source .venv/bin/activate
cd tests
if pytest -s test_branch_model.py --cloud_dir ${{ github.event.inputs.cloud_dir }} --model_name ${{ github.event.inputs.model_name }}; then
TEST_CONCLUSION=success
echo "Tests passed, Pushing Branch if needed"
cd ..
git add -u
if git status --porcelain | grep -q '^M'; then
echo "Files are modified - updating branch"
git commit -m "update O2K --model_name ${{ github.event.inputs.model_name }} --cloud_dir ${{ github.event.inputs.cloud_dir }} --sha $GITHUB_SHA"
git push origin "$BRANCH"
else
echo "No changes were made to leap-model-parser - not pushing the branch"
fi
else
TEST_CONCLUSION=failure
echo "Tests Failed, check pytest output"
fi
echo "TEST_CONCLUSION=$TEST_CONCLUSION" >> $GITHUB_ENV
- name: add commit status
id: commit_status
run: |
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.TENSORLEAP_OPS_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/tensorleap/onnx2keras/statuses/$GITHUB_SHA \
-d '{"state":"'${TEST_CONCLUSION}'","target_url":"https://github.com/'${GITHUB_REPOSITORY}'/actions/runs/'${GITHUB_RUN_ID}'","description":"Leap model parser dynamic test result","context":"end2end/parser-dynamic-test"}'
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,14 @@ __pycache__/
*.egg-info
*.onnx
*.h5
dist/
*.npy
*.pth
*.log
dist/
*.DS_Store
.python-version
test/models/custom_conversion_tests

.vscode/
gallery_models
.DS_Store
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
PYTHONPATH := .
POETRY_MODULE := PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python poetry run python -m
PYTEST := $(POETRY_MODULE) pytest

.PHONY: run_tests
run_tests:
$(PYTEST) test -v


.PHONY: poetry_update
poetry_update:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python poetry update

.PHONY: test_models
test_models:
$(PYTEST) test/models -v

.PHONY: watch
watch:
$(POETRY_MODULE) pytest_watch --runner "python -m pytest -v -k $(K)"

.PHONY: lint
lint:
$(POETRY_MODULE) mypy --install-types --non-interactive .

.PHONY: lint_strict_code
lint_strict_code:
$(POETRY_MODULE) mypy --install-types --non-interactive --strict code_loader

.PHONY: lint_tests
lint_tests:
$(POETRY_MODULE) mypy --install-types --non-interactive tests

.PHONY: test_with_coverage
test_with_coverage:
$(PYTEST) --cov=code_loader --cov-branch --no-cov-on-fail --cov-report term-missing --cov-report html -v tests/


7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# onnx2keras
# Tensorleap fork of onnx2keras

ONNX to Keras deep neural network converter.

Expand All @@ -21,7 +21,7 @@ TensorFlow 2.0

`input_shapes`: override input shapes (experimental)

`name_policy`: ['renumerate', 'short', 'default'] override layer names (experimental)
`name_policy`: ['renumerate', 'short', 'default', 'attach_weights_name'] override layer names (experimental)

`verbose`: detailed output

Expand All @@ -31,9 +31,10 @@ TensorFlow 2.0
## Getting started

### ONNX model

```python
import onnx
from onnx2keras import onnx_to_keras
from onnx2kerastl import onnx_to_keras

# Load ONNX model
onnx_model = onnx.load('resnet18.onnx')
Expand Down
4 changes: 0 additions & 4 deletions onnx2keras/__init__.py

This file was deleted.

Loading