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

Add 3d diffusion model bundle #390

Merged
merged 153 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 144 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
6bab90c
add train config for autoencoder for diffusion bundle
Can-Zhao Apr 24, 2023
d3e56e1
Merge branch 'dev' into ldm3d
Can-Zhao Apr 24, 2023
4bf387f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 24, 2023
4b3335b
add train config for diffusion model for diffusion bundle
Can-Zhao Apr 25, 2023
79dc164
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
78900e2
Merge branch 'dev' into ldm3d
Can-Zhao Apr 25, 2023
d4a81fb
reformat
Can-Zhao Apr 25, 2023
4b1524d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
b96fa41
add initi attempt of multi-gpu
Can-Zhao Apr 25, 2023
801f39d
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao Apr 25, 2023
1cdc989
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
46b03ee
update readme
Can-Zhao Apr 25, 2023
7097cb2
update readme
Can-Zhao Apr 25, 2023
5389f17
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
9c4fb68
update readme
Can-Zhao Apr 25, 2023
3e07691
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao Apr 25, 2023
4c1ffbf
update readme
Can-Zhao Apr 25, 2023
f2f74cf
update readme
Can-Zhao Apr 25, 2023
ff5c944
remove unused args
yiheng-wang-nv Apr 25, 2023
2fc8191
add StatsHandler
Can-Zhao Apr 25, 2023
5db0a80
change cache
Can-Zhao Apr 25, 2023
ae6641f
update readme
Can-Zhao Apr 25, 2023
c906e5f
add inference
Can-Zhao Apr 25, 2023
b08e8fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
e759e00
update meta
Can-Zhao Apr 25, 2023
d4d3dbd
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d # Pl…
Can-Zhao Apr 25, 2023
4786c71
update readme
Can-Zhao Apr 25, 2023
47eb1b4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
8ae2638
corrent inference
Can-Zhao Apr 25, 2023
67be3f3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
2f7c48d
reformat
Can-Zhao Apr 25, 2023
a9ba54d
reformat
Can-Zhao Apr 25, 2023
66d6495
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 25, 2023
e684ea3
reformat
Can-Zhao Apr 25, 2023
1ab7f9a
update meta
Can-Zhao Apr 25, 2023
af4ac4c
update readme
Can-Zhao Apr 25, 2023
bb5fab4
reformat
Can-Zhao Apr 25, 2023
f2b7b6c
reformat
Can-Zhao Apr 26, 2023
8fa5405
refactor
Can-Zhao Apr 26, 2023
4484e1e
update readme
Can-Zhao Apr 26, 2023
5732c8f
update readme
Can-Zhao Apr 26, 2023
1237e88
update readme
Can-Zhao Apr 26, 2023
28a0c28
update readme
Can-Zhao Apr 26, 2023
a9ad5d7
update readme
Can-Zhao Apr 26, 2023
954ee36
update readme
Can-Zhao Apr 26, 2023
662d2df
update readme
Can-Zhao Apr 26, 2023
3cff16e
update readme
Can-Zhao Apr 26, 2023
39ed104
[MONAI] code formatting
monai-bot Apr 26, 2023
f93079b
reformat
Can-Zhao Apr 26, 2023
3baa9ff
reformat
Can-Zhao Apr 26, 2023
1bae63f
reformat
Can-Zhao Apr 26, 2023
c721ced
reformat
Can-Zhao Apr 26, 2023
ca54b30
update readme
Can-Zhao Apr 26, 2023
91fc60c
add install script for ci test
yiheng-wang-nv Apr 26, 2023
52b653b
Merge branch 'ldm3d' of https://github.com/Can-Zhao/model-zoo into ldm3d
yiheng-wang-nv Apr 26, 2023
c4f8a8a
use fixed commit id and ignore pytype import error
yiheng-wang-nv Apr 26, 2023
c44dfff
update readme
Can-Zhao Apr 26, 2023
a577789
let lr to be easier configured
Can-Zhao Apr 27, 2023
ab68688
let lr to be easier configured
Can-Zhao Apr 27, 2023
f63f326
update readme
Can-Zhao Apr 28, 2023
364af38
update readme
Can-Zhao Apr 28, 2023
91cb915
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 28, 2023
05807b7
Merge branch 'dev' into ldm3d
yiheng-wang-nv Apr 28, 2023
081dcd4
add trained weights
Can-Zhao May 1, 2023
22be4fe
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao May 1, 2023
75273d2
update readme
Can-Zhao May 1, 2023
b25ab63
update readme
Can-Zhao May 1, 2023
70daa88
update readme
Can-Zhao May 1, 2023
20900dc
update readme
Can-Zhao May 1, 2023
725a5db
Merge branch 'Project-MONAI:dev' into ldm3d
Can-Zhao May 1, 2023
bf4a89b
update readme figs
Can-Zhao May 1, 2023
9750db5
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao May 1, 2023
118c423
update readme
Can-Zhao May 1, 2023
ecec425
change file name to meet test
Can-Zhao May 1, 2023
de4abf4
update meta
Can-Zhao May 1, 2023
28896e3
update dataset in readme
Can-Zhao May 2, 2023
c6c7416
update readme
Can-Zhao May 4, 2023
f2ed687
update readme
Can-Zhao May 4, 2023
fd1ee28
update readme
Can-Zhao May 4, 2023
9d060cf
Merge branch 'dev' into ldm3d
Can-Zhao May 5, 2023
ff0a453
change diffusion_def to network_def
Can-Zhao May 6, 2023
9507a34
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao May 6, 2023
5d5d62b
change sampler to inferer
Can-Zhao May 6, 2023
7166639
change sampler to inferer
Can-Zhao May 6, 2023
e78eb49
change network_def
Can-Zhao May 6, 2023
65b3698
update latent channel
Can-Zhao May 6, 2023
4fd082c
change network_def
Can-Zhao May 6, 2023
7d98595
change network_def
Can-Zhao May 6, 2023
5340af4
add paramaters in inference
Can-Zhao May 6, 2023
8342dde
update meta
Can-Zhao May 6, 2023
2602221
update meta
Can-Zhao May 7, 2023
525da8f
Merge branch 'dev' into ldm3d
Can-Zhao May 7, 2023
af92fb1
update readme
Can-Zhao May 7, 2023
2cbf81a
update readme
Can-Zhao May 8, 2023
e17105a
update meta
Can-Zhao May 8, 2023
d4b6020
update meta
Can-Zhao May 8, 2023
54bf9f0
update inference.json
Can-Zhao May 8, 2023
6c80f6d
skip input check
yiheng-wang-nv May 8, 2023
50a70ee
Merge branch 'ldm3d' of https://github.com/Can-Zhao/model-zoo into ldm3d
yiheng-wang-nv May 8, 2023
8e472f6
update meta
Can-Zhao May 8, 2023
8a1a142
update meta
Can-Zhao May 8, 2023
969f7e8
update readme
Can-Zhao May 8, 2023
a0b69aa
update readme
Can-Zhao May 8, 2023
382be85
update readme
Can-Zhao May 8, 2023
fa26476
Merge branch 'dev' into ldm3d
yiheng-wang-nv May 9, 2023
0f2879d
reformat readme
yiheng-wang-nv May 9, 2023
38b5e1e
enable torchscript test
yiheng-wang-nv May 9, 2023
6618958
simplify export
Can-Zhao May 9, 2023
c3e907e
add lpips version
Can-Zhao May 9, 2023
626a487
add lpips version
Can-Zhao May 9, 2023
fe96105
update readme
Can-Zhao May 9, 2023
9779ae7
update readme
Can-Zhao May 9, 2023
1cdfb5f
update command format
yiheng-wang-nv May 10, 2023
9b76a3a
Merge branch 'dev' into ldm3d
yiheng-wang-nv May 10, 2023
d0739b3
perceptual loss and config
Can-Zhao May 11, 2023
a7f2e37
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao May 11, 2023
0c3e9c9
update readme
Can-Zhao May 11, 2023
daf6b67
reformat
Can-Zhao May 11, 2023
c9b7c82
update readme
Can-Zhao May 11, 2023
7c1e499
flake8
Can-Zhao May 11, 2023
127421c
update readme
Can-Zhao May 12, 2023
3e54c1f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 12, 2023
1de2b11
add config file to inference autoencoder only
Can-Zhao May 12, 2023
f452975
Merge branch 'ldm3d' of github.com:Can-Zhao/model-zoo into ldm3d
Can-Zhao May 12, 2023
58c799f
update infer
Can-Zhao May 12, 2023
9d6dc3e
update readme
Can-Zhao May 12, 2023
42265df
seprate data download out, update readme
Can-Zhao May 13, 2023
08cc6bc
seprate data download out, update readme
Can-Zhao May 13, 2023
68e9678
update readme
Can-Zhao May 13, 2023
7fb9f9e
update readme
Can-Zhao May 13, 2023
3b6658b
reformat
Can-Zhao May 13, 2023
0f048f0
Merge branch 'dev' into ldm3d
Can-Zhao May 13, 2023
612fe75
update readme and config for pre-trained issue
Can-Zhao May 15, 2023
11bb3f5
update readme
Can-Zhao May 15, 2023
5d44bf8
update config for download
Can-Zhao May 15, 2023
de7d6e5
typo
Can-Zhao May 15, 2023
a667710
remove download flag
yiheng-wang-nv May 15, 2023
a84bca1
fix typo
yiheng-wang-nv May 15, 2023
eddbfe3
reformat pretrained
yiheng-wang-nv May 15, 2023
386a199
adjust sentence
yiheng-wang-nv May 15, 2023
9f03dd1
use correct install commit id
yiheng-wang-nv May 15, 2023
1504191
rephrase sentence
yiheng-wang-nv May 15, 2023
cecb03a
fix download related errors
yiheng-wang-nv May 15, 2023
a0bab96
remove error file and update data part of readme
yiheng-wang-nv May 15, 2023
a08d963
remove duplicate link and modify default dataset dir
yiheng-wang-nv May 15, 2023
20ac1d9
Merge branch 'dev' into ldm3d
yiheng-wang-nv May 15, 2023
1f50f39
export installed path in ci
yiheng-wang-nv May 15, 2023
ea01892
rewrite install lib ci
yiheng-wang-nv May 15, 2023
d31e59d
add cython install
yiheng-wang-nv May 15, 2023
bb28726
use export pythonpath instead of setup install
yiheng-wang-nv May 15, 2023
d3b8233
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 15, 2023
77644ac
exclude ts test
yiheng-wang-nv May 15, 2023
f0b8faf
resolve conflict
yiheng-wang-nv May 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ In train config file (if exists), please follow the following requirements in or

