aimodelshare 0.1.32__py3-none-any.whl → 0.1.62__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.

Files changed (38) hide show
  1. aimodelshare/__init__.py +94 -14
  2. aimodelshare/aimsonnx.py +312 -95
  3. aimodelshare/api.py +13 -12
  4. aimodelshare/auth.py +163 -0
  5. aimodelshare/aws.py +4 -4
  6. aimodelshare/base_image.py +1 -1
  7. aimodelshare/containerisation.py +1 -1
  8. aimodelshare/data_sharing/download_data.py +142 -87
  9. aimodelshare/generatemodelapi.py +7 -6
  10. aimodelshare/main/authorization.txt +275 -275
  11. aimodelshare/main/eval_lambda.txt +81 -13
  12. aimodelshare/model.py +493 -197
  13. aimodelshare/modeluser.py +89 -1
  14. aimodelshare/moral_compass/README.md +408 -0
  15. aimodelshare/moral_compass/__init__.py +37 -0
  16. aimodelshare/moral_compass/_version.py +3 -0
  17. aimodelshare/moral_compass/api_client.py +601 -0
  18. aimodelshare/moral_compass/apps/__init__.py +17 -0
  19. aimodelshare/moral_compass/apps/tutorial.py +198 -0
  20. aimodelshare/moral_compass/challenge.py +365 -0
  21. aimodelshare/moral_compass/config.py +187 -0
  22. aimodelshare/playground.py +26 -14
  23. aimodelshare/preprocessormodules.py +60 -6
  24. aimodelshare/pyspark/authorization.txt +258 -258
  25. aimodelshare/pyspark/eval_lambda.txt +1 -1
  26. aimodelshare/reproducibility.py +20 -5
  27. aimodelshare/utils/__init__.py +78 -0
  28. aimodelshare/utils/optional_deps.py +38 -0
  29. aimodelshare-0.1.62.dist-info/METADATA +298 -0
  30. {aimodelshare-0.1.32.dist-info → aimodelshare-0.1.62.dist-info}/RECORD +33 -25
  31. {aimodelshare-0.1.32.dist-info → aimodelshare-0.1.62.dist-info}/WHEEL +1 -1
  32. aimodelshare-0.1.62.dist-info/licenses/LICENSE +5 -0
  33. {aimodelshare-0.1.32.dist-info → aimodelshare-0.1.62.dist-info}/top_level.txt +0 -1
  34. aimodelshare-0.1.32.dist-info/METADATA +0 -78
  35. aimodelshare-0.1.32.dist-info/licenses/LICENSE +0 -22
  36. tests/__init__.py +0 -0
  37. tests/test_aimsonnx.py +0 -135
  38. tests/test_playground.py +0 -721
