utterworks / fast-bert

Super easy library for BERT based NLP models
Apache License 2.0
1.86k stars 341 forks source link

Deploying a Sagemaker endpoint #185

Open LauraSkylakiTR opened 4 years ago

LauraSkylakiTR commented 4 years ago

I am using version 1.6.4. After I trained my model with:

text_classifier = sagemaker.RealTimePredictor(endpoint=bt_model.endpoint_name, sagemaker_session=sagemaker_session, serializer=json.dumps, deserializer=sagemaker.predictor.json_deserializer)

And I got an error: UnexpectedStatusException: Error hosting endpoint roberta-LS-2020-03-16-09-48-47: Failed. Reason: The primary container for production variant AllTraffic did not pass the ping health check. Please check CloudWatch logs for this endpoint..

The error is in the file fast-bert/container/bert/predictor.py line 49. You need to modify the call to BertClassificationPredictor using a string instead of a PosixPath. It can be easily solved like this:

predictor = BertClassificationPredictor( str(PATH / "model_out"), label_path=PATH, multi_label=bool(model_config["multi_label"]), model_type=model_config["model_type"], do_lower_case=bool(model_config["do_lower_case"]), )

Thank you for your work!

connect2ajith commented 4 years ago

Hey Laura, This should now be resolved, with PR #186 .

LauraSkylakiTR commented 4 years ago

Great thank you!