Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding metadata schema to the code base itself #7409

Merged
merged 22 commits into from
Jul 25, 2024

Conversation

ericspod
Copy link
Member

Fixes #7303 #6959.

Description

This adds the schema file into the code base (but this maybe should be elsewhere). The changes implement a number of new things:

  • Moved definitions into a $defs section per the JSON schema standard
  • Permits multiple input arguments and return results from networks with arbitrary names using the patternProperties mechanism
  • Allows the types of inputs and outputs to be, additional to just tensors, numbers, booleans, or strings
  • Outputs after post processing can be specified with the post_processed_outputs section if they are significantly changed with the post-process transforms defined in scripts
  • Multiple network IO formats can be specified in addition to network_data_format, these must follow the pattern <name>_data_format
  • required_packages_version added in addition to optional_packages_version

#7253 depends on this schema change.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@ericspod
Copy link
Member Author

Should this file exist here or put elsewhere? Currently the schema is stored in extra-test-data within a release, but it has to be somewhere accessible through a URL in the metadata.json files. #4048 references the issue of making this URL accessible.

@KumoLiu
Copy link
Contributor

KumoLiu commented Jan 22, 2024

Should this file exist here or put elsewhere? Currently the schema is stored in extra-test-data within a release, but it has to be somewhere accessible through a URL in the metadata.json files. #4048 references the issue of making this URL accessible.

Yes, just make this draft PR to help review and leave comments. After finished we can move it in extra-test-data or somewhere else.

@yiheng-wang-nv
Copy link
Contributor

Can we prepare a test case, like using 1) this schema and 2) prepare a fake metadata.json file to use verify_metadata in monai.bundle.scripts to verify that it works?

@ericspod
Copy link
Member Author

Can we prepare a test case, like using 1) this schema and 2) prepare a fake metadata.json file to use verify_metadata in monai.bundle.scripts to verify that it works?

Yes I can put that together shortly.

ericspod and others added 2 commits February 3, 2024 00:35
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@ericspod
Copy link
Member Author

ericspod commented Feb 3, 2024

Can we prepare a test case, like using 1) this schema and 2) prepare a fake metadata.json file to use verify_metadata in monai.bundle.scripts to verify that it works?

@yiheng-wang-nv I've added a notebook demonstrating this now. We won't want to merge this into dev, it's just a demo as the schema file is.

ericspod and others added 2 commits February 3, 2024 00:37
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@ericspod
Copy link
Member Author

Outstanding discussion points:

  • Should required_packages_version and/or optional_packages_version be required at all? If required_packages_version is required then model zoo bundles will need updating.
  • Should we allow multiple network formats with added [NAME]_data_format blocks but require there to always be a network_data_format block? The diffusion models in the zoo will need fixing if so.

@ericspod
Copy link
Member Author

I've made required_packages_version mandatory but not optional_packages_version. We'll keep the [NAME]_data_format content of the schema. I've added documentation about other details as well.

@yiheng-wang-nv
Copy link
Contributor

Hi @ericspod @KumoLiu @Nic-Ma , I rechecked this draft PR's changes.

I agree to use required_packages_version and enable multiple network formats. After this PR is merged, we can start to update MONAI model zoo bundles to use this schema.
Hi @ericspod , are there any other blockers for this PR? (we can remove the notebook before merge)

@ericspod
Copy link
Member Author

@yiheng-wang-nv I don't have any blockers for this PR. The jupyter notebook and schema file should be removed and the schema file instead uploaded here where the other versions live.

@ericspod ericspod marked this pull request as ready for review July 23, 2024 15:53
@yiheng-wang-nv
Copy link
Contributor

@yiheng-wang-nv I don't have any blockers for this PR. The jupyter notebook and schema file should be removed and the schema file instead uploaded here where the other versions live.

I see. Thanks for the response. Do you think we should add supported_apps into this schema directly? (sorry for mis-clicked the close button and reopen button)

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 24, 2024

I agree we can directly add supported_apps to the schema and make it optional. In this PR, we'll only merge the rst file and add the new schema here. After that, we need to merge this PR: #7253. Subsequently, we will update all bundles for consistency.
So The first step is to add supported_apps and upload the new schema. What do you think?

ericspod and others added 2 commits July 24, 2024 15:35
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@ericspod
Copy link
Member Author

agree we can directly add supported_apps to the schema and make it optional. In this PR, we'll only merge the rst file and add the new schema here. After that, we need to merge this PR: #7253. Subsequently, we will update all bundles for consistency.
So The first step is to add supported_apps and upload the new schema. What do you think?

I've added supported_apps to the schema, please check the wording of the description and documentation matches the intent.

ericspod and others added 4 commits July 24, 2024 17:32
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@mingxin-zheng
Copy link
Contributor

My comments are minor and please feel free to skip/close them as needed for merge. Thanks!

docs/source/mb_specification.rst Outdated Show resolved Hide resolved
docs/source/mb_specification.rst Outdated Show resolved Hide resolved
ericspod and others added 3 commits July 25, 2024 17:06
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@ericspod ericspod enabled auto-merge (squash) July 25, 2024 16:08
@ericspod
Copy link
Member Author

I've addressed comments and remove the schema file now.

@ericspod
Copy link
Member Author

The schema is now uploaded as meta_schema_20240725.json.

@KumoLiu
Copy link
Contributor

KumoLiu commented Jul 25, 2024

/build

@ericspod ericspod merged commit 2e53df7 into Project-MONAI:dev Jul 25, 2024
28 checks passed
@ericspod ericspod deleted the bundle_schema branch July 25, 2024 17:56
@yiheng-wang-nv
Copy link
Contributor

Thanks @ericspod for the contribution. I will use the new schema in: https://github.com/Project-MONAI/model-zoo/pull/605

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the schema for MONAI Bundle
6 participants