ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aiobotocore 1.3.3 requires botocore<1.20.107,>=1.20.106, but you have botocore 1.21.15 which is incompatible.
그렇다면 문제의 Cell을 한번 더 실행해주세요.
프로젝트 이름
Notebook dependencies 설치 후 커널 재시작을 했다면, PROJECT_NAME 변수를 변경합니다.
이 때 이름은 위에서 입력했던 프로젝트 이름과 똑같이 입력합니다.
PROJECT_NAME 변수의 값 변경
# Replace `None` with the project name when creating SageMaker Project
# You can find it from the left panel in Studio
PROJECT_NAME = "sagemaker-safe-deployment-proj"
# Replace `None` with the project name when creating SageMaker Project
# You can find it from the left panel in Studio
PROJECT_NAME = "sagemaker-safe-deployment-pro"
assert PROJECT_NAME is not None and isinstance(
PROJECT_NAME, str
), "Please specify the project name as string"
Cell을 누르고 Shift + Enter를 누르면 실행할 수 있어요.
import boto3
from IPython.core.display import HTML, display
def get_provisioned_product_name(project_name):
region = boto3.Session().region_name
sc = boto3.client("servicecatalog")
products = sc.search_provisioned_products(
Filters={
"SearchQuery": [
project_name,
]
}
)
pp = products["ProvisionedProducts"]
if len(pp) != 1:
print("Invalid provisioned product name. Open the link below and search manually")
display(
HTML(
f'<a target="_blank" href="https://{region}.console.aws.amazon.com/servicecatalog/home?region={region}#provisioned-products">Service Catalog</a>'
)
)
raise ValueError("Invalid provisioned product")
return pp[0]["Name"]
PROVISIONED_PRODUCT_NAME = get_provisioned_product_name(PROJECT_NAME)
print(
f"The associated Service Catalog Provisioned Product Name to this SagaMaker project: {PROVISIONED_PRODUCT_NAME}"
)
마찬가지로 Shift + Enter 눌러 실행해주세요.
데이터셋 (Dataset)
링크만 봤을 때 내용이 없어 당황했다면, Studio로 돌아가 이어서 진행합니다. 모든 내용이 mlops.ipynb에 담겨있습니다.
import seaborn as sns
sample_df = data_df.sample(1000)
sns.scatterplot(data=sample_df, x="duration_minutes", y="trip_distance")
문제의 Cell
혹시 이 Cell을 실행시켰더니 에러가 발생하나요?
/opt/conda/lib/python3.7/site-packages/pandas/core/dtypes/cast.py in construct_1d_arraylike_from_scalar(value, length, dtype)
1459 value = ensure_str(value)
1460
-> 1461 subarr = np.empty(length, dtype=dtype)
1462 subarr.fill(value)
1463
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type
train_df.to_csv("train.csv", index=False, header=False)
# Save test and baseline with headers
train_df.to_csv("baseline.csv", index=False, header=True)
baseline 파일은 SageMaker Model Monitor에서 데이터 변화 감지할 때 사용합니다.