aimodelshare 0.1.34__py3-none-any.whl → 0.1.36__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aimodelshare might be problematic. Click here for more details.
- aimodelshare/aimsonnx.py +31 -10
- {aimodelshare-0.1.34.dist-info → aimodelshare-0.1.36.dist-info}/METADATA +1 -1
- {aimodelshare-0.1.34.dist-info → aimodelshare-0.1.36.dist-info}/RECORD +6 -6
- {aimodelshare-0.1.34.dist-info → aimodelshare-0.1.36.dist-info}/WHEEL +0 -0
- {aimodelshare-0.1.34.dist-info → aimodelshare-0.1.36.dist-info}/licenses/LICENSE +0 -0
- {aimodelshare-0.1.34.dist-info → aimodelshare-0.1.36.dist-info}/top_level.txt +0 -0
aimodelshare/aimsonnx.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# data wrangling
|
|
2
2
|
import pandas as pd
|
|
3
|
-
import numpy as np
|
|
3
|
+
import numpy as np
|
|
4
4
|
|
|
5
5
|
# ml frameworks
|
|
6
6
|
try:
|
|
@@ -92,11 +92,14 @@ def _extract_onnx_metadata(onnx_model, framework):
|
|
|
92
92
|
# initialize metadata dict
|
|
93
93
|
metadata_onnx = {}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
def _get_shape(dims):
|
|
96
|
+
return [d.dim_value if d.HasField("dim_value") else None for d in dims]
|
|
97
|
+
|
|
98
|
+
input_dims = graph.input[0].type.tensor_type.shape.dim
|
|
99
|
+
output_dims = graph.output[0].type.tensor_type.shape.dim
|
|
100
|
+
|
|
101
|
+
metadata_onnx["input_shape"] = _get_shape(input_dims)
|
|
102
|
+
metadata_onnx["output_shape"] = _get_shape(output_dims)
|
|
100
103
|
|
|
101
104
|
# get layers and activations NEW
|
|
102
105
|
# match layers and nodes and initalizers in sinle object
|
|
@@ -654,23 +657,41 @@ def _keras_to_onnx(model, transfer_learning=None,
|
|
|
654
657
|
pass # fallback, don't crash conversion
|
|
655
658
|
|
|
656
659
|
keras_layers = keras_unpack(model)
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
from tensorflow.python.framework import tensor_shape # <- place this at the top of your file
|
|
663
|
+
|
|
657
664
|
layers = []
|
|
658
665
|
layers_n_params = []
|
|
659
666
|
layers_shapes = []
|
|
660
667
|
activations = []
|
|
661
|
-
|
|
668
|
+
|
|
662
669
|
for layer in keras_layers:
|
|
670
|
+
# layer name
|
|
663
671
|
layers.append(layer.__class__.__name__)
|
|
664
|
-
layers_n_params.append(layer.count_params())
|
|
665
672
|
|
|
673
|
+
# parameter count
|
|
674
|
+
try:
|
|
675
|
+
layers_n_params.append(layer.count_params())
|
|
676
|
+
except:
|
|
677
|
+
layers_n_params.append(0)
|
|
678
|
+
|
|
679
|
+
# output shape (sanitized for JSON)
|
|
666
680
|
shape = getattr(layer, 'output_shape', None)
|
|
667
|
-
|
|
681
|
+
|
|
682
|
+
if isinstance(shape, tensor_shape.TensorShape):
|
|
683
|
+
shape = shape.as_list()
|
|
684
|
+
elif shape is not None:
|
|
668
685
|
try:
|
|
669
|
-
shape =
|
|
686
|
+
shape = list(shape)
|
|
670
687
|
except:
|
|
671
688
|
shape = str(shape)
|
|
689
|
+
else:
|
|
690
|
+
shape = None
|
|
691
|
+
|
|
672
692
|
layers_shapes.append(shape)
|
|
673
693
|
|
|
694
|
+
# activation
|
|
674
695
|
if hasattr(layer, 'activation'):
|
|
675
696
|
act = getattr(layer.activation, '__name__', None)
|
|
676
697
|
if act:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aimodelshare
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.36
|
|
4
4
|
Summary: Deploy locally saved machine learning models to a live rest API and web-dashboard. Share it with the world via modelshare.org
|
|
5
5
|
Home-page: https://www.modelshare.org
|
|
6
6
|
Author: Michael Parrott
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
aimodelshare/README.md,sha256=_OMdUIeIYZnpFlKdafM1KNWaANO2nWdx0QpLE_ZC-Qs,2014
|
|
2
2
|
aimodelshare/__init__.py,sha256=CS0iFxgAic21gBcQE6NSZ-D_ElHw80_A3OWrEYo9Dks,539
|
|
3
|
-
aimodelshare/aimsonnx.py,sha256=
|
|
3
|
+
aimodelshare/aimsonnx.py,sha256=oFPRaZ6HGqj8m9l1Zq1cBPMk9cH3QGy8Ru1c8xsQ9rY,68162
|
|
4
4
|
aimodelshare/api.py,sha256=jeCIMbpBllTYi-bPvCdNvI6yHaT3JYakq9fgaz10s_E,34920
|
|
5
5
|
aimodelshare/aws.py,sha256=jn99R9-N77Qac-_eYm-LaCQUPd-RnE7oVULm9rh-3RY,15232
|
|
6
6
|
aimodelshare/aws_client.py,sha256=Ce19iwf69BwpuyyJlVN8z1da3c5jf93svsTgx1OWhaA,6784
|
|
@@ -140,11 +140,11 @@ aimodelshare/sam/codepipeline_policies.txt,sha256=267HMXMnbP7qRASkmFZYSx-2HmKf5o
|
|
|
140
140
|
aimodelshare/sam/codepipeline_trust_relationship.txt,sha256=yfPYvZlN3fnaIHs7I3ENMMveigIE89mufV9pvR8EQH8,245
|
|
141
141
|
aimodelshare/sam/spark-class.txt,sha256=chyJBxDzCzlUKXzVQYTzuJ2PXCTwg8_gd1yfnI-xbRw,217
|
|
142
142
|
aimodelshare/sam/template.txt,sha256=JKSvEOZNaaLalHSx7r9psJg_6LLCb0XLAYi1-jYPu3M,1195
|
|
143
|
-
aimodelshare-0.1.
|
|
143
|
+
aimodelshare-0.1.36.dist-info/licenses/LICENSE,sha256=JXBYLriXYgTloZs-9CJPZY76dqkuDT5df_HghMnljx8,1134
|
|
144
144
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
145
145
|
tests/test_aimsonnx.py,sha256=-GOF1_qXGQaMxHyqK0GPg7dD1meE-S7CZea4pLmBDTk,3906
|
|
146
146
|
tests/test_playground.py,sha256=vdFWPRrZNQ2poiBOoN3l7HsXB5yc3p3rrrclNYJHnaw,24574
|
|
147
|
-
aimodelshare-0.1.
|
|
148
|
-
aimodelshare-0.1.
|
|
149
|
-
aimodelshare-0.1.
|
|
150
|
-
aimodelshare-0.1.
|
|
147
|
+
aimodelshare-0.1.36.dist-info/METADATA,sha256=KJcDX9G3XAOH3kWaxGRoV4oArRv3R25ipKl9Aht7CP4,2916
|
|
148
|
+
aimodelshare-0.1.36.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
|
149
|
+
aimodelshare-0.1.36.dist-info/top_level.txt,sha256=2KJgeHQ0BmZuilB75J203i7W4vri6CON2kdbwk9BNpU,19
|
|
150
|
+
aimodelshare-0.1.36.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|