tests/test_aimsonnx.py DELETED
@@ -1,135 +0,0 @@
1
- from aimodelshare.aimsonnx import _get_layer_names
2
- from aimodelshare.aimsonnx import _get_layer_names_pytorch
3
- from aimodelshare.aimsonnx import _get_sklearn_modules
4
- from aimodelshare.aimsonnx import model_from_string
5
- from aimodelshare.aimsonnx import _get_pyspark_modules
6
- from aimodelshare.aimsonnx import pyspark_model_from_string
7
- from aimodelshare.aimsonnx import layer_mapping
8
- from aimodelshare.aimsonnx import _sklearn_to_onnx
9
- from aimodelshare.aimsonnx import _pyspark_to_onnx
10
- from aimodelshare.aimsonnx import _keras_to_onnx
11
- from aimodelshare.aimsonnx import _pytorch_to_onnx
12
- from aimodelshare.aimsonnx import _misc_to_onnx
13
- from sklearn.linear_model import LogisticRegression
14
- from sklearn.neural_network import MLPClassifier
15
- import onnx
16
- from xgboost import XGBClassifier
17
- from pyspark.ml.classification import RandomForestClassifier, MultilayerPerceptronClassifier
18
- from keras.models import Sequential
19
- from torch import nn
20
- import torch
21
- from tensorflow.keras.layers import Dense
22
-
23
- def test_sklearn_to_onnx():
24
-
25
- from sklearn.datasets import load_iris
26
- data = load_iris()
27
- X = data.data
28
- y = data.target
29
-
30
- model = LogisticRegression(C=10, penalty='l1', solver='liblinear')
31
- model.fit(X, y)
32
- onnx_model = _sklearn_to_onnx(model)
33
- assert isinstance(onnx_model, onnx.ModelProto)
34
-
35
- # model = MLPClassifier()
36
- # model.fit(X, y)
37
- # onnx_model = _sklearn_to_onnx(model)
38
- # assert isinstance(onnx_model, onnx.ModelProto)
39
-
40
-
41
- # def test_misc_to_onnx():
42
- #
43
- # model = XGBClassifier()
44
- # onnx_model = _misc_to_onnx(model)
45
- # assert isinstance(onnx_model, onnx.ModelProto)
46
-
47
-
48
- # def test_pyspark_to_onnx():
49
- #
50
- # model =RandomForestClassifier(labelCol="indexedLabel", featuresCol="indexedFeatures", numTrees=10)
51
- # onnx_model = _pyspark_to_onnx(model)
52
- # assert isinstance(onnx_model, onnx.ModelProto)
53
- #
54
- # model = MultilayerPerceptronClassifier()
55
- # onnx_model = _pyspark_to_onnx(model)
56
- # assert isinstance(onnx_model, onnx.ModelProto)
57
-
58
- def test_keras_to_onnx():
59
-
60
- model = Sequential()
61
- model.add(Dense(12, input_shape=(8,), activation='relu'))
62
- model.add(Dense(8, activation='relu'))
63
- model.add(Dense(1, activation='sigmoid'))
64
- model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
65
-
66
- onnx_model = _keras_to_onnx(model)
67
- assert isinstance(onnx_model, onnx.ModelProto)
68
-
69
-
70
- def test_pytorch_to_onnx():
71
-
72
- model = nn.Sequential(nn.Linear(3, 3),
73
- nn.ReLU(),
74
- nn.Linear(3, 1),
75
- nn.Sigmoid())
76
-
77
- onnx_model = _pytorch_to_onnx(model, torch.randn(1, 3))
78
- assert isinstance(onnx_model, onnx.ModelProto)
79
-
80
-
81
- def test_get_layer_names():
82
-
83
- layers = _get_layer_names()
84
-
85
- assert isinstance(layers, tuple)
86
-
87
-
88
- def test_get_layer_names_pytorch():
89
-
90
- layers = _get_layer_names_pytorch()
91
-
92
- assert isinstance(layers, tuple)
93
-
94
-
95
- def test_get_sklearn_modules():
96
-
97
- modules = _get_sklearn_modules()
98
-
99
- assert isinstance(modules, dict)
100
-
101
- def test_model_from_string():
102
-
103
- model_class = model_from_string("RandomForestClassifier")
104
-
105
- assert model_class.__name__ == "RandomForestClassifier"
106
-
107
-
108
- def test_get_pyspark_modules():
109
-
110
- modules = _get_pyspark_modules()
111
-
112
- assert isinstance(modules, dict)
113
-
114
-
115
- def test_pyspark_model_from_string():
116
-
117
- model_class = pyspark_model_from_string("RandomForestClassifier")
118
-
119
- assert model_class.__name__ == "RandomForestClassifier"
120
-
121
-
122
- def test_layer_mapping():
123
-
124
- layer_map = layer_mapping(direction="torch_to_keras")
125
- assert isinstance(layer_map, dict)
126
-
127
- layer_map = layer_mapping(direction="keras_to_torch")
128
- assert isinstance(layer_map, dict)
129
-
130
- layer_map = layer_mapping(direction="torch_to_keras", activation=True)
131
- assert isinstance(layer_map, dict)
132
-
133
- layer_map = layer_mapping(direction="keras_to_torch", activation=True)
134
- assert isinstance(layer_map, dict)
135
-