We prepared several premerge CI tests to verify your bundle.

### Prepare dependencies

For dependencies that support `pip install` command, please put them into `optional_packages_version` in `configs/metadata.json` ([click here for instance](https://github.com/Project-MONAI/model-zoo/blob/dev/models/brats_mri_segmentation/configs/metadata.json)), and the CI test program will extract and install all libraries directly before running tests.
For dependencies that require multiple steps to install, please prepare a install script in `ci/install_scripts`, and put the bundle name and the script path into `install_dependency_dict` in `ci/bundle_custom_data.py` ([click here for instance](https://github.com/Project-MONAI/model-zoo/tree/dev/ci/install_scripts/)).

### Necessary verifications

1. Check if necessary files are existing in your bundle.
Expand Down
14 changes: 13 additions & 1 deletion ci/bundle_custom_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
# This list is used for our CI tests to determine whether a bundle needs to be tested with
# the `verify_data_shape` function in `verify_bundle.py`.
# If a bundle does not need to be tested, please add the bundle name into the list.
exclude_verify_shape_list = ["mednist_gan", "lung_nodule_ct_detection", "pathology_nuclei_segmentation_classification"]
exclude_verify_shape_list = [
yiheng-wang-nv marked this conversation as resolved.
Show resolved Hide resolved
"mednist_gan",
"lung_nodule_ct_detection",
"pathology_nuclei_segmentation_classification",
"brats_mri_generative_diffusion",
]

# This list is used for our CI tests to determine whether a bundle contains the preferred files.
# If a bundle does not have any of the preferred files, please add the bundle name into the list.
Expand All @@ -30,6 +35,13 @@
"mednist_reg",
]

# This dict is used for our CI tests to install required dependencies that cannot be installed by `pip install` directly.
# If a bundle has this kind of dependencies, please add the bundle name (key), and the path of the install script (value)
# into the dict.
install_dependency_dict = {
"brats_mri_generative_diffusion": "ci/install_scripts/install_brats_mri_generative_diffusion_dependency.sh"
}

# This list is used for our CI tests to determine whether a bundle supports TensorRT export. Related
# test will be employed for bundles in the list.
include_verify_tensorrt_list = ["spleen_ct_segmentation", "endoscopic_tool_segmentation", "pathology_tumor_detection"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

git clone https://github.com/Project-MONAI/GenerativeModels.git
cd GenerativeModels/
git checkout f969c24f88d013dc0045fb7b2885a01fb219992b
python setup.py install
cd ..
36 changes: 31 additions & 5 deletions ci/verify_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import argparse
import os
import subprocess
import sys
from typing import List

Expand All @@ -19,6 +20,7 @@
exclude_verify_preferred_files_list,
exclude_verify_shape_list,
exclude_verify_torchscript_list,
install_dependency_dict,
)
from monai.bundle import ckpt_export, verify_metadata, verify_net_in_out
from monai.bundle.config_parser import ConfigParser
Expand Down Expand Up @@ -47,6 +49,20 @@ def _find_bundle_file(root_dir: str, file: str, suffix=("json", "yaml", "yml")):
return file_name


def _get_weights_names(bundle: str):
# TODO: this function is temporarily used. It should be replaced by detailed config tests.
if bundle == "brats_mri_generative_diffusion":
return "model_autoencoder.pt", "model_autoencoder.ts"
return "model.pt", "model.ts"


def _get_net_id(bundle: str):
# TODO: this function is temporarily used. It should be replaced by detailed config tests.
if bundle == "brats_mri_generative_diffusion":
return "autoencoder_def"
return "network_def"


def _check_missing_keys(file_name: str, bundle_path: str, keys_list: List):
config = ConfigParser.load_config_file(os.path.join(bundle_path, "configs", file_name))
missing_keys = []
Expand Down Expand Up @@ -267,7 +283,9 @@ def verify_data_shape(bundle_path: str, net_id: str, config_file: str):
)


def verify_torchscript(bundle_path: str, net_id: str, config_file: str):
def verify_torchscript(
bundle_path: str, net_id: str, config_file: str, model_name: str = "model.pt", ts_name: str = "model.ts"
):
"""
This function is used to verify if the checkpoint is able to export into torchscript model, and
if "models/model.ts" is provided, it will be checked if it is able to be loaded
Expand All @@ -277,21 +295,27 @@ def verify_torchscript(bundle_path: str, net_id: str, config_file: str):
ckpt_export(
net_id=net_id,
filepath=os.path.join(bundle_path, "models/verify_model.ts"),
ckpt_file=os.path.join(bundle_path, "models/model.pt"),
ckpt_file=os.path.join(bundle_path, "models", model_name),
meta_file=os.path.join(bundle_path, "configs/metadata.json"),
config_file=os.path.join(bundle_path, config_file),
bundle_root=bundle_path,
)
print("export weights into TorchScript module successfully.")

ts_model_path = os.path.join(bundle_path, "models/model.ts")
ts_model_path = os.path.join(bundle_path, "models", ts_name)
if os.path.exists(ts_model_path):
torch.jit.load(ts_model_path)
print("Provided TorchScript module is verified correctly.")


def verify(bundle, models_path="models", mode="full"):
print(f"start verifying {bundle}:")
# install extra dependencies if needed
if bundle in install_dependency_dict.keys():
script_path = install_dependency_dict[bundle]
install_cmd = f"bash {script_path}"
call_status = subprocess.run(install_cmd, shell=True)
call_status.check_returncode()
# add bundle path to ensure custom code can be used
sys.path = [os.path.join(models_path, bundle)] + sys.path
# verify bundle directory
Expand All @@ -313,7 +337,8 @@ def verify(bundle, models_path="models", mode="full"):
return

# The following are optional tests and require GPU
net_id, inference_file_name = "network_def", _find_bundle_file(os.path.join(bundle_path, "configs"), "inference")
net_id = _get_net_id(bundle)
inference_file_name = _find_bundle_file(os.path.join(bundle_path, "configs"), "inference")
config_file = os.path.join("configs", inference_file_name)

if bundle in exclude_verify_shape_list:
Expand All @@ -325,7 +350,8 @@ def verify(bundle, models_path="models", mode="full"):
if bundle in exclude_verify_torchscript_list:
print(f"bundle: {bundle} does not support torchscript, skip verifying.")
else:
verify_torchscript(bundle_path, net_id, config_file)
model_name, ts_name = _get_weights_names(bundle=bundle)
verify_torchscript(bundle_path, net_id, config_file, model_name, ts_name)


if __name__ == "__main__":
Expand Down
201 changes: 201 additions & 0 deletions models/brats_mri_generative_diffusion/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Loading