├── utils.py ├── addons └── __init__.py ├── arxiv └── __init__.py ├── books └── __init__.py ├── c4 └── __init__.py ├── github └── __init__.py ├── commoncrawl └── __init__.py ├── wikipedia └── __init__.py ├── stackexchange └── __init__.py ├── .gitignore ├── README.md ├── preprocess_data.py └── LICENSE /utils.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addons/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /arxiv/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /books/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /c4/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /github/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /commoncrawl/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /wikipedia/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /stackexchange/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KINDA-LLAMA 2 | An open-source replication and extension of the [Meta AI's LLAMA](https://research.facebook.com/file/1574548786327032/LLaMA--Open-and-Efficient-Foundation-Language-Models.pdf) dataset. The project is general-purpose, but we also specifically aim for compatibility with [RWKV](https://github.com/BlinkDL/RWKV-LM) [checkpoints](https://huggingface.co/BlinkDL/rwkv-4-pile-14b/tree/main) and [tokenizer](https://github.com/BlinkDL/RWKV-LM/blob/main/RWKV-v4neo/20B_tokenizer.json). 3 | 4 | ## My overview on LLAMA dataset 5 | ... keeping in mind three possible goals, namely
6 | (G.1) pure replication of LLAMA
7 | (G.2) A superset of LLAMA for better scientific performance - they notice in the paper that they might lose to Minerva in the benchmarks due to not enough technical books and papers and
8 | (G.3) A "LLAMA minus Pile-V1" which would allow continuing training from the checkpoints we already have.
9 | 10 | Notably, (G.3) would require deduplication against Pile-V1 with some fast string-hashing algorithm ([Pile used simple sha256 hash](https://github.com/EleutherAI/the-pile/blob/master/processing_scripts/dedupe_train.py) but there might be better solutions) 11 | 12 | Thus, the overview: 13 | 14 | 1. CommonCrawl is taken from [here](https://commoncrawl.org/the-data/get-started/) and [processed with this](https://github.com/facebookresearch/cc_net) (likely a decent amount of CPU compute needed, as it is written in python, we could profile and accelerate the hotspots). 15 | 2. [C4 is on huggingface](https://huggingface.co/datasets/allenai/c4) - we might think about which exact (noclean, clean) version to use. 16 | 3. Github - they used bigquery dump (it requires google account to access), we could use more extensive dumps such as https://huggingface.co/datasets/codeparrot/github-code (free) or https://huggingface.co/datasets/bigcode/the-stack (free, requires a form sign-in). Pile-V1 included 95 GiB Github section, so we need to deduplicate against it. 17 | 4. Wikipedia - they use latest summer 2022 dumps of Wikipedia in many languages(bg, ca, cs, da, de, en, es, fr, hr, hu, it, nl, pl, pt, ro, ru, sl, sr, sv, uk), while Pile-V1 used just an older dump of english wikipedia. They sample Wikipedia two times. Clearly this one is important enough to be shown several times, so I think we don't need deduplication here. The [dumps are available](https://dumps.wikimedia.org/backup-index.html) and we can process them with one of these scripts https://github.com/shyamupa/wikidump_preprocessing https://github.com/singletongue/wikipedia-utils https://github.com/siznax/wptools (if you know a better tool, comment). 18 | 5. Books - they use a mix of public domain books from Gutenberg project and a copy of Pile-V1 books section, thus we need to take a different set of quality books from libgen and clean+tokenize them with Pile-derived script to avoid duplication. They also implement deduplication at a book level with 90% threshold which wasn't the case with Pile. We will need fast custom code for this (comment if you know a good codebase to start from). 19 | 6. ArXiv - they use [ArXiv Latex dump](https://info.arxiv.org/help/bulk_data_s3.html) with extensive postprocessing (removal of intro pages and bibliography, **latex macro expansion**). It overlaps with Pile-V1 ArXiv subsection, but Pile-V1 lacks papers submitted in the last 3 years and it didn't use special preprocessing. Given success of Galactica LM with its multi-epoch training on scientific literature, we likely would be better served by avoiding deduplication here and just copying what LLAMA did for data processing. At a glance I don't see an exactly equivalent Arxiv script, so we might need to develop our own from one of these: https://github.com/EleutherAI/pile-arxiv https://github.com/mattbierbaum/arxiv-public-datasets https://github.com/amacfie/mathtext 20 | 7. Stackexchange - [freely available from web archive](https://archive.org/details/stackexchange). Pile-V1 has stackexchange data too, but LLAMA likely has a superset of it due to later date. LLAMA's preprocessing is very simple, could be implemented within [this codebase from Pile's authors](https://github.com/EleutherAI/stackexchange-dataset) 21 | 22 | Important note: **in an attempt to enhance number representation, LLAMA authors split all numbers into individual digits**. We likely would be better off doing this as well, otherwise models hardly learn mathematics. This could be implemented without changing the legacy 20B_tokenizer.json to keep compatibility with available checkpoints. 23 | 24 | ## Preliminary complexity estimate 25 | 26 | Technically, the most complicated parts of the dataset are likely the following, in order of decreasing complexity: ArXiv, Wikipedia, Books. I expect some of the subdatasets to be very large compute-wise and to have small compute hotspots we might want to [rewrite in something other than interpreted python](https://github.com/exaloop/codon) to execute it in time on volunteer hardware. 27 | 28 | Regarding the storage requirements, we can use smart sharding to avoid having to store and transmit 3x data for different versions of the dataset. For example, the Pile-V1 is already sharded https://the-eye.eu/public/AI/pile/train/ and we might use similar data format with addition of labeling the shards as belonging to (G.1) (G.2) or (G.3) sets. 29 | 30 | In short, there are many pieces available to imitate and surpass LLAMA dataset, but there is no 100% complete workflow and some programming will be required to build it to completion, in addition to compute donation to execute it and produce the dataset. 31 | 32 | ## Possible extensions 33 | 34 | If our goal were to surpass the LLAMA dataset, we might think about creating these addons:
35 | 36 | A.1. Add more scientific papers - pubmed and scihub (pubmed was included in Pile-V1 though)
37 | A.2. Add more science and engineering literature from libgen, OCR-ed if necessary. Some of available books don't need OCR and could be quickly included with a pipeline similar to 5. ("Books")
38 | A.3. Add DM-math from Pile-V1
39 | A.4. Add more code from github - code modeling seems to help LMs.
40 | A.5. Add more dialogue data, including chat logs
41 | A.6. Add tokens with reasoning chains like in [Galactica](https://arxiv.org/abs/2211.09085) (requires external source of valid reasoning)
42 | A.7 (by popular demand) Add fanfic, ao3 and other fictional content from Pile-V1 - could be solved by mixing with Pile-V1 at train time
43 | 44 | ## Additional technical details 45 | 46 | ### Tokenization 47 | 48 | LLAMA used custom pretrained SentencePiece tokenizer with numbers tokenized as lists of digits. 49 | 50 | ### Context width 51 | 52 | Not specifically a dataset parameter, but judging from the [source code](https://github.com/facebookresearch/llama/blob/1076b9c51c77ad06e9d7ba8a4c6df775741732bd/llama/model.py) LLAMA might have used 1024 context length. This needs more checking, if true this is directly compatible with RWKV. 53 | -------------------------------------------------------------------------------- /preprocess_data.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, EleutherAI 2 | # This file is based on code by the authors denoted below and has been modified from its original version. 3 | # 4 | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Processing data for pretraining.""" 19 | 20 | import argparse 21 | import multiprocessing 22 | import os 23 | import sys 24 | 25 | import lm_dataformat as lmd 26 | import numpy as np 27 | 28 | sys.path.append( 29 | os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) 30 | ) 31 | import time 32 | import tqdm 33 | import torch 34 | import ftfy 35 | 36 | from megatron.tokenizer import build_tokenizer 37 | from megatron.data import indexed_dataset 38 | from threading import Semaphore 39 | 40 | 41 | class Encoder(object): 42 | def __init__(self, args): 43 | self.args = args 44 | 45 | def initializer(self): 46 | # Use Encoder class as a container for global data 47 | Encoder.tokenizer = build_tokenizer(self.args) 48 | 49 | def encode(self, text): 50 | if self.args.ftfy: 51 | text = ftfy.fix_text(text) 52 | ids = {} 53 | for key in self.args.jsonl_keys: 54 | doc_ids = [] 55 | text_ids = Encoder.tokenizer.tokenize(text) 56 | if len(text_ids) > 0: 57 | doc_ids.append(text_ids) 58 | if self.args.append_eod: 59 | doc_ids[-1].append(Encoder.tokenizer.eod) 60 | ids[key] = doc_ids 61 | return ids, len(text) 62 | 63 | 64 | def get_args(): 65 | parser = argparse.ArgumentParser() 66 | group = parser.add_argument_group(title="input data") 67 | group.add_argument( 68 | "--input", 69 | type=str, 70 | required=True, 71 | help="Path to input jsonl files or lmd archive(s) - if using multiple archives, put them in a comma separated " 72 | "list", 73 | ) 74 | group.add_argument( 75 | "--jsonl-keys", 76 | nargs="+", 77 | default=["text"], 78 | help="space separate listed of keys to extract from jsonl. Defa", 79 | ) 80 | group.add_argument( 81 | "--num-docs", 82 | default=None, 83 | help="Optional: Number of documents in the input data (if known) for an accurate progress bar.", 84 | type=int, 85 | ) 86 | group = parser.add_argument_group(title="tokenizer") 87 | group.add_argument( 88 | "--tokenizer-type", 89 | type=str, 90 | required=True, 91 | choices=[ 92 | "HFGPT2Tokenizer", 93 | "HFTokenizer", 94 | "GPT2BPETokenizer", 95 | "CharLevelTokenizer", 96 | "TiktokenTokenizer", 97 | ], 98 | help="What type of tokenizer to use.", 99 | ) 100 | group.add_argument( 101 | "--vocab-file", type=str, default=None, help="Path to the vocab file" 102 | ) 103 | group.add_argument( 104 | "--merge-file", 105 | type=str, 106 | default=None, 107 | help="Path to the BPE merge file (if necessary).", 108 | ) 109 | group.add_argument( 110 | "--append-eod", 111 | action="store_true", 112 | help="Append an token to the end of a document.", 113 | ) 114 | group.add_argument("--ftfy", action="store_true", help="Use ftfy to clean text") 115 | group = parser.add_argument_group(title="output data") 116 | group.add_argument( 117 | "--output-prefix", 118 | type=str, 119 | required=True, 120 | help="Path to binary output file without suffix", 121 | ) 122 | group.add_argument( 123 | "--dataset-impl", 124 | type=str, 125 | default="mmap", 126 | choices=["lazy", "cached", "mmap"], 127 | help="Dataset implementation to use. Default: mmap", 128 | ) 129 | 130 | group = parser.add_argument_group(title="runtime") 131 | group.add_argument( 132 | "--workers", type=int, default=1, help="Number of worker processes to launch" 133 | ) 134 | group.add_argument( 135 | "--log-interval", 136 | type=int, 137 | default=100, 138 | help="Interval between progress updates", 139 | ) 140 | args = parser.parse_args() 141 | args.keep_empty = False 142 | 143 | # some default/dummy values for the tokenizer 144 | args.rank = 0 145 | args.make_vocab_size_divisible_by = 128 146 | args.model_parallel_size = 1 147 | 148 | return args 149 | 150 | 151 | def yield_from_files(fnames: list, semaphore): 152 | """ 153 | Iterator over input documents using lm_dataformat. Should be able to handle jsons / texts / 154 | other compressed formats. Also filters out empty documents. 155 | 156 | :param fnames: list of filenames 157 | """ 158 | 159 | def yielder(fname, semaphore): 160 | for f in filter(lambda x: x, lmd.Reader(fname).stream_data()): 161 | semaphore.acquire() 162 | yield f 163 | 164 | for fname in fnames: 165 | semaphore.acquire() 166 | 167 | yield from yielder(fname, semaphore) 168 | 169 | 170 | def main(): 171 | args = get_args() 172 | encoder = Encoder(args) 173 | tokenizer = build_tokenizer(args) 174 | print(f"Vocab size: {tokenizer.vocab_size}") 175 | print(f"Output prefix: {args.output_prefix}") 176 | 177 | # build a semaphore object to stop `yield_from_files` from getting ahead of encoder.encode and 178 | # hence building up memory 179 | semaphore = Semaphore(10000 + args.workers) 180 | 181 | # use multiprocessing to iterate over input documents 182 | fin = yield_from_files(args.input.split(","), semaphore) 183 | 184 | if args.workers > 1: 185 | pool = multiprocessing.Pool(args.workers, initializer=encoder.initializer) 186 | encoded_docs = pool.imap(encoder.encode, fin, chunksize=25) 187 | else: 188 | encoder.initializer() 189 | encoded_docs = (encoder.encode(doc) for doc in fin) 190 | 191 | # make a dataset builder for each key in args.jsonl_keys 192 | # each key will output to a different file beginning with args.output_prefix 193 | output_bin_files = {} 194 | output_idx_files = {} 195 | builders = {} 196 | for key in args.jsonl_keys: 197 | output_bin_files[key] = "{}_{}_{}.bin".format( 198 | args.output_prefix, key, "document" 199 | ) 200 | output_idx_files[key] = "{}_{}_{}.idx".format( 201 | args.output_prefix, key, "document" 202 | ) 203 | builders[key] = indexed_dataset.make_builder( 204 | output_bin_files[key], 205 | impl=args.dataset_impl, 206 | vocab_size=tokenizer.vocab_size, 207 | ) 208 | 209 | # actually do tokenization 210 | proc_start = time.time() 211 | total_bytes_processed = 0 212 | pbar = tqdm.tqdm() 213 | for i, (doc, bytes_processed) in enumerate(encoded_docs, start=1): 214 | total_bytes_processed += bytes_processed 215 | 216 | # release semaphore so `yield_from_files` can add another file to the buffer 217 | semaphore.release() 218 | 219 | # add each tokenized document / sentence 220 | for key, sentences in doc.items(): 221 | for sentence in sentences: 222 | builders[key].add_item(np.array(sentence, dtype=builders[key].dtype)) 223 | # separate with eos token 224 | builders[key].end_document() 225 | 226 | # log progress 227 | if i % args.log_interval == 0: 228 | current = time.time() 229 | elapsed = current - proc_start 230 | mbs = total_bytes_processed / elapsed / 1024 / 1024 231 | pbar.set_description( 232 | f"Processed {i}{'' if args.num_docs is None else '/' + str(args.num_docs)} documents ({i / elapsed} docs/s, {mbs} MB/s)." 233 | ) 234 | if i != 0: 235 | pbar.update(args.log_interval) 236 | 237 | # save output file 238 | for key in args.jsonl_keys: 239 | builders[key].finalize(output_idx_files[key]) 240 | 241 | 242 | if __name__ == "__main__": 243 | main() 244 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------