Создание Model_card в конвейере sagemaker выдает «Ошибка при сериализации объекта типа [кортеж]: TypeError («невозможно Python

Программы на Python
Anonymous
Создание Model_card в конвейере sagemaker выдает «Ошибка при сериализации объекта типа [кортеж]: TypeError («невозможно

Сообщение Anonymous »


У меня есть следующие шаги для моего конвейера:

Код: Выделить всё

step0: I create my model with my model data
step1: I follow `RegisterModel` to register the model
step2: Then I use `CreateModelStep` using step0 model(i.e. step_create_model)
step3: Then I create a lambda `LambdaStep` step which gives me model_package_arn as output as below also it creates an endpoint, PS: lambda takes input paramter model_name from `step_create_model.properties.ModelName`  and `modelPackageGroupName`
model_package_arn_ref = step_deploy_model_lambda_and_get_package_arn.properties.Outputs["ModelPackageARN"]
and output parameter for
lambda model_package_group_name_param = LambdaOutput(output_name="ModelPackageARN", output_type=LambdaOutputTypeEnum.String
)
if I run this workflow with below condition with the pipeline as below:

Код: Выделить всё

step_cond = ConditionStep(
name="MSE-Lower-Than-Threshold-Condition",
conditions=[cond_lte],
if_steps=[step_register_model,
step_create_model,
step_deploy_model_lambda_and_get_package_arn
],
else_steps=[],
)

pipeline = Pipeline(
name=pipeline_name,
parameters=[
training_instance_type,
processing_instance_type,
processing_instance_count,
input_data,
model_approval_status,
training_epochs,
accuracy_mse_threshold,
endpoint_instance_type,
model_package_arn_ref,
model_package_group_name_param
],
steps=[step_preprocess_data, step_train_model, step_evaluate_model, step_cond],
sagemaker_session=pipeline_session,
)
I see the my model package arn and other output in workflow DAG for last one which is lambda.
Now I would like to add create model card as

Код: Выделить всё

@step decorator
to use custom function to create the model card stepdecorator

Код: Выделить всё

@step(
name="CreateModelCard"
)
def create_model_card(model_package_details, sagemaker_session):
model_card_name = "TestingModelCard"
# Get model package details
mp_details = ModelPackage.from_model_package_arn(
model_package_arn=model_package_details,
sagemaker_session=sagemaker_session,
)

my_card = ModelCard(
name=model_card_name,
status=ModelCardStatusEnum.PENDING_REVIEW,
model_package_details=mp_details,
sagemaker_session=sagemaker_session
)
my_card.create()
return f"Model card {model_card_name} created successfully"
Then my step for

Код: Выделить всё

model_card
lookslike below

Код: Выделить всё

model_card_pipeline_params = {"model_package_details": model_package_arn_ref,
"sagemaker_session": sagemaker_session
}
step_delayed_model_card = create_model_card(**model_card_pipeline_params)
and then If I add the this

Код: Выделить всё

step_delayed_model_card
in my condtition after lambda call I'm getting the error. Does anyone know, what I'm doing wrong and how to fix it.
new step condition with model_card

Код: Выделить всё

step_cond = ConditionStep(
name="MSE-Lower-Than-Threshold-Condition",
conditions=[cond_lte],
if_steps=[step_register_model,
step_create_model,
step_lower_mse_deploy_model_lambda_package_arn,
step_delayed_model_card
],
else_steps=[],
)
The error looks like this

Код: Выделить всё

Exception: Error when serializing object of type [tuple]: TypeError("cannot pickle 'SSLContext' object")
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.10/site-packages/sagemaker/remote_function/core/serialization.py", line 108, in serialize
custom_pickler.dump(obj)
File "/home/runner/.local/lib/python3.10/site-packages/cloudpickle/cloudpickle_fast.py", line 632, in dump
return Pickler.dump(self, obj)
TypeError: cannot pickle 'SSLContext' object


Источник: https://stackoverflow.com/questions/781 ... izing-obje

Вернуться в «Python»