aimodelshare 0.1.12__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.
- aimodelshare/__init__.py +94 -14
- aimodelshare/aimsonnx.py +417 -262
- aimodelshare/api.py +7 -6
- aimodelshare/auth.py +163 -0
- aimodelshare/aws.py +4 -4
- aimodelshare/base_image.py +1 -1
- aimodelshare/containerisation.py +1 -1
- aimodelshare/data_sharing/download_data.py +145 -88
- aimodelshare/generatemodelapi.py +7 -6
- aimodelshare/main/eval_lambda.txt +81 -13
- aimodelshare/model.py +493 -197
- aimodelshare/modeluser.py +89 -1
- aimodelshare/moral_compass/README.md +408 -0
- aimodelshare/moral_compass/__init__.py +37 -0
- aimodelshare/moral_compass/_version.py +3 -0
- aimodelshare/moral_compass/api_client.py +601 -0
- aimodelshare/moral_compass/apps/__init__.py +26 -0
- aimodelshare/moral_compass/apps/ai_consequences.py +297 -0
- aimodelshare/moral_compass/apps/judge.py +299 -0
- aimodelshare/moral_compass/apps/tutorial.py +198 -0
- aimodelshare/moral_compass/apps/what_is_ai.py +426 -0
- aimodelshare/moral_compass/challenge.py +365 -0
- aimodelshare/moral_compass/config.py +187 -0
- aimodelshare/playground.py +26 -14
- aimodelshare/preprocessormodules.py +60 -6
- aimodelshare/reproducibility.py +20 -5
- aimodelshare/utils/__init__.py +78 -0
- aimodelshare/utils/optional_deps.py +38 -0
- aimodelshare-0.1.64.dist-info/METADATA +298 -0
- {aimodelshare-0.1.12.dist-info → aimodelshare-0.1.64.dist-info}/RECORD +33 -22
- {aimodelshare-0.1.12.dist-info → aimodelshare-0.1.64.dist-info}/WHEEL +1 -1
- aimodelshare-0.1.64.dist-info/licenses/LICENSE +5 -0
- {aimodelshare-0.1.12.dist-info → aimodelshare-0.1.64.dist-info}/top_level.txt +0 -1
- aimodelshare-0.1.12.dist-info/LICENSE +0 -22
- aimodelshare-0.1.12.dist-info/METADATA +0 -68
- tests/__init__.py +0 -0
- tests/test_aimsonnx.py +0 -135
- tests/test_playground.py +0 -721
aimodelshare/__init__.py
CHANGED
|
@@ -1,18 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
from .data_sharing.download_data import download_data, import_quickstart_data
|
|
4
|
-
from .reproducibility import export_reproducibility_env, import_reproducibility_env
|
|
1
|
+
"""
|
|
2
|
+
Top-level aimodelshare package initializer.
|
|
5
3
|
|
|
4
|
+
Refactored to:
|
|
5
|
+
- Avoid eager importing of heavy optional dependencies (networkx, torch, tensorflow, etc.)
|
|
6
|
+
- Allow lightweight submodules (e.g. aimodelshare.moral_compass) to work in minimal environments.
|
|
7
|
+
- Preserve backward compatibility where possible without forcing heavy installs.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from importlib import import_module
|
|
11
|
+
import warnings
|
|
6
12
|
|
|
7
13
|
__all__ = [
|
|
8
|
-
#
|
|
9
|
-
ModelPlayground,
|
|
10
|
-
Competition,
|
|
11
|
-
Data,
|
|
12
|
-
Experiment,
|
|
13
|
-
# Preprocessor
|
|
14
|
-
upload_preprocessor,
|
|
15
|
-
import_preprocessor,
|
|
16
|
-
export_preprocessor,
|
|
17
|
-
download_data
|
|
14
|
+
# Heavy/high-level objects (added only if imported successfully)
|
|
15
|
+
"ModelPlayground",
|
|
16
|
+
"Competition",
|
|
17
|
+
"Data",
|
|
18
|
+
"Experiment",
|
|
19
|
+
# Preprocessor helpers (optional)
|
|
20
|
+
"upload_preprocessor",
|
|
21
|
+
"import_preprocessor",
|
|
22
|
+
"export_preprocessor",
|
|
23
|
+
"download_data",
|
|
24
|
+
# Moral Compass client (lightweight)
|
|
25
|
+
"MoralcompassApiClient",
|
|
26
|
+
"MoralcompassTableMeta",
|
|
27
|
+
"MoralcompassUserStats",
|
|
28
|
+
"ApiClientError",
|
|
29
|
+
"NotFoundError",
|
|
30
|
+
"ServerError",
|
|
31
|
+
"get_api_base_url",
|
|
18
32
|
]
|
|
33
|
+
|
|
34
|
+
def _safe_import(module_name, symbols, remove_if_missing=True):
|
|
35
|
+
"""
|
|
36
|
+
Attempt to import given symbols from module_name.
|
|
37
|
+
On failure, emit a warning and optionally remove them from __all__.
|
|
38
|
+
"""
|
|
39
|
+
try:
|
|
40
|
+
mod = import_module(module_name)
|
|
41
|
+
for sym in symbols:
|
|
42
|
+
try:
|
|
43
|
+
globals()[sym] = getattr(mod, sym)
|
|
44
|
+
except AttributeError:
|
|
45
|
+
warnings.warn(
|
|
46
|
+
f"aimodelshare: symbol '{sym}' not found in module '{module_name}'."
|
|
47
|
+
)
|
|
48
|
+
if remove_if_missing and sym in __all__:
|
|
49
|
+
__all__.remove(sym)
|
|
50
|
+
except Exception as exc:
|
|
51
|
+
warnings.warn(
|
|
52
|
+
f"aimodelshare: optional module '{module_name}' not loaded ({exc}). "
|
|
53
|
+
"Lightweight submodules remain usable."
|
|
54
|
+
)
|
|
55
|
+
if remove_if_missing:
|
|
56
|
+
for sym in symbols:
|
|
57
|
+
if sym in __all__ and sym not in globals():
|
|
58
|
+
__all__.remove(sym)
|
|
59
|
+
|
|
60
|
+
# Attempt optional imports (silently skip if deps missing)
|
|
61
|
+
_safe_import(
|
|
62
|
+
"aimodelshare.playground",
|
|
63
|
+
["ModelPlayground", "Competition", "Experiment", "Data"],
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
_safe_import(
|
|
67
|
+
"aimodelshare.preprocessormodules",
|
|
68
|
+
["export_preprocessor", "upload_preprocessor", "import_preprocessor"],
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
_safe_import(
|
|
72
|
+
"aimodelshare.data_sharing.download_data",
|
|
73
|
+
["download_data", "import_quickstart_data"], # import_quickstart_data not in __all__
|
|
74
|
+
remove_if_missing=True,
|
|
75
|
+
)
|
|
76
|
+
# If import_quickstart_data is missing, we don't expose it; if present we leave it accessible.
|
|
77
|
+
if "import_quickstart_data" not in globals():
|
|
78
|
+
# Ensure it's not accidentally in __all__
|
|
79
|
+
if "import_quickstart_data" in __all__:
|
|
80
|
+
__all__.remove("import_quickstart_data")
|
|
81
|
+
|
|
82
|
+
# Moral Compass submodule (expected always present in new branch)
|
|
83
|
+
_safe_import(
|
|
84
|
+
"aimodelshare.moral_compass",
|
|
85
|
+
[
|
|
86
|
+
"MoralcompassApiClient",
|
|
87
|
+
"MoralcompassTableMeta",
|
|
88
|
+
"MoralcompassUserStats",
|
|
89
|
+
"ApiClientError",
|
|
90
|
+
"NotFoundError",
|
|
91
|
+
"ServerError",
|
|
92
|
+
"get_api_base_url",
|
|
93
|
+
],
|
|
94
|
+
remove_if_missing=False, # If this fails, keep names so import errors surface clearly later
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Ensure __all__ only contains names actually available (except intentional exposure for debug)
|
|
98
|
+
__all__ = [name for name in __all__ if name in globals()]
|