Skip to content

Missing json error when trying to compile a semantic segmentation model (builtin algorithm) with Neo #2062

Closed as not planned

Description

@MCE-KobyBo

Describe the bug
Not sure if this is a bug or an unsupported feature. We've trained a semantic segmentation model, using the built in sagemaker semantic segmentation algorithm, (FCN with resenet 50) and were able to successfully deploy it. But, we wanted to compile it with Neo in order to improve inference performance, and to be able to deploy it to an inf1 instance.
When I try to compile the model (based on examples in sample notebooks), I receive 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?
If not, can I manulay use gluon\mxnet to save the required symbols json from the serialized model in order to use Neo?
Thanks!

To reproduce
Train a Semantic Segmentation model using sagemaker builtin algorithm, with FCN and resnet 50, and try to call the estimators compile_model.

Expected behavior
Neo should successfully compile the model.

Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.

System information
A description of your system. Please provide:

  • SageMaker Python SDK version:
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans): Semantic segmentation (builtin)
  • Framework version:
  • Python version: 3.6
  • CPU or GPU: Running in a sagemaker jupyter notebook, hosted on a a CPU instance
  • Custom Docker image (Y/N):

Additional context
Add any other context about the problem here.

Activity

  1. changed the title [-]Missing json erro when trying to compile a semantic segmentation model (builtin algorithm) with Neo[/-] [+]Missing json erroר when trying to compile a semantic segmentation model (builtin algorithm) with Neo[/+] on Dec 30, 2020
  2. changed the title [-]Missing json erroר when trying to compile a semantic segmentation model (builtin algorithm) with Neo[/-] [+]Missing json error when trying to compile a semantic segmentation model (builtin algorithm) with Neo[/+] on Dec 30, 2020
  3. trevor-m commented on Jan 12, 2021

    @trevor-m

    Hi @MCE-KobyBo

    Sagemaker training stores the actual Mxnet model (*-symbol.json and *.params) in a non-standard way by zipping them into the model_algo-1 file - which is actually a zip file with no extension.

    You can work around this by unzipping the model_algo-1 file and creating a new .tar.gz with the *-symbol.json and *.params files, which can be submitted to Neo for compilation.

  4. MCE-KobyBo commented on Jan 13, 2021

    @MCE-KobyBo
    Author

    @trevor-m Thanks for your reply.
    I read about that somewhere, but it doesn't seem to be the case here. The model.tar.gz file produced by the training job contains 3 files: hyperparams.json, model_algo-1 and model_best.params. model_algo-1 doesn't seem to be a zip file in this case, it has the same size and format as model_best.params.

    They both seem to be exported gloucv model parameters. To test that, I've followed the sample code in this stackoverflow thread (but using FCN) and it worked, I was able to load it directly with load_params. This means that for Neo, maybe I'll have to manually export it.

  5. trevor-m commented on Feb 2, 2021

    @trevor-m

    Thanks for the response! It appears that sagemaker builtin models does not have a consistent format. While unzipping the model_algo-1 file worked for other Sagemaker builtin models such as LinearLearner, it appears it is a different internal format in this case. I would advise asking the Sagemaker builtin segmentation model team about how to extract the underlying model, or avoiding Sagemaker builtin models altogether.

  6. taroko-mooncake commented on Sep 10, 2021

    @taroko-mooncake

    @MCE-KobyBo Did you manage to solve this manually? I'm having similar issues.

  7. MCE-KobyBo commented on Sep 14, 2021

    @MCE-KobyBo
    Author

    @taroko-mooncake Unfortunately no, but as we didn't have time to continue trying we just decided not to use neo for now

  8. taroko-mooncake commented on Sep 16, 2021

    @taroko-mooncake

    @MCE-KobyBo I solved it - if you post the question on stackoverflow i can send to you

  9. korimarik commented on Oct 5, 2021

    @korimarik

    Hey @taroko-mooncake ,
    I'm ready to post it on Stackoverflow in order to get a solution

  10. dcoder4 commented on Mar 11, 2022

    @dcoder4

    @taroko-mooncake @korimarik Did you end up solving this? Was there a StackOverflow Q/A posted? Having same problem using built-in Semantic Segmentation model and SageMaker Neo

  11. taroko-mooncake commented on Mar 22, 2022

    @taroko-mooncake

    Yes I did solve it - if you post a SO QA I can send you the answer

    @taroko-mooncake @korimarik Did you end up solving this? Was there a StackOverflow Q/A posted? Having same problem using built-in Semantic Segmentation model and SageMaker Neo

  12. dcoder4 commented on Mar 22, 2022

    @dcoder4

    Thanks @taroko-mooncake appreciate the help.
    I have posted a StackOverflow Question here:
    [https://stackoverflow.com/questions/71579883/missing-symbol-json-error-when-trying-to-compile-a-sagemaker-semantic-segmentat]

  13. vveselov commented on Sep 15, 2022

    @vveselov

    I have the same issue with Linear Learner. The generated model.tar.gz has a file model.algo-1 which is a zip file. I was able to compile the model only after I unpacked the file and created a separate tar.gz file witn only one symbol.json file and one params file.

  14. added
    component: neo
    and removed on Apr 24, 2024
  15. self-assigned this
    on Feb 4, 2025
  16. jam-jee commented on Sep 14, 2026

    @jam-jee
    Collaborator

    Closing as not an SDK issue. The 'No valid Mxnet model file -symbol.json found' error comes from the Neo compilation service rejecting the artifact layout produced by the built-in semantic segmentation (and, per a later comment, Linear Learner) algorithms, whose model.tar.gz wraps the MXNet symbol and params inside a model_algo-1 archive. The Python SDK does not create or transform that artifact; the workaround in this thread (unpack model_algo-1 and re-tar the -symbol.json and params files) operates on the artifact itself. This belongs with the built-in algorithm containers or Neo service teams rather than this repo. If you hit an SDK-side problem with compile_model on V3 (sagemaker 3.x), please open a new issue with a traceback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component: neotype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions