Skip to content Skip to sidebar Skip to footer

Read And Manipulate Sagemaker Json Output

I deployed my HuggingFace Transformer model as a batch process on Sagemaker. My output file is an .jsonl.out file and looks like this: {'SageMakerOutput':[{'label':'LABEL_8','score

Solution 1:

I think the below can work for you

lst = [
    {"SageMakerOutput": [{"label": "LABEL_8", "score": 0.9152628183364868}], "inputs": "test"},
    {"SageMakerOutput": [{"label": "LABEL_8", "score": 0.9769203066825867}], "inputs": "Alles OK"}
]

result = [(entry['SageMakerOutput'][0]['label'],entry['inputs']) for entry in lst]

print(result)

output

[('LABEL_8', 'test'), ('LABEL_8', 'Alles OK')]

Post a Comment for "Read And Manipulate Sagemaker Json Output"