aws / aws/amazon-sagemaker-examples

[Bug Report] NameError: name 'summarize_script_uri' is not defined

Open
#3,112 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

**Link to the notebook**
https://github.com/aws/amazon-sagemaker-examples/blob/master/end_to_end/nlp_mlops_company_sentiment/02_nlp_company_earnings_analysis_pipeline.ipynb

**Describe the bug**
Getting `NameError: name 'summarize_script_uri' is not defined` when running the cell to Create pipeline conditions to check if the Endpoint deployments were successful:

```
from sagemaker.workflow.conditions import ConditionEquals
from sagemaker.workflow.condition_step import ( ConditionStep )
from sagemaker.workflow.functions import JsonGet

sentiment_condition_eq = ConditionEquals(
left=JsonGet( #the left value of the evaluation expression
step_name="HFSECFinBertDeployModel", #the step from which the property file will be grabbed
property_file=sentiment_deploy_response, #the property file instance that was created earlier in Step 4
json_path="model_created" #the JSON path of the property within the property file success.json
),
right="Y" #the right value of the evaluation expression, i.e. the AUC threshold
)

summary_condition_eq = ConditionEquals(
left=JsonGet( #the left value of the evaluation expression
step_name="HFSECPegasusDeployModel", #the step from which the property file will be grabbed
property_file=summary_deploy_response, #the property file instance that was created earlier in Step 4
json_path="model_created" #the JSON path of the property within the property file success.json
),
right="Y" #the right value of the evaluation expression, i.e. the AUC threshold
)

summarize_processor = ScriptProcessor(command=['python3'],
image_uri=CONTAINER_IMAGE_URI,
role=role,
instance_count=processing_instance_count,
instance_type=processing_instance_type)

summarize_step_2 = ProcessingStep(
name='HFSECPegasusSummarizer_2',
processor=summarize_processor,
inputs=[sagemaker.processing.ProcessingInput(input_name='summary_data',
source=f'{inference_input_data}/10k10q',
destination='/opt/ml/processing/input')],
outputs=[sagemaker.processing.ProcessingOutput(output_name='summarized_data',
source='/opt/ml/processing/output',
destination=f'{inference_input_data}/10k10q/summary')],
job_arguments=["--ticker-cik", inference_ticker_cik,
"--region", region,
"--endpoint-name", summarization_endpoint_name],
code=summarize_script_uri)

deploy_condition_step = ConditionStep(
name="HFSECFinBertDeployConditionCheck",
conditions=[sentiment_condition_eq,summary_condition_eq], #the equal to conditions defined above
if_steps=[summarize_step_2], #if the condition evaluates to true then run the summarization step
else_steps=[], #there are no else steps so we will keep it empty
depends_on=['HFSECFinBertDeployModel','HFSECPegasusDeployModel'] #dependencies on both Finbert and Pegasus Deployment steps
)
```

**To reproduce**
Run notebook.

**Logs**
```
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
in
39 "--region", region,
40 "--endpoint-name", summarization_endpoint_name],
---> 41 code=summarize_script_uri)
42
43 deploy_condition_step = ConditionStep(

NameError: name 'summarize_script_uri' is not defined
```

Contributor guide

Open the contributing guide

Research direction

Open end_to_end/nlp_mlops_company_sentiment/02_nlp_company_earnings_analysis_pipeline.ipynb and reproduce the failure in the cell that creates the deployment ConditionStep. Inspect the preceding cells and the use of summarize_script_uri at the ProcessingStep, then run the notebook again; done means this cell no longer raises NameError and the pipeline setup proceeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.