aws / aws/sagemaker-python-sdk

Initialization of default JumpStart SageMaker Session is slow

オープン
#4,468 コメント 2 件 リアクション 6 件 担当者 1 名 @rsareddy0329 が担当を希望しています GitHub で見る
component: jumpstart type: bug
主要言語
Python
スター
2.3k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
35

説明

Through the following import chain, the `DEFAULT_JUMPSTART_SAGEMAKER_SESSION` constant is initialized:

```
(.venv\Lib\site-packages\sagemaker\jumpstart\constants.py:237)
(.venv\Lib\site-packages\sagemaker\image_uris.py:24)
(.venv\Lib\site-packages\sagemaker\estimator.py:30)
(.venv\Lib\site-packages\sagemaker\__init__.py:18)
```

This involves creating many boto clients (at least 5 by my count), each time trying to find AWS credentials using botocore's `CredentialResolver.load_credentials` which (because I don't have credentials in environment variables, I'm using STS internally) ends up making slow network requests and is generally inefficient (searches through 11 credential providers). In total it is adding 13 seconds to my local startup time.

I'm using my own SageMaker `Session` whenever creating a new `Predictor`, and I don't believe I'm ever using the `DEFAULT_JUMPSTART_SAGEMAKER_SESSION` (if I modify the SDK source to skip its initialization everything still works). Could it be lazily loaded internally?

**System information**
- **SageMaker Python SDK version**: 2.210.0
- **Python version**: 3.11

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。