aimodelshare 0.3.7__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.
- aimodelshare/README.md +26 -0
- aimodelshare/__init__.py +100 -0
- aimodelshare/aimsonnx.py +2381 -0
- aimodelshare/api.py +836 -0
- aimodelshare/auth.py +163 -0
- aimodelshare/aws.py +511 -0
- aimodelshare/aws_client.py +173 -0
- aimodelshare/base_image.py +154 -0
- aimodelshare/bucketpolicy.py +106 -0
- aimodelshare/color_mappings/color_mapping_keras.csv +121 -0
- aimodelshare/color_mappings/color_mapping_pytorch.csv +117 -0
- aimodelshare/containerisation.py +244 -0
- aimodelshare/containerization.py +712 -0
- aimodelshare/containerization_templates/Dockerfile.txt +8 -0
- aimodelshare/containerization_templates/Dockerfile_PySpark.txt +23 -0
- aimodelshare/containerization_templates/buildspec.txt +14 -0
- aimodelshare/containerization_templates/lambda_function.txt +40 -0
- aimodelshare/custom_approach/__init__.py +1 -0
- aimodelshare/custom_approach/lambda_function.py +17 -0
- aimodelshare/custom_eval_metrics.py +103 -0
- aimodelshare/data_sharing/__init__.py +0 -0
- aimodelshare/data_sharing/data_sharing_templates/Dockerfile.txt +3 -0
- aimodelshare/data_sharing/data_sharing_templates/__init__.py +1 -0
- aimodelshare/data_sharing/data_sharing_templates/buildspec.txt +15 -0
- aimodelshare/data_sharing/data_sharing_templates/codebuild_policies.txt +129 -0
- aimodelshare/data_sharing/data_sharing_templates/codebuild_trust_relationship.txt +12 -0
- aimodelshare/data_sharing/download_data.py +620 -0
- aimodelshare/data_sharing/share_data.py +373 -0
- aimodelshare/data_sharing/utils.py +8 -0
- aimodelshare/deploy_custom_lambda.py +246 -0
- aimodelshare/documentation/Makefile +20 -0
- aimodelshare/documentation/karma_sphinx_theme/__init__.py +28 -0
- aimodelshare/documentation/karma_sphinx_theme/_version.py +2 -0
- aimodelshare/documentation/karma_sphinx_theme/breadcrumbs.html +70 -0
- aimodelshare/documentation/karma_sphinx_theme/layout.html +172 -0
- aimodelshare/documentation/karma_sphinx_theme/search.html +50 -0
- aimodelshare/documentation/karma_sphinx_theme/searchbox.html +14 -0
- aimodelshare/documentation/karma_sphinx_theme/static/css/custom.css +2 -0
- aimodelshare/documentation/karma_sphinx_theme/static/css/custom.css.map +1 -0
- aimodelshare/documentation/karma_sphinx_theme/static/css/theme.css +2751 -0
- aimodelshare/documentation/karma_sphinx_theme/static/css/theme.css.map +1 -0
- aimodelshare/documentation/karma_sphinx_theme/static/css/theme.min.css +2 -0
- aimodelshare/documentation/karma_sphinx_theme/static/css/theme.min.css.map +1 -0
- aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.eot +0 -0
- aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.svg +32 -0
- aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.ttf +0 -0
- aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.woff +0 -0
- aimodelshare/documentation/karma_sphinx_theme/static/font/fontello.woff2 +0 -0
- aimodelshare/documentation/karma_sphinx_theme/static/js/theme.js +68 -0
- aimodelshare/documentation/karma_sphinx_theme/theme.conf +9 -0
- aimodelshare/documentation/make.bat +35 -0
- aimodelshare/documentation/requirements.txt +2 -0
- aimodelshare/documentation/source/about.rst +18 -0
- aimodelshare/documentation/source/advanced_features.rst +137 -0
- aimodelshare/documentation/source/competition.rst +218 -0
- aimodelshare/documentation/source/conf.py +58 -0
- aimodelshare/documentation/source/create_credentials.rst +86 -0
- aimodelshare/documentation/source/example_notebooks.rst +132 -0
- aimodelshare/documentation/source/functions.rst +151 -0
- aimodelshare/documentation/source/gettingstarted.rst +390 -0
- aimodelshare/documentation/source/images/creds1.png +0 -0
- aimodelshare/documentation/source/images/creds2.png +0 -0
- aimodelshare/documentation/source/images/creds3.png +0 -0
- aimodelshare/documentation/source/images/creds4.png +0 -0
- aimodelshare/documentation/source/images/creds5.png +0 -0
- aimodelshare/documentation/source/images/creds_file_example.png +0 -0
- aimodelshare/documentation/source/images/predict_tab.png +0 -0
- aimodelshare/documentation/source/index.rst +110 -0
- aimodelshare/documentation/source/modelplayground.rst +132 -0
- aimodelshare/exceptions.py +11 -0
- aimodelshare/generatemodelapi.py +1270 -0
- aimodelshare/iam/codebuild_policy.txt +129 -0
- aimodelshare/iam/codebuild_trust_relationship.txt +12 -0
- aimodelshare/iam/lambda_policy.txt +15 -0
- aimodelshare/iam/lambda_trust_relationship.txt +12 -0
- aimodelshare/json_templates/__init__.py +1 -0
- aimodelshare/json_templates/api_json.txt +155 -0
- aimodelshare/json_templates/auth/policy.txt +1 -0
- aimodelshare/json_templates/auth/role.txt +1 -0
- aimodelshare/json_templates/eval/policy.txt +1 -0
- aimodelshare/json_templates/eval/role.txt +1 -0
- aimodelshare/json_templates/function/policy.txt +1 -0
- aimodelshare/json_templates/function/role.txt +1 -0
- aimodelshare/json_templates/integration_response.txt +5 -0
- aimodelshare/json_templates/lambda_policy_1.txt +15 -0
- aimodelshare/json_templates/lambda_policy_2.txt +8 -0
- aimodelshare/json_templates/lambda_role_1.txt +12 -0
- aimodelshare/json_templates/lambda_role_2.txt +16 -0
- aimodelshare/leaderboard.py +174 -0
- aimodelshare/main/1.txt +132 -0
- aimodelshare/main/1B.txt +112 -0
- aimodelshare/main/2.txt +153 -0
- aimodelshare/main/3.txt +134 -0
- aimodelshare/main/4.txt +128 -0
- aimodelshare/main/5.txt +109 -0
- aimodelshare/main/6.txt +105 -0
- aimodelshare/main/7.txt +144 -0
- aimodelshare/main/8.txt +142 -0
- aimodelshare/main/__init__.py +1 -0
- aimodelshare/main/authorization.txt +275 -0
- aimodelshare/main/eval_classification.txt +79 -0
- aimodelshare/main/eval_lambda.txt +1709 -0
- aimodelshare/main/eval_regression.txt +80 -0
- aimodelshare/main/lambda_function.txt +8 -0
- aimodelshare/main/nst.txt +149 -0
- aimodelshare/model.py +1543 -0
- aimodelshare/modeluser.py +215 -0
- aimodelshare/moral_compass/README.md +408 -0
- aimodelshare/moral_compass/__init__.py +65 -0
- aimodelshare/moral_compass/_version.py +3 -0
- aimodelshare/moral_compass/api_client.py +601 -0
- aimodelshare/moral_compass/apps/__init__.py +69 -0
- aimodelshare/moral_compass/apps/ai_consequences.py +540 -0
- aimodelshare/moral_compass/apps/bias_detective.py +714 -0
- aimodelshare/moral_compass/apps/ethical_revelation.py +898 -0
- aimodelshare/moral_compass/apps/fairness_fixer.py +889 -0
- aimodelshare/moral_compass/apps/judge.py +888 -0
- aimodelshare/moral_compass/apps/justice_equity_upgrade.py +853 -0
- aimodelshare/moral_compass/apps/mc_integration_helpers.py +820 -0
- aimodelshare/moral_compass/apps/model_building_game.py +1104 -0
- aimodelshare/moral_compass/apps/model_building_game_beginner.py +687 -0
- aimodelshare/moral_compass/apps/moral_compass_challenge.py +858 -0
- aimodelshare/moral_compass/apps/session_auth.py +254 -0
- aimodelshare/moral_compass/apps/shared_activity_styles.css +349 -0
- aimodelshare/moral_compass/apps/tutorial.py +481 -0
- aimodelshare/moral_compass/apps/what_is_ai.py +853 -0
- aimodelshare/moral_compass/challenge.py +365 -0
- aimodelshare/moral_compass/config.py +187 -0
- aimodelshare/placeholders/model.onnx +0 -0
- aimodelshare/placeholders/preprocessor.zip +0 -0
- aimodelshare/playground.py +1968 -0
- aimodelshare/postprocessormodules.py +157 -0
- aimodelshare/preprocessormodules.py +373 -0
- aimodelshare/pyspark/1.txt +195 -0
- aimodelshare/pyspark/1B.txt +181 -0
- aimodelshare/pyspark/2.txt +220 -0
- aimodelshare/pyspark/3.txt +204 -0
- aimodelshare/pyspark/4.txt +187 -0
- aimodelshare/pyspark/5.txt +178 -0
- aimodelshare/pyspark/6.txt +174 -0
- aimodelshare/pyspark/7.txt +211 -0
- aimodelshare/pyspark/8.txt +206 -0
- aimodelshare/pyspark/__init__.py +1 -0
- aimodelshare/pyspark/authorization.txt +258 -0
- aimodelshare/pyspark/eval_classification.txt +79 -0
- aimodelshare/pyspark/eval_lambda.txt +1441 -0
- aimodelshare/pyspark/eval_regression.txt +80 -0
- aimodelshare/pyspark/lambda_function.txt +8 -0
- aimodelshare/pyspark/nst.txt +213 -0
- aimodelshare/python/my_preprocessor.py +58 -0
- aimodelshare/readme.md +26 -0
- aimodelshare/reproducibility.py +181 -0
- aimodelshare/sam/Dockerfile.txt +8 -0
- aimodelshare/sam/Dockerfile_PySpark.txt +24 -0
- aimodelshare/sam/__init__.py +1 -0
- aimodelshare/sam/buildspec.txt +11 -0
- aimodelshare/sam/codebuild_policies.txt +129 -0
- aimodelshare/sam/codebuild_trust_relationship.txt +12 -0
- aimodelshare/sam/codepipeline_policies.txt +173 -0
- aimodelshare/sam/codepipeline_trust_relationship.txt +12 -0
- aimodelshare/sam/spark-class.txt +2 -0
- aimodelshare/sam/template.txt +54 -0
- aimodelshare/tools.py +103 -0
- aimodelshare/utils/__init__.py +78 -0
- aimodelshare/utils/optional_deps.py +38 -0
- aimodelshare/utils.py +57 -0
- aimodelshare-0.3.7.dist-info/METADATA +298 -0
- aimodelshare-0.3.7.dist-info/RECORD +171 -0
- aimodelshare-0.3.7.dist-info/WHEEL +5 -0
- aimodelshare-0.3.7.dist-info/licenses/LICENSE +5 -0
- aimodelshare-0.3.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Model Playground Class
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
Deployed models receive an individual Model Playground. Each Model Playground uses a personal REST API to provide a fully functional prediction dashboard that allows end-users to input text, tabular, or image data and receive live predictions.
|
|
5
|
+
|
|
6
|
+
Moreover, users can build on Model Playgrounds by:
|
|
7
|
+
|
|
8
|
+
1) Creating ML model competitions
|
|
9
|
+
2) Uploading Jupyter notebooks to share code
|
|
10
|
+
3) Sharing model architectures, and
|
|
11
|
+
4) Sharing data... with all shared artifacts automatically creating a data science user portfolio.
|
|
12
|
+
|
|
13
|
+
.. _deploy:
|
|
14
|
+
|
|
15
|
+
deploy
|
|
16
|
+
------
|
|
17
|
+
|
|
18
|
+
Launches a live prediction REST API for deploying ML models using model parameters and user credentials.
|
|
19
|
+
|
|
20
|
+
.. py:function:: ModelPlayground.deploy(model_filepath, preprocessor_filepath, y_train, example_data=None, custom_libraries = "FALSE", image="", reproducibility_env_filepath=None, memory=None, timeout=None)
|
|
21
|
+
|
|
22
|
+
:param model_filepath: Absolute path to model file. \
|
|
23
|
+
.onnx is the only accepted model file extension.
|
|
24
|
+
"example_model.onnx" filename for file in directory.
|
|
25
|
+
"/User/xyz/model/example_model.onnx" absolute path to model file from local directory
|
|
26
|
+
:type model_filepath: string
|
|
27
|
+
:param preprocessor_filepath: absolute path to preprocessor file. [REQUIRED] to be set by the user. Should be: "./preprocessor.zip". searches for an exported zip preprocessor file in the current directory. File is generated using export_preprocessor function from the AI Modelshare library
|
|
28
|
+
:type preprocessor_filepath: string
|
|
29
|
+
:param y_train: training labels for classification models. [REQUIRED] for classification type models
|
|
30
|
+
:type y_train: pandas dataframe of one hot encoded y train data for classification, or list of values for regression
|
|
31
|
+
:param custom_libraries: "TRUE" if user wants to load custom Python libraries to their prediction runtime. "FALSE" if user wishes to use AI Model Share base libraries including latest versions of most common ML libs.
|
|
32
|
+
:type custom_libraries: string
|
|
33
|
+
:param example_data: Tabular data - pandas DataFrame in same structure expected by preprocessor function. Other data types - absolute path to folder containing example data (first five files with relevant file extensions will be accepted). REQUIRED for tabular data
|
|
34
|
+
:type example_data: pandas DataFrame (for tabular & text data) OR filepath as string (image, audio, video data)
|
|
35
|
+
:param reproducibility_env_filepath: [OPTIONAL] to be set by the user- absolute path to environment environment json file. Example: "./reproducibility.json". File is generated using export_reproducibility_env function from the AI Modelshare library
|
|
36
|
+
:type example_data: String
|
|
37
|
+
:param memory: The amount of memory (in megabytes) to be allocated to the lambda function (default = 1024).
|
|
38
|
+
:type memory: Int
|
|
39
|
+
:param timeout: Number of seconds before the lambda times out (default = 30).
|
|
40
|
+
:type timeout: Int
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
:return: Prints statements with generated live prediction API details
|
|
44
|
+
also prints steps to update the model submissions by the user/team
|
|
45
|
+
|
|
46
|
+
Example ::
|
|
47
|
+
|
|
48
|
+
from aimodelshare import ModelPlayground
|
|
49
|
+
|
|
50
|
+
#Instantiate ModelPlayground() Class as placeholder
|
|
51
|
+
myplayground=ModelPlayground(model_type="image", classification=True, private=True)
|
|
52
|
+
|
|
53
|
+
# Create Model Playground (generates live rest api and web-app for your model/preprocessor)
|
|
54
|
+
myplayground.deploy(model_filepath = "model.onnx", preprocessor_filepath = "preprocessor.zip", y_train_labels, exampledata)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Example ::
|
|
58
|
+
|
|
59
|
+
# To instantiate a Model Playground that already exists:
|
|
60
|
+
|
|
61
|
+
myplayground=ModelPlayground(playground_url = "https://exampleapiurl.execute-api.us-east-1.amazonaws.com/prod/m")
|
|
62
|
+
|
|
63
|
+
#You can find your Model Playground url under the "Programmatic" sub tab of the "Predict" page
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
.. _create_competition:
|
|
67
|
+
|
|
68
|
+
create_competition
|
|
69
|
+
------------------
|
|
70
|
+
|
|
71
|
+
Creates a model competition for a deployed prediction REST API
|
|
72
|
+
|
|
73
|
+
.. py:function:: ModelPlayground.create_competition(data_directory, y_test, eval_metric_filepath=None, email_list = [], public=False)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
:param y_test: y values for test data used to generate metrics from predicted values from X test data submitted via the submit_model() function. [REQUIRED] to generate eval metrics in competition leaderboard
|
|
77
|
+
:type y_test: list
|
|
78
|
+
:param data_directory: Path to folder storing training data and test data (excluding Y test data)
|
|
79
|
+
:type data_directory: string
|
|
80
|
+
:param eval_metric_filepath: Filepath pointing to a zipfile containing custom evaluation functions exported with export_eval_metric()
|
|
81
|
+
:type eval_metric_filepath: string
|
|
82
|
+
:param email_list: [OPTIONAL] list of comma separated emails for users who are allowed to submit models to competition.
|
|
83
|
+
:type email_list: List of strings
|
|
84
|
+
:param public: [REQUIRED] True/false. Defaults to False. If True, competition is public and ANY AIModelShare user can submit models. Use with caution because one model and one preprocessor file will be be saved to your AWS S3 folder for each model submission.
|
|
85
|
+
:type public: Boolean
|
|
86
|
+
|
|
87
|
+
:return: Information about how to submit models to competition
|
|
88
|
+
|
|
89
|
+
Example ::
|
|
90
|
+
|
|
91
|
+
# Create Competition
|
|
92
|
+
# Note -- Make competition public (allow any AI Model Share user to submit models)
|
|
93
|
+
# .... by excluding the email_list argument and including the 'public=True' argument
|
|
94
|
+
myplayground.create_competition(data_directory='my_competition_data_folder',
|
|
95
|
+
y_test = y_test_labels,
|
|
96
|
+
email_list=emaillist)
|
|
97
|
+
public=True)
|
|
98
|
+
|
|
99
|
+
.. _update_runtime_model:
|
|
100
|
+
|
|
101
|
+
update_runtime_model
|
|
102
|
+
--------------------
|
|
103
|
+
|
|
104
|
+
Updates the prediction API behind the Model Playground with a new model from the leaderboard and verifies Model Playground performance metrics.
|
|
105
|
+
|
|
106
|
+
.. py:function:: update_runtime_model(model_version=None)
|
|
107
|
+
|
|
108
|
+
:param model_version: model version number from competition leaderboard
|
|
109
|
+
:type model_version: integer
|
|
110
|
+
|
|
111
|
+
:return: Success message when the model and preprocessor are updated successfully.
|
|
112
|
+
|
|
113
|
+
Example ::
|
|
114
|
+
|
|
115
|
+
myplayground.update_runtime_model(model_version=1)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
delete_deployment
|
|
119
|
+
-----------------
|
|
120
|
+
|
|
121
|
+
Delete all components of a Model Playground, including: AWS s3 bucket & contents, attached competitions, prediction REST API, and interactive Model Playground web dashboard.
|
|
122
|
+
|
|
123
|
+
.. py:function:: ModelPlayground.delete_deployment(playground_url=None)
|
|
124
|
+
|
|
125
|
+
:param playground_url: API URL that the user wishes to delete. WARNING: User must own an API in order to delete it.
|
|
126
|
+
:type playground_url: string
|
|
127
|
+
|
|
128
|
+
:return: Success message when deployment is deleted.
|
|
129
|
+
|
|
130
|
+
Example ::
|
|
131
|
+
|
|
132
|
+
myplayground.delete_deployment()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class AuthorizationError(Exception):
|
|
2
|
+
def __init__(self, error):
|
|
3
|
+
Exception.__init__(self, error)
|
|
4
|
+
|
|
5
|
+
class AWSAccessError(Exception):
|
|
6
|
+
def __init__(self, error):
|
|
7
|
+
Exception.__init__(self, error)
|
|
8
|
+
|
|
9
|
+
class AWSUploadError(Exception):
|
|
10
|
+
def __init__(self, error):
|
|
11
|
+
Exception.__init__(self, error)
|