尝试使用 SageMaker Neo 编译 SageMaker 语义分割模型(内置算法)时出现 Missing -symbol.json 错误
我使用内置的 sagemaker 语义分割算法训练了 SageMaker 语义分割模型。这可以正常部署到 SageMaker 端点,我可以通过它在云中成功运行推理。 我想在边缘设备(AWS Panorama Appliance)上使用该模型,这意味着使用 SageMaker Neo 编译模型以符合目标设备的规格。
但是,无论我的目标设备是什么(Neo 设置),我似乎都无法使用 Neo 编译模型,因为出现以下错误:
ClientError: InputConfiguration: No valid Mxnet model file -symbol.json found
语义分割模型的 model.tar.gz 包含 hyperparams.json、model_algo-1、 model_best.params。根据文档,model_algo-1 是序列化的 mxnet 模型。 Neo 不支持胶子模型吗?
顺便说一句,我在另一个 SageMaker 内置算法 k-最近邻 (k-NN) 中遇到了完全相同的问题。它似乎也是在没有 -symbol.json 的情况下编译的。
我可以运行一些脚本来重新创建 -symbol.json 文件或转换编译后的 sagemaker 模型吗?
使用 Estimator 构建模型后,我必须使用代码在 SageMaker Neo 中对其进行编译:
optimized_ic = my_estimator.compile_model(
target_instance_family="ml_c5",
target_platform_os="LINUX",
target_platform_arch="ARM64",
input_shape={"data": [1,3,512,512]},
output_path=s3_optimized_output_location,
framework="mxnet",
framework_version="1.8",
)
我希望编译正常,但这就是我收到错误消息的地方,指出模型缺少 *-symbol.json 文件。
I have trained a SageMaker semantic segmentation model, using the built-in sagemaker semantic segmentation algorithm. This deploys ok to a SageMaker endpoint and I can run inference in the cloud successfully from it.
I would like to use the model on a edge device (AWS Panorama Appliance) which should just mean compiling the model with SageMaker Neo to the specifications of the target device.
However, regardless of what my target device is (the Neo settings), I cant seem to compile the model with Neo as I get the following error:
ClientError: InputConfiguration: No valid Mxnet model file -symbol.json found
The model.tar.gz for semantic segmentation models contains hyperparams.json, model_algo-1, model_best.params. According to the docs, model_algo-1 is the serialized mxnet model. Aren't gluon models supported by Neo?
Incidentally I encountered the exact same problem with another SageMaker built-in algorithm, the k-Nearest Neighbour (k-NN). It too seems to be compiled without a -symbol.json.
Is there some scripts I can run to recreated a -symbol.json file or convert the compiled sagemaker model?
After building my model with an Estimator, I got to compile it in SageMaker Neo with code:
optimized_ic = my_estimator.compile_model(
target_instance_family="ml_c5",
target_platform_os="LINUX",
target_platform_arch="ARM64",
input_shape={"data": [1,3,512,512]},
output_path=s3_optimized_output_location,
framework="mxnet",
framework_version="1.8",
)
I would expect this to compile ok, but that is where I get the error saying the model is missing the *-symbol.json file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因,AWS 决定不使其内置算法直接与 Neo 兼容...但是,您可以使用 model.tar.gz 输出文件重新设计网络参数,然后进行编译。
第 1 步:从 tar 文件中提取模型
这应该输出两个文件:
model_algo-1、model_best.params
在本例中,我使用 DeepLabv3 和 resnet50 通过
使用用于训练的图像。
额外检查图像形状兼容性
这包含 Neo 寻找的参数和 json 文件。
For some reason, AWS has decided to not make its built-in algorithms directly compatible with Neo... However, you can re-engineer the network parameters using the model.tar.gz output file and then compile.
Step 1: Extract model from tar file
This should output two files:
model_algo-1, model_best.params
In this case I used DeepLabv3 with resnet50
Use an image that was used for training.
Additional check for image shape compatibility
This contains the params and json file which Neo looks for.