aimodelshare 0.1.29__py3-none-any.whl → 0.1.64__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 (41) hide show
  1. aimodelshare/__init__.py +94 -14
  2. aimodelshare/aimsonnx.py +417 -262
  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 +103 -70
  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 +26 -0
  19. aimodelshare/moral_compass/apps/ai_consequences.py +297 -0
  20. aimodelshare/moral_compass/apps/judge.py +299 -0
  21. aimodelshare/moral_compass/apps/tutorial.py +198 -0
  22. aimodelshare/moral_compass/apps/what_is_ai.py +426 -0
  23. aimodelshare/moral_compass/challenge.py +365 -0
  24. aimodelshare/moral_compass/config.py +187 -0
  25. aimodelshare/playground.py +26 -14
  26. aimodelshare/preprocessormodules.py +60 -6
  27. aimodelshare/pyspark/authorization.txt +258 -258
  28. aimodelshare/pyspark/eval_lambda.txt +1 -1
  29. aimodelshare/reproducibility.py +20 -5
  30. aimodelshare/utils/__init__.py +78 -0
  31. aimodelshare/utils/optional_deps.py +38 -0
  32. aimodelshare-0.1.64.dist-info/METADATA +298 -0
  33. {aimodelshare-0.1.29.dist-info → aimodelshare-0.1.64.dist-info}/RECORD +36 -25
  34. {aimodelshare-0.1.29.dist-info → aimodelshare-0.1.64.dist-info}/WHEEL +1 -1
  35. aimodelshare-0.1.64.dist-info/licenses/LICENSE +5 -0
  36. {aimodelshare-0.1.29.dist-info → aimodelshare-0.1.64.dist-info}/top_level.txt +0 -1
  37. aimodelshare-0.1.29.dist-info/METADATA +0 -78
  38. aimodelshare-0.1.29.dist-info/licenses/LICENSE +0 -22
  39. tests/__init__.py +0 -0
  40. tests/test_aimsonnx.py +0 -135
  41. tests/test_playground.py +0 -721
@@ -1,22 +0,0 @@
1
-
2
- MIT License
3
-
4
- Copyright (c) 2023 AI Model Share Initiative (And all affiliated organizations and individuals)
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
tests/__init__.py DELETED
File without changes
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
-