sagemaker-core 1.0.62__py3-none-any.whl → 2.1.1__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.
Files changed (362) hide show
  1. sagemaker/core/__init__.py +16 -0
  2. sagemaker/core/_studio.py +116 -0
  3. sagemaker/core/_version.py +11 -0
  4. sagemaker/core/accept_types.py +131 -0
  5. sagemaker/core/analytics.py +744 -0
  6. sagemaker/core/apiutils/__init__.py +13 -0
  7. sagemaker/core/apiutils/_base_types.py +228 -0
  8. sagemaker/core/apiutils/_boto_functions.py +130 -0
  9. sagemaker/core/apiutils/_utils.py +34 -0
  10. sagemaker/core/base_deserializers.py +35 -0
  11. sagemaker/core/base_serializers.py +35 -0
  12. sagemaker/core/clarify/__init__.py +2898 -0
  13. sagemaker/core/collection.py +467 -0
  14. sagemaker/core/common_utils.py +2281 -0
  15. sagemaker/core/compute_resource_requirements/__init__.py +18 -0
  16. sagemaker/core/compute_resource_requirements/resource_requirements.py +94 -0
  17. sagemaker/core/config/__init__.py +181 -0
  18. sagemaker/core/config/config.py +238 -0
  19. sagemaker/core/config/config_manager.py +595 -0
  20. sagemaker/core/config/config_schema.py +1220 -0
  21. sagemaker/core/config/config_utils.py +297 -0
  22. {sagemaker_core/main → sagemaker/core}/config_schema.py +408 -3
  23. sagemaker/core/constants.py +73 -0
  24. sagemaker/core/content_types.py +137 -0
  25. sagemaker/core/debugger/__init__.py +39 -0
  26. sagemaker/core/debugger/debugger.py +945 -0
  27. sagemaker/core/debugger/framework_profile.py +292 -0
  28. sagemaker/core/debugger/metrics_config.py +468 -0
  29. sagemaker/core/debugger/profiler.py +42 -0
  30. sagemaker/core/debugger/profiler_config.py +190 -0
  31. sagemaker/core/debugger/profiler_constants.py +40 -0
  32. sagemaker/core/debugger/utils.py +148 -0
  33. sagemaker/core/deprecations.py +254 -0
  34. sagemaker/core/deserializers/__init__.py +10 -0
  35. sagemaker/core/deserializers/base.py +424 -0
  36. sagemaker/core/deserializers/implementations.py +157 -0
  37. sagemaker/core/drift_check_baselines.py +106 -0
  38. sagemaker/core/enums.py +51 -0
  39. sagemaker/core/environment_variables.py +101 -0
  40. sagemaker/core/exceptions.py +108 -0
  41. sagemaker/core/experiments/__init__.py +53 -0
  42. sagemaker/core/experiments/_api_types.py +251 -0
  43. sagemaker/core/experiments/_environment.py +124 -0
  44. sagemaker/core/experiments/_helper.py +294 -0
  45. sagemaker/core/experiments/_metrics.py +333 -0
  46. sagemaker/core/experiments/_run_context.py +58 -0
  47. sagemaker/core/experiments/_utils.py +216 -0
  48. sagemaker/core/experiments/experiment.py +244 -0
  49. sagemaker/core/experiments/run.py +970 -0
  50. sagemaker/core/experiments/trial.py +296 -0
  51. sagemaker/core/experiments/trial_component.py +387 -0
  52. sagemaker/core/explainer/__init__.py +24 -0
  53. sagemaker/core/explainer/clarify_explainer_config.py +298 -0
  54. sagemaker/core/explainer/explainer_config.py +44 -0
  55. sagemaker/core/fw_utils.py +1176 -0
  56. sagemaker/core/git_utils.py +349 -0
  57. sagemaker/core/helper/pipeline_variable.py +82 -0
  58. sagemaker/core/helper/session_helper.py +2965 -0
  59. sagemaker/core/huggingface/__init__.py +29 -0
  60. sagemaker/core/huggingface/llm_utils.py +150 -0
  61. sagemaker/core/huggingface/processing.py +139 -0
  62. sagemaker/core/huggingface/training_compiler/config.py +167 -0
  63. sagemaker/core/hyperparameters.py +172 -0
  64. sagemaker/core/image_retriever/__init__.py +3 -0
  65. sagemaker/core/image_retriever/image_retriever.py +640 -0
  66. sagemaker/core/image_retriever/image_retriever_utils.py +511 -0
  67. sagemaker/core/image_retriever/test.py +7 -0
  68. sagemaker/core/image_uri_config/__init__.py +13 -0
  69. sagemaker/core/image_uri_config/autogluon.json +1335 -0
  70. sagemaker/core/image_uri_config/blazingtext.json +50 -0
  71. sagemaker/core/image_uri_config/chainer.json +104 -0
  72. sagemaker/core/image_uri_config/clarify.json +39 -0
  73. sagemaker/core/image_uri_config/coach-mxnet.json +70 -0
  74. sagemaker/core/image_uri_config/coach-tensorflow.json +186 -0
  75. sagemaker/core/image_uri_config/data-wrangler.json +91 -0
  76. sagemaker/core/image_uri_config/debugger.json +34 -0
  77. sagemaker/core/image_uri_config/detailed-profiler.json +18 -0
  78. sagemaker/core/image_uri_config/djl-deepspeed.json +385 -0
  79. sagemaker/core/image_uri_config/djl-fastertransformer.json +167 -0
  80. sagemaker/core/image_uri_config/djl-lmi.json +136 -0
  81. sagemaker/core/image_uri_config/djl-neuronx.json +258 -0
  82. sagemaker/core/image_uri_config/djl-tensorrtllm.json +262 -0
  83. sagemaker/core/image_uri_config/factorization-machines.json +50 -0
  84. sagemaker/core/image_uri_config/forecasting-deepar.json +50 -0
  85. sagemaker/core/image_uri_config/huggingface-llm-neuronx.json +660 -0
  86. sagemaker/core/image_uri_config/huggingface-llm.json +1158 -0
  87. sagemaker/core/image_uri_config/huggingface-neuron.json +52 -0
  88. sagemaker/core/image_uri_config/huggingface-neuronx.json +510 -0
  89. sagemaker/core/image_uri_config/huggingface-tei-cpu.json +298 -0
  90. sagemaker/core/image_uri_config/huggingface-tei.json +298 -0
  91. sagemaker/core/image_uri_config/huggingface-training-compiler.json +195 -0
  92. sagemaker/core/image_uri_config/huggingface.json +2138 -0
  93. sagemaker/core/image_uri_config/hyperpod-recipes-neuron.json +52 -0
  94. sagemaker/core/image_uri_config/image-classification-neo.json +43 -0
  95. sagemaker/core/image_uri_config/image-classification.json +50 -0
  96. sagemaker/core/image_uri_config/inferentia-mxnet.json +88 -0
  97. sagemaker/core/image_uri_config/inferentia-pytorch.json +127 -0
  98. sagemaker/core/image_uri_config/inferentia-tensorflow.json +88 -0
  99. sagemaker/core/image_uri_config/instance_gpu_info.json +782 -0
  100. sagemaker/core/image_uri_config/ipinsights.json +50 -0
  101. sagemaker/core/image_uri_config/kmeans.json +50 -0
  102. sagemaker/core/image_uri_config/knn.json +50 -0
  103. sagemaker/core/image_uri_config/lda.json +26 -0
  104. sagemaker/core/image_uri_config/linear-learner.json +50 -0
  105. sagemaker/core/image_uri_config/model-monitor.json +42 -0
  106. sagemaker/core/image_uri_config/mxnet.json +1154 -0
  107. sagemaker/core/image_uri_config/neo-mxnet.json +64 -0
  108. sagemaker/core/image_uri_config/neo-pytorch.json +341 -0
  109. sagemaker/core/image_uri_config/neo-tensorflow.json +109 -0
  110. sagemaker/core/image_uri_config/ntm.json +50 -0
  111. sagemaker/core/image_uri_config/object-detection.json +50 -0
  112. sagemaker/core/image_uri_config/object2vec.json +50 -0
  113. sagemaker/core/image_uri_config/pca.json +50 -0
  114. sagemaker/core/image_uri_config/pytorch-neuron.json +43 -0
  115. sagemaker/core/image_uri_config/pytorch-smp.json +218 -0
  116. sagemaker/core/image_uri_config/pytorch-training-compiler.json +80 -0
  117. sagemaker/core/image_uri_config/pytorch.json +3101 -0
  118. sagemaker/core/image_uri_config/randomcutforest.json +50 -0
  119. sagemaker/core/image_uri_config/ray-pytorch.json +46 -0
  120. sagemaker/core/image_uri_config/ray-tensorflow.json +194 -0
  121. sagemaker/core/image_uri_config/sagemaker-base-python.json +46 -0
  122. sagemaker/core/image_uri_config/sagemaker-distribution.json +37 -0
  123. sagemaker/core/image_uri_config/sagemaker-geospatial.json +13 -0
  124. sagemaker/core/image_uri_config/sagemaker-tritonserver.json +212 -0
  125. sagemaker/core/image_uri_config/semantic-segmentation.json +50 -0
  126. sagemaker/core/image_uri_config/seq2seq.json +50 -0
  127. sagemaker/core/image_uri_config/sklearn.json +446 -0
  128. sagemaker/core/image_uri_config/spark.json +280 -0
  129. sagemaker/core/image_uri_config/sparkml-serving.json +97 -0
  130. sagemaker/core/image_uri_config/stabilityai.json +53 -0
  131. sagemaker/core/image_uri_config/tensorflow.json +5086 -0
  132. sagemaker/core/image_uri_config/vw.json +25 -0
  133. sagemaker/core/image_uri_config/xgboost-neo.json +43 -0
  134. sagemaker/core/image_uri_config/xgboost.json +888 -0
  135. sagemaker/core/image_uris.py +810 -0
  136. sagemaker/core/inference_config.py +144 -0
  137. sagemaker/core/inference_recommender/__init__.py +18 -0
  138. sagemaker/core/inference_recommender/inference_recommender_mixin.py +622 -0
  139. sagemaker/core/inputs.py +366 -0
  140. sagemaker/core/instance_group.py +61 -0
  141. sagemaker/core/instance_types.py +164 -0
  142. sagemaker/core/instance_types_gpu_info.py +43 -0
  143. sagemaker/core/interactive_apps/__init__.py +41 -0
  144. sagemaker/core/interactive_apps/base_interactive_app.py +204 -0
  145. sagemaker/core/interactive_apps/detail_profiler_app.py +139 -0
  146. sagemaker/core/interactive_apps/tensorboard.py +149 -0
  147. sagemaker/core/iterators.py +186 -0
  148. sagemaker/core/job.py +380 -0
  149. sagemaker/core/jumpstart/__init__.py +156 -0
  150. sagemaker/core/jumpstart/accessors.py +390 -0
  151. sagemaker/core/jumpstart/artifacts/__init__.py +69 -0
  152. sagemaker/core/jumpstart/artifacts/environment_variables.py +252 -0
  153. sagemaker/core/jumpstart/artifacts/hyperparameters.py +120 -0
  154. sagemaker/core/jumpstart/artifacts/image_uris.py +139 -0
  155. sagemaker/core/jumpstart/artifacts/incremental_training.py +87 -0
  156. sagemaker/core/jumpstart/artifacts/instance_types.py +223 -0
  157. sagemaker/core/jumpstart/artifacts/kwargs.py +289 -0
  158. sagemaker/core/jumpstart/artifacts/metric_definitions.py +117 -0
  159. sagemaker/core/jumpstart/artifacts/model_packages.py +202 -0
  160. sagemaker/core/jumpstart/artifacts/model_uris.py +252 -0
  161. sagemaker/core/jumpstart/artifacts/payloads.py +96 -0
  162. sagemaker/core/jumpstart/artifacts/predictors.py +540 -0
  163. sagemaker/core/jumpstart/artifacts/resource_names.py +86 -0
  164. sagemaker/core/jumpstart/artifacts/resource_requirements.py +162 -0
  165. sagemaker/core/jumpstart/artifacts/script_uris.py +172 -0
  166. sagemaker/core/jumpstart/cache.py +663 -0
  167. sagemaker/core/jumpstart/configs.py +50 -0
  168. sagemaker/core/jumpstart/constants.py +198 -0
  169. sagemaker/core/jumpstart/deserializers.py +81 -0
  170. sagemaker/core/jumpstart/document.py +76 -0
  171. sagemaker/core/jumpstart/enums.py +168 -0
  172. sagemaker/core/jumpstart/exceptions.py +236 -0
  173. sagemaker/core/jumpstart/factory/utils.py +833 -0
  174. sagemaker/core/jumpstart/filters.py +597 -0
  175. sagemaker/core/jumpstart/hub/constants.py +16 -0
  176. sagemaker/core/jumpstart/hub/hub.py +291 -0
  177. sagemaker/core/jumpstart/hub/interfaces.py +936 -0
  178. sagemaker/core/jumpstart/hub/parser_utils.py +70 -0
  179. sagemaker/core/jumpstart/hub/parsers.py +288 -0
  180. sagemaker/core/jumpstart/hub/types.py +35 -0
  181. sagemaker/core/jumpstart/hub/utils.py +260 -0
  182. sagemaker/core/jumpstart/models.py +499 -0
  183. sagemaker/core/jumpstart/notebook_utils.py +575 -0
  184. sagemaker/core/jumpstart/parameters.py +20 -0
  185. sagemaker/core/jumpstart/payload_utils.py +239 -0
  186. sagemaker/core/jumpstart/region_config.json +163 -0
  187. sagemaker/core/jumpstart/search.py +171 -0
  188. sagemaker/core/jumpstart/serializers.py +81 -0
  189. sagemaker/core/jumpstart/session_utils.py +234 -0
  190. sagemaker/core/jumpstart/types.py +3044 -0
  191. sagemaker/core/jumpstart/utils.py +1731 -0
  192. sagemaker/core/jumpstart/validators.py +257 -0
  193. sagemaker/core/lambda_helper.py +312 -0
  194. sagemaker/core/lineage/__init__.py +42 -0
  195. sagemaker/core/lineage/_api_types.py +239 -0
  196. sagemaker/core/lineage/_utils.py +49 -0
  197. sagemaker/core/lineage/action.py +345 -0
  198. sagemaker/core/lineage/artifact.py +646 -0
  199. sagemaker/core/lineage/association.py +190 -0
  200. sagemaker/core/lineage/context.py +505 -0
  201. sagemaker/core/lineage/lineage_trial_component.py +191 -0
  202. sagemaker/core/lineage/query.py +732 -0
  203. sagemaker/core/lineage/visualizer.py +346 -0
  204. sagemaker/core/local/__init__.py +18 -0
  205. sagemaker/core/local/data.py +413 -0
  206. sagemaker/core/local/entities.py +678 -0
  207. sagemaker/core/local/exceptions.py +17 -0
  208. sagemaker/core/local/image.py +1243 -0
  209. sagemaker/core/local/local_session.py +739 -0
  210. sagemaker/core/local/utils.py +245 -0
  211. sagemaker/core/logs.py +181 -0
  212. sagemaker/core/metadata_properties.py +56 -0
  213. sagemaker/core/metric_definitions.py +91 -0
  214. sagemaker/core/mlflow/__init__.py +38 -0
  215. sagemaker/core/mlflow/forward_sagemaker_metrics.py +44 -0
  216. sagemaker/core/model_card/__init__.py +26 -0
  217. sagemaker/core/model_life_cycle.py +51 -0
  218. sagemaker/core/model_metrics.py +160 -0
  219. sagemaker/core/model_monitor/__init__.py +66 -0
  220. sagemaker/core/model_monitor/clarify_model_monitoring.py +1495 -0
  221. sagemaker/core/model_monitor/cron_expression_generator.py +82 -0
  222. sagemaker/core/model_monitor/data_capture_config.py +115 -0
  223. sagemaker/core/model_monitor/data_quality_monitoring_config.py +66 -0
  224. sagemaker/core/model_monitor/dataset_format.py +102 -0
  225. sagemaker/core/model_monitor/model_monitoring.py +4266 -0
  226. sagemaker/core/model_monitor/monitoring_alert.py +76 -0
  227. sagemaker/core/model_monitor/monitoring_files.py +506 -0
  228. sagemaker/core/model_monitor/utils.py +793 -0
  229. sagemaker/core/model_registry.py +480 -0
  230. sagemaker/core/model_uris.py +97 -0
  231. sagemaker/core/modules/__init__.py +19 -0
  232. sagemaker/core/modules/configs.py +226 -0
  233. sagemaker/core/modules/constants.py +37 -0
  234. sagemaker/core/modules/distributed.py +182 -0
  235. sagemaker/core/modules/local_core/__init__.py +0 -0
  236. sagemaker/core/modules/local_core/local_container.py +605 -0
  237. sagemaker/core/modules/templates.py +83 -0
  238. sagemaker/core/modules/train/__init__.py +14 -0
  239. sagemaker/core/modules/train/container_drivers/__init__.py +14 -0
  240. sagemaker/core/modules/train/container_drivers/common/__init__.py +14 -0
  241. sagemaker/core/modules/train/container_drivers/common/utils.py +213 -0
  242. sagemaker/core/modules/train/container_drivers/distributed_drivers/__init__.py +14 -0
  243. sagemaker/core/modules/train/container_drivers/distributed_drivers/basic_script_driver.py +81 -0
  244. sagemaker/core/modules/train/container_drivers/distributed_drivers/mpi_driver.py +123 -0
  245. sagemaker/core/modules/train/container_drivers/distributed_drivers/mpi_utils.py +302 -0
  246. sagemaker/core/modules/train/container_drivers/distributed_drivers/torchrun_driver.py +129 -0
  247. sagemaker/core/modules/train/container_drivers/scripts/__init__.py +14 -0
  248. sagemaker/core/modules/train/container_drivers/scripts/environment.py +305 -0
  249. sagemaker/core/modules/train/sm_recipes/__init__.py +0 -0
  250. sagemaker/core/modules/train/sm_recipes/utils.py +330 -0
  251. sagemaker/core/modules/types.py +19 -0
  252. sagemaker/core/modules/utils.py +194 -0
  253. sagemaker/core/network.py +185 -0
  254. sagemaker/core/parameter.py +173 -0
  255. sagemaker/core/payloads.py +185 -0
  256. sagemaker/core/processing.py +1597 -0
  257. sagemaker/core/remote_function/__init__.py +19 -0
  258. sagemaker/core/remote_function/checkpoint_location.py +47 -0
  259. sagemaker/core/remote_function/client.py +1285 -0
  260. sagemaker/core/remote_function/core/__init__.py +0 -0
  261. sagemaker/core/remote_function/core/_custom_dispatch_table.py +72 -0
  262. sagemaker/core/remote_function/core/pipeline_variables.py +353 -0
  263. sagemaker/core/remote_function/core/serialization.py +422 -0
  264. sagemaker/core/remote_function/core/stored_function.py +226 -0
  265. sagemaker/core/remote_function/custom_file_filter.py +128 -0
  266. sagemaker/core/remote_function/errors.py +104 -0
  267. sagemaker/core/remote_function/invoke_function.py +172 -0
  268. sagemaker/core/remote_function/job.py +2140 -0
  269. sagemaker/core/remote_function/logging_config.py +38 -0
  270. sagemaker/core/remote_function/runtime_environment/__init__.py +14 -0
  271. sagemaker/core/remote_function/runtime_environment/bootstrap_runtime_environment.py +605 -0
  272. sagemaker/core/remote_function/runtime_environment/mpi_utils_remote.py +252 -0
  273. sagemaker/core/remote_function/runtime_environment/runtime_environment_manager.py +554 -0
  274. sagemaker/core/remote_function/runtime_environment/spark_app.py +18 -0
  275. sagemaker/core/remote_function/spark_config.py +149 -0
  276. sagemaker/core/resource_requirements.py +168 -0
  277. {sagemaker_core/main → sagemaker/core}/resources.py +19098 -10895
  278. sagemaker/core/s3/__init__.py +41 -0
  279. sagemaker/core/s3/client.py +367 -0
  280. sagemaker/core/s3/utils.py +175 -0
  281. sagemaker/core/script_uris.py +93 -0
  282. sagemaker/core/serializers/__init__.py +11 -0
  283. sagemaker/core/serializers/base.py +510 -0
  284. sagemaker/core/serializers/implementations.py +159 -0
  285. sagemaker/core/serializers/utils.py +223 -0
  286. sagemaker/core/serverless_inference_config.py +63 -0
  287. sagemaker/core/session_settings.py +55 -0
  288. sagemaker/core/shapes/__init__.py +3 -0
  289. sagemaker/core/shapes/model_card_shapes.py +159 -0
  290. {sagemaker_core/main → sagemaker/core/shapes}/shapes.py +5810 -1806
  291. sagemaker/core/spark/__init__.py +16 -0
  292. sagemaker/core/spark/defaults.py +16 -0
  293. sagemaker/core/spark/processing.py +1380 -0
  294. sagemaker/core/telemetry/__init__.py +23 -0
  295. sagemaker/core/telemetry/constants.py +84 -0
  296. sagemaker/core/telemetry/telemetry_logging.py +284 -0
  297. sagemaker/core/tools/__init__.py +1 -0
  298. {sagemaker_core → sagemaker/core}/tools/codegen.py +4 -4
  299. {sagemaker_core → sagemaker/core}/tools/constants.py +23 -15
  300. {sagemaker_core → sagemaker/core}/tools/data_extractor.py +1 -1
  301. {sagemaker_core → sagemaker/core}/tools/method.py +1 -1
  302. sagemaker/core/tools/model_card/generate_model_card_from_schema.py +562 -0
  303. {sagemaker_core → sagemaker/core}/tools/resources_codegen.py +165 -98
  304. {sagemaker_core → sagemaker/core}/tools/resources_extractor.py +5 -13
  305. {sagemaker_core → sagemaker/core}/tools/shapes_codegen.py +16 -17
  306. {sagemaker_core → sagemaker/core}/tools/shapes_extractor.py +29 -67
  307. {sagemaker_core → sagemaker/core}/tools/templates.py +39 -17
  308. sagemaker/core/training/__init__.py +14 -0
  309. sagemaker/core/training/configs.py +333 -0
  310. sagemaker/core/training/constants.py +37 -0
  311. sagemaker/core/training/utils.py +77 -0
  312. sagemaker/core/training_compiler/__init__.py +16 -0
  313. sagemaker/core/training_compiler/config.py +197 -0
  314. sagemaker/core/training_compiler_config.py +197 -0
  315. sagemaker/core/transformer.py +793 -0
  316. sagemaker/core/user_agent.py +76 -0
  317. sagemaker/core/utilities/__init__.py +24 -0
  318. sagemaker/core/utilities/cache.py +169 -0
  319. sagemaker/core/utilities/search_expression.py +133 -0
  320. sagemaker/core/utils/__init__.py +48 -0
  321. sagemaker/core/utils/code_injection/__init__.py +0 -0
  322. {sagemaker_core/main → sagemaker/core/utils}/code_injection/codec.py +2 -2
  323. {sagemaker_core/main → sagemaker/core/utils}/code_injection/shape_dag.py +5979 -176
  324. {sagemaker_core/main → sagemaker/core/utils}/exceptions.py +8 -8
  325. sagemaker_core/main/default_configs_helper.py → sagemaker/core/utils/intelligent_defaults_helper.py +5 -6
  326. {sagemaker_core/main → sagemaker/core/utils}/logs.py +1 -2
  327. {sagemaker_core/main → sagemaker/core/utils}/utils.py +27 -22
  328. sagemaker/core/workflow/__init__.py +152 -0
  329. sagemaker/core/workflow/conditions.py +313 -0
  330. sagemaker/core/workflow/entities.py +58 -0
  331. sagemaker/core/workflow/execution_variables.py +89 -0
  332. sagemaker/core/workflow/functions.py +193 -0
  333. sagemaker/core/workflow/parameters.py +222 -0
  334. sagemaker/core/workflow/pipeline_context.py +394 -0
  335. sagemaker/core/workflow/pipeline_definition_config.py +31 -0
  336. sagemaker/core/workflow/properties.py +285 -0
  337. sagemaker/core/workflow/step_outputs.py +65 -0
  338. sagemaker/core/workflow/utilities.py +507 -0
  339. sagemaker/lineage/__init__.py +33 -0
  340. sagemaker/lineage/action.py +28 -0
  341. sagemaker/lineage/artifact.py +28 -0
  342. sagemaker/lineage/context.py +28 -0
  343. sagemaker/lineage/lineage_trial_component.py +28 -0
  344. {sagemaker_core-1.0.62.dist-info → sagemaker_core-2.1.1.dist-info}/METADATA +28 -9
  345. sagemaker_core-2.1.1.dist-info/RECORD +355 -0
  346. sagemaker_core-2.1.1.dist-info/top_level.txt +1 -0
  347. sagemaker_core/_version.py +0 -3
  348. sagemaker_core/helper/session_helper.py +0 -769
  349. sagemaker_core/resources/__init__.py +0 -1
  350. sagemaker_core/shapes/__init__.py +0 -1
  351. sagemaker_core/tools/__init__.py +0 -1
  352. sagemaker_core-1.0.62.dist-info/RECORD +0 -35
  353. sagemaker_core-1.0.62.dist-info/top_level.txt +0 -1
  354. {sagemaker_core → sagemaker/core/helper}/__init__.py +0 -0
  355. {sagemaker_core/helper → sagemaker/core/huggingface/training_compiler}/__init__.py +0 -0
  356. {sagemaker_core/main → sagemaker/core/jumpstart/factory}/__init__.py +0 -0
  357. {sagemaker_core/main/code_injection → sagemaker/core/jumpstart/hub}/__init__.py +0 -0
  358. {sagemaker_core/main → sagemaker/core/utils}/code_injection/base.py +0 -0
  359. {sagemaker_core/main → sagemaker/core/utils}/code_injection/constants.py +0 -0
  360. {sagemaker_core/main → sagemaker/core/utils}/user_agent.py +0 -0
  361. {sagemaker_core-1.0.62.dist-info → sagemaker_core-2.1.1.dist-info}/WHEEL +0 -0
  362. {sagemaker_core-1.0.62.dist-info → sagemaker_core-2.1.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,223 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+ """Placeholder docstring"""
14
+ from __future__ import absolute_import
15
+
16
+ import struct
17
+ import sys
18
+ import numpy as np
19
+
20
+
21
+ def _write_feature_tensor(resolved_type, record, vector):
22
+ """Placeholder Docstring"""
23
+ raise NotImplementedError()
24
+ # if resolved_type == "Int32":
25
+ # record.features["values"].int32_tensor.values.extend(vector)
26
+ # elif resolved_type == "Float64":
27
+ # record.features["values"].float64_tensor.values.extend(vector)
28
+ # elif resolved_type == "Float32":
29
+ # record.features["values"].float32_tensor.values.extend(vector)
30
+
31
+
32
+ def _write_label_tensor(resolved_type, record, scalar):
33
+ """Placeholder Docstring"""
34
+ raise NotImplementedError()
35
+ # if resolved_type == "Int32":
36
+ # record.label["values"].int32_tensor.values.extend([scalar])
37
+ # elif resolved_type == "Float64":
38
+ # record.label["values"].float64_tensor.values.extend([scalar])
39
+ # elif resolved_type == "Float32":
40
+ # record.label["values"].float32_tensor.values.extend([scalar])
41
+
42
+
43
+ def _write_keys_tensor(resolved_type, record, vector):
44
+ """Placeholder Docstring"""
45
+ raise NotImplementedError()
46
+ # if resolved_type == "Int32":
47
+ # record.features["values"].int32_tensor.keys.extend(vector)
48
+ # elif resolved_type == "Float64":
49
+ # record.features["values"].float64_tensor.keys.extend(vector)
50
+ # elif resolved_type == "Float32":
51
+ # record.features["values"].float32_tensor.keys.extend(vector)
52
+
53
+
54
+ def _write_shape(resolved_type, record, scalar):
55
+ """Placeholder Docstring"""
56
+ raise NotImplementedError()
57
+ # if resolved_type == "Int32":
58
+ # record.features["values"].int32_tensor.shape.extend([scalar])
59
+ # elif resolved_type == "Float64":
60
+ # record.features["values"].float64_tensor.shape.extend([scalar])
61
+ # elif resolved_type == "Float32":
62
+ # record.features["values"].float32_tensor.shape.extend([scalar])
63
+
64
+
65
+ def write_numpy_to_dense_tensor(file, array, labels=None):
66
+ """Writes a numpy array to a dense tensor
67
+
68
+ Args:
69
+ file:
70
+ array:
71
+ labels:
72
+ """
73
+ raise NotImplementedError()
74
+ # # Validate shape of array and labels, resolve array and label types
75
+ # if not len(array.shape) == 2:
76
+ # raise ValueError("Array must be a Matrix")
77
+ # if labels is not None:
78
+ # if not len(labels.shape) == 1:
79
+ # raise ValueError("Labels must be a Vector")
80
+ # if labels.shape[0] not in array.shape:
81
+ # raise ValueError(
82
+ # "Label shape {} not compatible with array shape {}".format(
83
+ # labels.shape, array.shape
84
+ # )
85
+ # )
86
+ # resolved_label_type = _resolve_type(labels.dtype)
87
+ # resolved_type = _resolve_type(array.dtype)
88
+ #
89
+ # # Write each vector in array into a Record in the file object
90
+ # record = Record()
91
+ # for index, vector in enumerate(array):
92
+ # record.Clear()
93
+ # _write_feature_tensor(resolved_type, record, vector)
94
+ # if labels is not None:
95
+ # _write_label_tensor(resolved_label_type, record, labels[index])
96
+ # _write_recordio(file, record.SerializeToString())
97
+
98
+
99
+ def write_spmatrix_to_sparse_tensor(file, array, labels=None):
100
+ """Writes a scipy sparse matrix to a sparse tensor
101
+
102
+ Args:
103
+ file:
104
+ array:
105
+ labels:
106
+ """
107
+ raise NotImplementedError()
108
+ # try:
109
+ # import scipy
110
+ # except ImportError as e:
111
+ # logging.warning(
112
+ # "scipy failed to import. Sparse matrix functions will be impaired or broken."
113
+ # )
114
+ # # Any subsequent attempt to use scipy will raise the ImportError
115
+ # scipy = DeferredError(e)
116
+ #
117
+ # if not scipy.sparse.issparse(array):
118
+ # raise TypeError("Array must be sparse")
119
+ #
120
+ # # Validate shape of array and labels, resolve array and label types
121
+ # if not len(array.shape) == 2:
122
+ # raise ValueError("Array must be a Matrix")
123
+ # if labels is not None:
124
+ # if not len(labels.shape) == 1:
125
+ # raise ValueError("Labels must be a Vector")
126
+ # if labels.shape[0] not in array.shape:
127
+ # raise ValueError(
128
+ # "Label shape {} not compatible with array shape {}".format(
129
+ # labels.shape, array.shape
130
+ # )
131
+ # )
132
+ # resolved_label_type = _resolve_type(labels.dtype)
133
+ # resolved_type = _resolve_type(array.dtype)
134
+ #
135
+ # csr_array = array.tocsr()
136
+ # n_rows, n_cols = csr_array.shape
137
+ #
138
+ # record = Record()
139
+ # for row_idx in range(n_rows):
140
+ # record.Clear()
141
+ # row = csr_array.getrow(row_idx)
142
+ # # Write values
143
+ # _write_feature_tensor(resolved_type, record, row.data)
144
+ # # Write keys
145
+ # _write_keys_tensor(resolved_type, record, row.indices.astype(np.uint64))
146
+ #
147
+ # # Write labels
148
+ # if labels is not None:
149
+ # _write_label_tensor(resolved_label_type, record, labels[row_idx])
150
+ #
151
+ # # Write shape
152
+ # _write_shape(resolved_type, record, n_cols)
153
+ #
154
+ # _write_recordio(file, record.SerializeToString())
155
+
156
+
157
+ def read_records(file):
158
+ """Eagerly read a collection of amazon Record protobuf objects from file.
159
+
160
+ Args:
161
+ file:
162
+ """
163
+ raise NotImplementedError()
164
+ # records = []
165
+ # for record_data in read_recordio(file):
166
+ # record = Record()
167
+ # record.ParseFromString(record_data)
168
+ # records.append(record)
169
+ # return records
170
+
171
+
172
+ # MXNet requires recordio records have length in bytes that's a multiple of 4
173
+ # This sets up padding bytes to append to the end of the record, for diferent
174
+ # amounts of padding required.
175
+ padding = {}
176
+ for amount in range(4):
177
+ if sys.version_info >= (3,):
178
+ padding[amount] = bytes([0x00 for _ in range(amount)])
179
+ else:
180
+ padding[amount] = bytearray([0x00 for _ in range(amount)])
181
+
182
+ _kmagic = 0xCED7230A
183
+
184
+
185
+ def _write_recordio(f, data):
186
+ """Writes a single data point as a RecordIO record to the given file.
187
+
188
+ Args:
189
+ f:
190
+ data:
191
+ """
192
+ length = len(data)
193
+ f.write(struct.pack("I", _kmagic))
194
+ f.write(struct.pack("I", length))
195
+ pad = (((length + 3) >> 2) << 2) - length
196
+ f.write(data)
197
+ f.write(padding[pad])
198
+
199
+
200
+ def read_recordio(f):
201
+ """Placeholder Docstring"""
202
+ while True:
203
+ try:
204
+ (read_kmagic,) = struct.unpack("I", f.read(4))
205
+ except struct.error:
206
+ return
207
+ assert read_kmagic == _kmagic
208
+ (len_record,) = struct.unpack("I", f.read(4))
209
+ pad = (((len_record + 3) >> 2) << 2) - len_record
210
+ yield f.read(len_record)
211
+ if pad:
212
+ f.read(pad)
213
+
214
+
215
+ def _resolve_type(dtype):
216
+ """Placeholder Docstring"""
217
+ if dtype == np.dtype(int):
218
+ return "Int32"
219
+ if dtype == np.dtype(float):
220
+ return "Float64"
221
+ if dtype == np.dtype("float32"):
222
+ return "Float32"
223
+ raise ValueError("Unsupported dtype {} on array".format(dtype))
@@ -0,0 +1,63 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+ """This module contains code related to the ServerlessInferenceConfig class.
14
+
15
+ Codes are used for configuring serverless inference endpoint. Use it when deploying
16
+ the model to the endpoints.
17
+ """
18
+ from __future__ import print_function, absolute_import
19
+ from typing import Optional
20
+
21
+
22
+ class ServerlessInferenceConfig(object):
23
+ """Configuration object passed in when deploying models to Amazon SageMaker Endpoints.
24
+
25
+ This object specifies configuration related to serverless endpoint. Use this configuration
26
+ when trying to create serverless endpoint and make serverless inference
27
+ """
28
+
29
+ def __init__(
30
+ self,
31
+ memory_size_in_mb: int = 2048,
32
+ max_concurrency: int = 5,
33
+ provisioned_concurrency: Optional[int] = None,
34
+ ):
35
+ """Initialize a ServerlessInferenceConfig object for serverless inference configuration.
36
+
37
+ Args:
38
+ memory_size_in_mb (int): Optional. The memory size of your serverless endpoint.
39
+ Valid values are in 1 GB increments: 1024 MB, 2048 MB, 3072 MB, 4096 MB,
40
+ 5120 MB, or 6144 MB. If no value is provided, Amazon SageMaker will choose
41
+ the default value for you. (Default: 2048)
42
+ max_concurrency (int): Optional. The maximum number of concurrent invocations
43
+ your serverless endpoint can process. If no value is provided, Amazon
44
+ SageMaker will choose the default value for you. (Default: 5)
45
+ provisioned_concurrency (int): Optional. The provisioned concurrency of your
46
+ serverless endpoint. If no value is provided, Amazon SageMaker will not
47
+ apply provisioned concucrrency to your Serverless endpoint. (Default: None)
48
+ """
49
+ self.memory_size_in_mb = memory_size_in_mb
50
+ self.max_concurrency = max_concurrency
51
+ self.provisioned_concurrency = provisioned_concurrency
52
+
53
+ def _to_request_dict(self):
54
+ """Generates a request dictionary using the parameters provided to the class."""
55
+ request_dict = {
56
+ "MemorySizeInMB": self.memory_size_in_mb,
57
+ "MaxConcurrency": self.max_concurrency,
58
+ }
59
+
60
+ if self.provisioned_concurrency is not None:
61
+ request_dict["ProvisionedConcurrency"] = self.provisioned_concurrency
62
+
63
+ return request_dict
@@ -0,0 +1,55 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+ """Defines classes to parametrize a SageMaker ``Session``."""
14
+
15
+ from __future__ import absolute_import
16
+
17
+
18
+ class SessionSettings(object):
19
+ """Optional container class for settings to apply to a SageMaker session."""
20
+
21
+ def __init__(
22
+ self,
23
+ encrypt_repacked_artifacts=True,
24
+ local_download_dir=None,
25
+ include_jumpstart_tags=True,
26
+ ) -> None:
27
+ """Initialize the ``SessionSettings`` of a SageMaker ``Session``.
28
+
29
+ Args:
30
+ encrypt_repacked_artifacts (bool): Flag to indicate whether to encrypt the artifacts
31
+ at rest in S3 using the default AWS managed KMS key for S3 when a custom KMS key
32
+ is not provided (Default: True).
33
+ local_download_dir (str): Optional. A path specifying the local directory
34
+ for downloading artifacts. (Default: None).
35
+ include_jumpstart_tags (bool): Optional. By default, if a JumpStart model is identified,
36
+ it will receive special tags describing its properties.
37
+ """
38
+ self._encrypt_repacked_artifacts = encrypt_repacked_artifacts
39
+ self._local_download_dir = local_download_dir
40
+ self._include_jumpstart_tags = include_jumpstart_tags
41
+
42
+ @property
43
+ def encrypt_repacked_artifacts(self) -> bool:
44
+ """Return True if repacked artifacts at rest in S3 should be encrypted by default."""
45
+ return self._encrypt_repacked_artifacts
46
+
47
+ @property
48
+ def local_download_dir(self) -> str:
49
+ """Return path specifying the local directory for downloading artifacts."""
50
+ return self._local_download_dir
51
+
52
+ @property
53
+ def include_jumpstart_tags(self) -> bool:
54
+ """Return True if JumpStart tags should be attached to models with JumpStart artifacts."""
55
+ return self._include_jumpstart_tags
@@ -0,0 +1,3 @@
1
+ from sagemaker.core.shapes.shapes import *
2
+
3
+ from sagemaker.core.shapes.model_card_shapes import *
@@ -0,0 +1,159 @@
1
+ from typing import List, Optional, Dict, Union, Literal, TYPE_CHECKING
2
+ from pydantic import BaseModel, Field
3
+ from enum import Enum
4
+
5
+ from sagemaker.core import shapes
6
+ from sagemaker.core.shapes import ModelDataSource
7
+
8
+ if TYPE_CHECKING:
9
+ from sagemaker.core.shapes.shapes import BaseModel as CoreBaseModel
10
+
11
+
12
+ class RiskRating(str, Enum):
13
+ HIGH = "High"
14
+ MEDIUM = "Medium"
15
+ LOW = "Low"
16
+ UNKNOWN = "Unknown"
17
+
18
+
19
+ class Function(str, Enum):
20
+ MAXIMIZE = "Maximize"
21
+ MINIMIZE = "Minimize"
22
+
23
+
24
+ class ContainersItem(BaseModel):
25
+ model_data_url: Optional[str] = Field(None, max_length=1024)
26
+ image: Optional[str] = Field(None, max_length=255)
27
+ nearest_model_name: Optional[str] = None
28
+ model_data_source: Optional[shapes.ModelDataSource] = None
29
+ is_checkpoint: Optional[bool] = None
30
+ base_model: Optional[shapes.BaseModel] = None
31
+
32
+
33
+ class InferenceSpecification(BaseModel):
34
+ containers: List[ContainersItem]
35
+
36
+
37
+ class ObjectiveFunction(BaseModel):
38
+ function: Optional[Function] = None
39
+ facet: Optional[str] = Field(None, max_length=63)
40
+ condition: Optional[str] = Field(None, max_length=63)
41
+
42
+
43
+ class TrainingMetric(BaseModel):
44
+ name: str = Field(pattern=".{1,255}")
45
+ notes: Optional[str] = Field(None, max_length=1024)
46
+ value: float
47
+
48
+
49
+ class TrainingEnvironment(BaseModel):
50
+ container_image: Optional[List[str]] = None
51
+
52
+
53
+ class TrainingHyperParameter(BaseModel):
54
+ name: str = Field(pattern=".{1,255}")
55
+ value: Optional[str] = Field(None, pattern=".{0,255}")
56
+
57
+
58
+ class TrainingJobDetails(BaseModel):
59
+ training_arn: Optional[str] = Field(None, max_length=1024)
60
+ training_datasets: Optional[List[str]] = None
61
+ training_environment: Optional[TrainingEnvironment] = None
62
+ training_metrics: Optional[List[TrainingMetric]] = None
63
+ user_provided_training_metrics: Optional[List[TrainingMetric]] = None
64
+ hyper_parameters: Optional[List[TrainingHyperParameter]] = None
65
+ user_provided_hyper_parameters: Optional[List[TrainingHyperParameter]] = None
66
+
67
+
68
+ class TrainingDetails(BaseModel):
69
+ objective_function: Optional[ObjectiveFunction] = None
70
+ training_observations: Optional[str] = Field(None, max_length=1024)
71
+ training_job_details: Optional[TrainingJobDetails] = None
72
+
73
+
74
+ class ModelOverview(BaseModel):
75
+ model_description: Optional[str] = Field(None, max_length=1024)
76
+ model_creator: Optional[str] = Field(None, max_length=1024)
77
+ model_artifact: Optional[List[str]] = None
78
+ algorithm_type: Optional[str] = Field(None, max_length=1024)
79
+ problem_type: Optional[str] = None
80
+ model_owner: Optional[str] = Field(None, max_length=1024)
81
+
82
+
83
+ class AdditionalInformation(BaseModel):
84
+ ethical_considerations: Optional[str] = Field(None, max_length=2048)
85
+ caveats_and_recommendations: Optional[str] = Field(None, max_length=2048)
86
+ custom_details: Optional[Dict[str, str]] = None
87
+
88
+
89
+ class SimpleMetric(BaseModel):
90
+ name: str = Field(pattern=".{1,255}")
91
+ notes: Optional[str] = Field(None, max_length=1024)
92
+ type: Literal["number", "string", "boolean"] = None
93
+ value: Union[float, str, bool]
94
+ x_axis_name: Optional[str] = None
95
+ y_axis_name: Optional[str] = None
96
+
97
+
98
+ class BarChartMetric(BaseModel):
99
+ name: str = Field(pattern=".{1,255}")
100
+ notes: Optional[str] = Field(None, max_length=1024)
101
+ type: Literal["bar_chart"] = None
102
+ value: List
103
+ x_axis_name: Optional[List[str]] = None
104
+ y_axis_name: Optional[str] = None
105
+
106
+
107
+ class LinearGraphMetric(BaseModel):
108
+ name: str = Field(pattern=".{1,255}")
109
+ notes: Optional[str] = Field(None, max_length=1024)
110
+ type: Literal["linear_graph"] = None
111
+ value: List
112
+ x_axis_name: Optional[str] = None
113
+ y_axis_name: Optional[str] = None
114
+
115
+
116
+ class MatrixMetric(BaseModel):
117
+ name: str = Field(pattern=".{1,255}")
118
+ notes: Optional[str] = Field(None, max_length=1024)
119
+ type: Literal["matrix"] = None
120
+ value: List
121
+ x_axis_name: Optional[List[str]] = None
122
+ y_axis_name: Optional[List[str]] = None
123
+
124
+
125
+ class MetricGroupsItem(BaseModel):
126
+ name: str = Field(pattern=".{1,63}")
127
+ metric_data: List[Union[SimpleMetric, LinearGraphMetric, BarChartMetric, MatrixMetric]]
128
+
129
+
130
+ class EvaluationDetailsItem(BaseModel):
131
+ name: str = Field(pattern=".{1,63}")
132
+ evaluation_observation: Optional[str] = Field(None, max_length=2096)
133
+ evaluation_job_arn: Optional[str] = Field(None, max_length=256)
134
+ datasets: Optional[List[str]] = Field(None, max_length=10)
135
+ metadata: Optional[Dict[str, str]] = None
136
+ metric_groups: Optional[List[MetricGroupsItem]] = Field(default_factory=list)
137
+
138
+
139
+ class IntendedUses(BaseModel):
140
+ purpose_of_model: Optional[str] = Field(None, max_length=2048)
141
+ intended_uses: Optional[str] = Field(None, max_length=2048)
142
+ factors_affecting_model_efficiency: Optional[str] = Field(None, max_length=2048)
143
+ risk_rating: Optional[RiskRating] = None
144
+ explanations_for_risk_rating: Optional[str] = Field(None, max_length=2048)
145
+
146
+
147
+ class BusinessDetails(BaseModel):
148
+ business_problem: Optional[str] = Field(None, max_length=2048)
149
+ business_stakeholders: Optional[str] = Field(None, max_length=2048)
150
+ line_of_business: Optional[str] = Field(None, max_length=2048)
151
+
152
+
153
+ class ModelCardContent(BaseModel):
154
+ model_overview: Optional[ModelOverview] = None
155
+ intended_uses: Optional[IntendedUses] = None
156
+ business_details: Optional[BusinessDetails] = None
157
+ training_details: Optional[TrainingDetails] = None
158
+ evaluation_details: Optional[List[EvaluationDetailsItem]] = Field(default_factory=list)
159
+ additional_information: Optional[AdditionalInformation] = None