我有一个在本地训练的模型,然后转移到 AWS ECS。我想将它部署到 Sagemaker。
目前,我这样做:
from sagemaker.estimator import Estimator
model = Estimator(image,
role, 1, 'ml.c4.2xlarge',
output_path="s3://{}/output".format(sess.default_bucket()),
sagemaker_session=sess)
但是当我打电话
from sagemaker.predictor import csv_serializer
predictor = agent.deploy(1, 'ml.t2.medium', serializer=csv_serializer)
我得到:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-5-0ca9477e4acb> in <module>()
1 from sagemaker.predictor import csv_serializer
----> 2 predictor = model.deploy(1, 'ml.t2.medium', serializer=csv_serializer)
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/estimator.py in deploy(self, initial_instance_count, instance_type, endpoint_name, **kwargs)
177 """
178 if not self.latest_training_job:
--> 179 raise RuntimeError('Estimator has not been fit yet.')
180 endpoint_name = endpoint_name or self.latest_training_job.name
181 self.deploy_instance_type = instance_type
RuntimeError: Estimator has not been fit yet.
但它已经适合了……只是不适用于 Sagemaker。我该如何克服这个问题?