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
sagemaker/core/job.py ADDED
@@ -0,0 +1,380 @@
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
+ from abc import abstractmethod
17
+ from six import string_types
18
+
19
+ from sagemaker.core.inputs import FileSystemInput, TrainingInput
20
+ from sagemaker.core.workflow import is_pipeline_variable
21
+
22
+
23
+ def _is_file_input(obj):
24
+ """Check if object is a file_input instance (lazy import to avoid circular dependency)."""
25
+ from sagemaker.core.local.local_session import file_input
26
+
27
+ return isinstance(obj, file_input)
28
+
29
+
30
+ def _get_file_input_class():
31
+ """Get file_input class (lazy import to avoid circular dependency)."""
32
+ from sagemaker.core.local.local_session import file_input
33
+
34
+ return file_input
35
+
36
+
37
+ class _Job(object):
38
+ """Handle creating, starting and waiting for Amazon SageMaker jobs to finish.
39
+
40
+ This class shouldn't be directly instantiated.
41
+
42
+ Subclasses must define a way to create, start and wait for an Amazon
43
+ SageMaker job.
44
+ """
45
+
46
+ def __init__(self, sagemaker_session, job_name):
47
+ """Placeholder docstring"""
48
+ self.sagemaker_session = sagemaker_session
49
+ self.job_name = job_name
50
+
51
+ @abstractmethod
52
+ def start_new(self, estimator, inputs):
53
+ """Create a new Amazon SageMaker job from the estimator.
54
+
55
+ Args:
56
+ estimator (sagemaker.estimator.EstimatorBase): Estimator object
57
+ created by the user.
58
+ inputs (str): Parameters used when called
59
+ :meth:`~sagemaker.estimator.EstimatorBase.fit`.
60
+
61
+ Returns:
62
+ sagemaker.job: Constructed object that captures all information
63
+ about the started job.
64
+ """
65
+
66
+ @abstractmethod
67
+ def wait(self):
68
+ """Wait for the Amazon SageMaker job to finish."""
69
+
70
+ @abstractmethod
71
+ def describe(self):
72
+ """Describe the job."""
73
+
74
+ @abstractmethod
75
+ def stop(self):
76
+ """Stop the job."""
77
+
78
+ @staticmethod
79
+ def _load_config(inputs, estimator, expand_role=True, validate_uri=True):
80
+ """Placeholder docstring"""
81
+ model_access_config, hub_access_config = _Job._get_access_configs(estimator)
82
+ input_config = _Job._format_inputs_to_input_config(inputs, validate_uri)
83
+ role = (
84
+ estimator.sagemaker_session.expand_role(estimator.role)
85
+ if (expand_role and not is_pipeline_variable(estimator.role))
86
+ else estimator.role
87
+ )
88
+ output_config = _Job._prepare_output_config(
89
+ estimator.output_path,
90
+ estimator.output_kms_key,
91
+ disable_output_compression=estimator.disable_output_compression,
92
+ )
93
+ resource_config = _Job._prepare_resource_config(
94
+ estimator.instance_count,
95
+ estimator.instance_type,
96
+ estimator.instance_groups,
97
+ estimator.volume_size,
98
+ estimator.volume_kms_key,
99
+ estimator.keep_alive_period_in_seconds,
100
+ estimator.training_plan,
101
+ )
102
+ stop_condition = _Job._prepare_stop_condition(estimator.max_run, estimator.max_wait)
103
+ vpc_config = estimator.get_vpc_config()
104
+
105
+ model_channel = _Job._prepare_channel(
106
+ input_config,
107
+ estimator.model_uri,
108
+ estimator.model_channel_name,
109
+ validate_uri,
110
+ content_type="application/x-sagemaker-model",
111
+ input_mode="File",
112
+ model_access_config=model_access_config,
113
+ hub_access_config=hub_access_config,
114
+ )
115
+ if model_channel:
116
+ input_config = [] if input_config is None else input_config
117
+ input_config.append(model_channel)
118
+
119
+ code_channel = _Job._prepare_channel(
120
+ input_config,
121
+ estimator.code_uri,
122
+ estimator.code_channel_name,
123
+ validate_uri,
124
+ )
125
+
126
+ if code_channel:
127
+ input_config = [] if input_config is None else input_config
128
+ input_config.append(code_channel)
129
+
130
+ return {
131
+ "input_config": input_config,
132
+ "role": role,
133
+ "output_config": output_config,
134
+ "resource_config": resource_config,
135
+ "stop_condition": stop_condition,
136
+ "vpc_config": vpc_config,
137
+ }
138
+
139
+ @staticmethod
140
+ def _get_access_configs(estimator):
141
+ """Return access configs from estimator object.
142
+
143
+ JumpStartEstimator uses access configs which need to be added to the model channel,
144
+ so they are passed down to the job level.
145
+
146
+ Args:
147
+ estimator (EstimatorBase): estimator object with access config field if applicable
148
+ """
149
+ model_access_config, hub_access_config = None, None
150
+ if hasattr(estimator, "model_access_config"):
151
+ model_access_config = estimator.model_access_config
152
+ if hasattr(estimator, "hub_access_config"):
153
+ hub_access_config = estimator.hub_access_config
154
+ return model_access_config, hub_access_config
155
+
156
+ @staticmethod
157
+ def _format_inputs_to_input_config(inputs, validate_uri=True):
158
+ """Placeholder docstring"""
159
+ if inputs is None:
160
+ return None
161
+
162
+ input_dict = {}
163
+ if isinstance(inputs, string_types):
164
+ input_dict["training"] = _Job._format_string_uri_input(inputs, validate_uri)
165
+ elif isinstance(inputs, TrainingInput):
166
+ input_dict["training"] = inputs
167
+ elif _is_file_input(inputs):
168
+ input_dict["training"] = inputs
169
+ elif isinstance(inputs, dict):
170
+ for k, v in inputs.items():
171
+ input_dict[k] = _Job._format_string_uri_input(v, validate_uri)
172
+ elif isinstance(inputs, list):
173
+ input_dict = _Job._format_record_set_list_input(inputs)
174
+ elif isinstance(inputs, FileSystemInput):
175
+ input_dict["training"] = inputs
176
+ else:
177
+ msg = (
178
+ "Cannot format input {}. Expecting one of str, dict, TrainingInput or "
179
+ "FileSystemInput"
180
+ )
181
+ raise ValueError(msg.format(inputs))
182
+
183
+ channels = [
184
+ _Job._convert_input_to_channel(name, input) for name, input in input_dict.items()
185
+ ]
186
+
187
+ return channels
188
+
189
+ @staticmethod
190
+ def _convert_input_to_channel(channel_name, channel_s3_input):
191
+ """Placeholder docstring"""
192
+ channel_config = channel_s3_input.config.copy()
193
+ channel_config["ChannelName"] = channel_name
194
+ return channel_config
195
+
196
+ @staticmethod
197
+ def _format_string_uri_input(
198
+ uri_input,
199
+ validate_uri=True,
200
+ content_type=None,
201
+ input_mode=None,
202
+ compression=None,
203
+ target_attribute_name=None,
204
+ model_access_config=None,
205
+ hub_access_config=None,
206
+ ):
207
+ """Placeholder docstring"""
208
+ s3_input_result = TrainingInput(
209
+ uri_input,
210
+ content_type=content_type,
211
+ input_mode=input_mode,
212
+ compression=compression,
213
+ target_attribute_name=target_attribute_name,
214
+ model_access_config=model_access_config,
215
+ hub_access_config=hub_access_config,
216
+ )
217
+ if isinstance(uri_input, str) and validate_uri and uri_input.startswith("s3://"):
218
+ return s3_input_result
219
+ if isinstance(uri_input, str) and validate_uri and uri_input.startswith("file://"):
220
+ return _get_file_input_class()(uri_input)
221
+ if isinstance(uri_input, str) and validate_uri:
222
+ raise ValueError(
223
+ 'URI input {} must be a valid S3 or FILE URI: must start with "s3://" or '
224
+ '"file://"'.format(uri_input)
225
+ )
226
+ if isinstance(uri_input, str):
227
+ return s3_input_result
228
+ if _is_file_input(uri_input) or isinstance(uri_input, FileSystemInput):
229
+ return uri_input
230
+ if isinstance(uri_input, TrainingInput):
231
+ uri_input.add_hub_access_config(hub_access_config=hub_access_config)
232
+ uri_input.add_model_access_config(model_access_config=model_access_config)
233
+ return uri_input
234
+ if is_pipeline_variable(uri_input):
235
+ return s3_input_result
236
+
237
+ raise ValueError(
238
+ "Cannot format input {}. Expecting one of str, TrainingInput, file_input or "
239
+ "FileSystemInput".format(uri_input)
240
+ )
241
+
242
+ @staticmethod
243
+ def _prepare_channel(
244
+ input_config,
245
+ channel_uri=None,
246
+ channel_name=None,
247
+ validate_uri=True,
248
+ content_type=None,
249
+ input_mode=None,
250
+ model_access_config=None,
251
+ hub_access_config=None,
252
+ ):
253
+ """Placeholder docstring"""
254
+ if not channel_uri:
255
+ return None
256
+ if not channel_name:
257
+ raise ValueError(
258
+ "Expected a channel name if a channel URI {} is specified".format(channel_uri)
259
+ )
260
+
261
+ if input_config:
262
+ for existing_channel in input_config:
263
+ if existing_channel["ChannelName"] == channel_name:
264
+ raise ValueError("Duplicate channel {} not allowed.".format(channel_name))
265
+
266
+ channel_input = _Job._format_string_uri_input(
267
+ channel_uri,
268
+ validate_uri,
269
+ content_type,
270
+ input_mode,
271
+ model_access_config=model_access_config,
272
+ hub_access_config=hub_access_config,
273
+ )
274
+ channel = _Job._convert_input_to_channel(channel_name, channel_input)
275
+
276
+ return channel
277
+
278
+ @staticmethod
279
+ def _format_model_uri_input(model_uri, validate_uri=True):
280
+ """Placeholder docstring"""
281
+ if isinstance(model_uri, string_types) and validate_uri and model_uri.startswith("s3://"):
282
+ return TrainingInput(
283
+ model_uri,
284
+ input_mode="File",
285
+ distribution="FullyReplicated",
286
+ content_type="application/x-sagemaker-model",
287
+ )
288
+ if isinstance(model_uri, string_types) and validate_uri and model_uri.startswith("file://"):
289
+ return _get_file_input_class()(model_uri)
290
+ if isinstance(model_uri, string_types) and validate_uri:
291
+ raise ValueError(
292
+ 'Model URI must be a valid S3 or FILE URI: must start with "s3://" or ' '"file://'
293
+ )
294
+ if isinstance(model_uri, string_types):
295
+ return TrainingInput(
296
+ model_uri,
297
+ input_mode="File",
298
+ distribution="FullyReplicated",
299
+ content_type="application/x-sagemaker-model",
300
+ )
301
+ raise ValueError("Cannot format model URI {}. Expecting str".format(model_uri))
302
+
303
+ @staticmethod
304
+ def _format_record_set_list_input(inputs):
305
+ """Placeholder docstring
306
+
307
+ Note: This method depends on RecordSet and FileSystemRecordSet from the
308
+ deprecated sagemaker.core.amazon module and is no longer functional.
309
+ """
310
+ raise NotImplementedError(
311
+ "RecordSet and FileSystemRecordSet are no longer supported. "
312
+ "The sagemaker.core.amazon module has been deprecated and removed."
313
+ )
314
+ # if isinstance(record, RecordSet):
315
+ # input_dict[record.channel] = record.records_s3_input()
316
+ # if isinstance(record, FileSystemRecordSet):
317
+ # input_dict[record.channel] = record.file_system_input
318
+
319
+ # return input_dict
320
+
321
+ @staticmethod
322
+ def _prepare_output_config(s3_path, kms_key_id, disable_output_compression=False):
323
+ """Placeholder docstring"""
324
+ config = {"S3OutputPath": s3_path}
325
+ if kms_key_id is not None:
326
+ config["KmsKeyId"] = kms_key_id
327
+ if disable_output_compression:
328
+ config["CompressionType"] = "NONE"
329
+ return config
330
+
331
+ @staticmethod
332
+ def _prepare_resource_config(
333
+ instance_count,
334
+ instance_type,
335
+ instance_groups,
336
+ volume_size,
337
+ volume_kms_key,
338
+ keep_alive_period_in_seconds,
339
+ training_plan,
340
+ ):
341
+ """Placeholder docstring"""
342
+ resource_config = {
343
+ "VolumeSizeInGB": volume_size,
344
+ }
345
+ if volume_kms_key is not None:
346
+ resource_config["VolumeKmsKeyId"] = volume_kms_key
347
+ if keep_alive_period_in_seconds is not None:
348
+ resource_config["KeepAlivePeriodInSeconds"] = keep_alive_period_in_seconds
349
+ if instance_groups is not None:
350
+ if instance_count is not None or instance_type is not None:
351
+ raise ValueError(
352
+ "instance_count and instance_type cannot be set when instance_groups is set"
353
+ )
354
+
355
+ resource_config["InstanceGroups"] = [
356
+ group._to_request_dict() for group in instance_groups
357
+ ]
358
+ else:
359
+ if instance_count is None or instance_type is None:
360
+ raise ValueError(
361
+ "instance_count and instance_type must be set if instance_groups is not set"
362
+ )
363
+ resource_config["InstanceCount"] = instance_count
364
+ resource_config["InstanceType"] = instance_type
365
+ if training_plan is not None:
366
+ resource_config["TrainingPlanArn"] = training_plan
367
+
368
+ return resource_config
369
+
370
+ @staticmethod
371
+ def _prepare_stop_condition(max_run, max_wait):
372
+ """Placeholder docstring"""
373
+ if max_wait:
374
+ return {"MaxRuntimeInSeconds": max_run, "MaxWaitTimeInSeconds": max_wait}
375
+ return {"MaxRuntimeInSeconds": max_run}
376
+
377
+ @property
378
+ def name(self):
379
+ """Placeholder docstring"""
380
+ return self.job_name
@@ -0,0 +1,156 @@
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 JumpStart utilities for the SageMaker Python SDK."""
14
+ from __future__ import absolute_import
15
+
16
+ # Core JumpStart Accessors
17
+ from sagemaker.core.jumpstart.accessors import ( # noqa: F401
18
+ JumpStartModelsAccessor,
19
+ JumpStartS3PayloadAccessor,
20
+ SageMakerSettings,
21
+ )
22
+
23
+ # Core JumpStart Configuration
24
+ from sagemaker.core.jumpstart.configs import JumpStartConfig # noqa: F401
25
+
26
+ # NOTE: JumpStartEstimator is in sagemaker.train.jumpstart.estimator
27
+ # NOTE: JumpStartPredictor does not exist as a standalone class.
28
+ # Predictor functionality is provided through JumpStartPredictorSpecs in types module.
29
+
30
+ # Enums (alphabetically ordered)
31
+ from sagemaker.core.jumpstart.enums import ( # noqa: F401
32
+ DeserializerType,
33
+ HubContentCapability,
34
+ HyperparameterValidationMode,
35
+ JumpStartConfigRankingName,
36
+ JumpStartModelType,
37
+ JumpStartScriptScope,
38
+ JumpStartTag,
39
+ MIMEType,
40
+ ModelFramework,
41
+ ModelSpecKwargType,
42
+ NamingConventionType,
43
+ SerializerType,
44
+ VariableScope,
45
+ VariableTypes,
46
+ )
47
+
48
+ # Types (alphabetically ordered)
49
+ from sagemaker.core.jumpstart.types import ( # noqa: F401
50
+ AdditionalModelDataSource,
51
+ BaseDeploymentConfigDataHolder,
52
+ DeploymentArgs,
53
+ DeploymentConfigMetadata,
54
+ HubAccessConfig,
55
+ HubArnExtractedInfo,
56
+ HubContentType,
57
+ HubType,
58
+ JumpStartAdditionalDataSources,
59
+ JumpStartBenchmarkStat,
60
+ JumpStartCachedContentKey,
61
+ JumpStartCachedContentValue,
62
+ JumpStartConfigComponent,
63
+ JumpStartConfigRanking,
64
+ JumpStartDataHolderType,
65
+ JumpStartECRSpecs,
66
+ JumpStartEnvironmentVariable,
67
+ JumpStartEstimatorDeployKwargs,
68
+ JumpStartEstimatorFitKwargs,
69
+ JumpStartEstimatorInitKwargs,
70
+ JumpStartHyperparameter,
71
+ JumpStartInstanceTypeVariants,
72
+ JumpStartKwargs,
73
+ JumpStartLaunchedRegionInfo,
74
+ JumpStartMetadataBaseFields,
75
+ JumpStartMetadataConfig,
76
+ JumpStartMetadataConfigs,
77
+ JumpStartModelDataSource,
78
+ JumpStartModelDeployKwargs,
79
+ JumpStartModelHeader,
80
+ JumpStartModelInitKwargs,
81
+ JumpStartModelRegisterKwargs,
82
+ JumpStartModelSpecs,
83
+ JumpStartPredictorSpecs,
84
+ JumpStartS3FileType,
85
+ JumpStartSerializablePayload,
86
+ JumpStartVersionedModelId,
87
+ ModelAccessConfig,
88
+ S3DataSource,
89
+ )
90
+
91
+ # NOTE: ModelDataType does not exist in the JumpStart module.
92
+ # This may be a reference to a type that exists elsewhere or is planned for future implementation.
93
+
94
+ __all__ = [
95
+ # Accessors
96
+ "JumpStartModelsAccessor",
97
+ "JumpStartS3PayloadAccessor",
98
+ "SageMakerSettings",
99
+ # Configuration
100
+ "JumpStartConfig",
101
+ # Enums
102
+ "DeserializerType",
103
+ "HubContentCapability",
104
+ "HyperparameterValidationMode",
105
+ "JumpStartConfigRankingName",
106
+ "JumpStartModelType",
107
+ "JumpStartScriptScope",
108
+ "JumpStartTag",
109
+ "MIMEType",
110
+ "ModelFramework",
111
+ "ModelSpecKwargType",
112
+ "NamingConventionType",
113
+ "SerializerType",
114
+ "VariableScope",
115
+ "VariableTypes",
116
+ # Types
117
+ "AdditionalModelDataSource",
118
+ "BaseDeploymentConfigDataHolder",
119
+ "DeploymentArgs",
120
+ "DeploymentConfigMetadata",
121
+ "HubAccessConfig",
122
+ "HubArnExtractedInfo",
123
+ "HubContentType",
124
+ "HubType",
125
+ "JumpStartAdditionalDataSources",
126
+ "JumpStartBenchmarkStat",
127
+ "JumpStartCachedContentKey",
128
+ "JumpStartCachedContentValue",
129
+ "JumpStartConfigComponent",
130
+ "JumpStartConfigRanking",
131
+ "JumpStartDataHolderType",
132
+ "JumpStartECRSpecs",
133
+ "JumpStartEnvironmentVariable",
134
+ "JumpStartEstimatorDeployKwargs",
135
+ "JumpStartEstimatorFitKwargs",
136
+ "JumpStartEstimatorInitKwargs",
137
+ "JumpStartHyperparameter",
138
+ "JumpStartInstanceTypeVariants",
139
+ "JumpStartKwargs",
140
+ "JumpStartLaunchedRegionInfo",
141
+ "JumpStartMetadataBaseFields",
142
+ "JumpStartMetadataConfig",
143
+ "JumpStartMetadataConfigs",
144
+ "JumpStartModelDataSource",
145
+ "JumpStartModelDeployKwargs",
146
+ "JumpStartModelHeader",
147
+ "JumpStartModelInitKwargs",
148
+ "JumpStartModelRegisterKwargs",
149
+ "JumpStartModelSpecs",
150
+ "JumpStartPredictorSpecs",
151
+ "JumpStartS3FileType",
152
+ "JumpStartSerializablePayload",
153
+ "JumpStartVersionedModelId",
154
+ "ModelAccessConfig",
155
+ "S3DataSource",
156
+ ]