fastembed-gpu 0.2.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,298 @@
1
+ from typing import Dict, Optional, Tuple, Union, Iterable, Type, List, Any, Sequence
2
+
3
+ import numpy as np
4
+
5
+ from fastembed.common.onnx_model import OnnxModel, EmbeddingWorker, OnnxProvider
6
+ from fastembed.common.models import normalize
7
+ from fastembed.common.utils import define_cache_dir
8
+ from fastembed.text.text_embedding_base import TextEmbeddingBase
9
+
10
+ supported_onnx_models = [
11
+ {
12
+ "model": "BAAI/bge-base-en",
13
+ "dim": 768,
14
+ "description": "Base English model",
15
+ "size_in_GB": 0.42,
16
+ "sources": {
17
+ "url": "https://storage.googleapis.com/qdrant-fastembed/fast-bge-base-en.tar.gz",
18
+ },
19
+ "model_file": "model_optimized.onnx",
20
+ },
21
+ {
22
+ "model": "BAAI/bge-base-en-v1.5",
23
+ "dim": 768,
24
+ "description": "Base English model, v1.5",
25
+ "size_in_GB": 0.21,
26
+ "sources": {
27
+ "url": "https://storage.googleapis.com/qdrant-fastembed/fast-bge-base-en-v1.5.tar.gz",
28
+ "hf": "qdrant/bge-base-en-v1.5-onnx-q",
29
+ },
30
+ "model_file": "model_optimized.onnx",
31
+ },
32
+ {
33
+ "model": "BAAI/bge-large-en-v1.5",
34
+ "dim": 1024,
35
+ "description": "Large English model, v1.5",
36
+ "size_in_GB": 1.20,
37
+ "sources": {
38
+ "hf": "qdrant/bge-large-en-v1.5-onnx",
39
+ },
40
+ "model_file": "model.onnx",
41
+ },
42
+ {
43
+ "model": "BAAI/bge-small-en",
44
+ "dim": 384,
45
+ "description": "Fast English model",
46
+ "size_in_GB": 0.13,
47
+ "sources": {
48
+ "url": "https://storage.googleapis.com/qdrant-fastembed/BAAI-bge-small-en.tar.gz",
49
+ },
50
+ "model_file": "model_optimized.onnx",
51
+ },
52
+ {
53
+ "model": "BAAI/bge-small-en-v1.5",
54
+ "dim": 384,
55
+ "description": "Fast and Default English model",
56
+ "size_in_GB": 0.067,
57
+ "sources": {
58
+ "hf": "qdrant/bge-small-en-v1.5-onnx-q",
59
+ },
60
+ "model_file": "model_optimized.onnx",
61
+ },
62
+ {
63
+ "model": "BAAI/bge-small-zh-v1.5",
64
+ "dim": 512,
65
+ "description": "Fast and recommended Chinese model",
66
+ "size_in_GB": 0.09,
67
+ "sources": {
68
+ "url": "https://storage.googleapis.com/qdrant-fastembed/fast-bge-small-zh-v1.5.tar.gz",
69
+ },
70
+ "model_file": "model_optimized.onnx",
71
+ },
72
+ {
73
+ "model": "sentence-transformers/all-MiniLM-L6-v2",
74
+ "dim": 384,
75
+ "description": "Sentence Transformer model, MiniLM-L6-v2",
76
+ "size_in_GB": 0.09,
77
+ "sources": {
78
+ "url": "https://storage.googleapis.com/qdrant-fastembed/sentence-transformers-all-MiniLM-L6-v2.tar.gz",
79
+ "hf": "qdrant/all-MiniLM-L6-v2-onnx",
80
+ },
81
+ "model_file": "model.onnx",
82
+ },
83
+ {
84
+ "model": "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
85
+ "dim": 384,
86
+ "description": "Sentence Transformer model, paraphrase-multilingual-MiniLM-L12-v2",
87
+ "size_in_GB": 0.22,
88
+ "sources": {
89
+ "hf": "qdrant/paraphrase-multilingual-MiniLM-L12-v2-onnx-Q",
90
+ },
91
+ "model_file": "model_optimized.onnx",
92
+ },
93
+ {
94
+ "model": "nomic-ai/nomic-embed-text-v1",
95
+ "dim": 768,
96
+ "description": "8192 context length english model",
97
+ "size_in_GB": 0.52,
98
+ "sources": {
99
+ "hf": "nomic-ai/nomic-embed-text-v1",
100
+ },
101
+ "model_file": "onnx/model.onnx",
102
+ },
103
+ {
104
+ "model": "nomic-ai/nomic-embed-text-v1.5",
105
+ "dim": 768,
106
+ "description": "8192 context length english model",
107
+ "size_in_GB": 0.52,
108
+ "sources": {
109
+ "hf": "nomic-ai/nomic-embed-text-v1.5",
110
+ },
111
+ "model_file": "onnx/model.onnx",
112
+ },
113
+ {
114
+ "model": "nomic-ai/nomic-embed-text-v1.5-Q",
115
+ "dim": 768,
116
+ "description": "Quantized 8192 context length english model",
117
+ "size_in_GB": 0.13,
118
+ "sources": {
119
+ "hf": "nomic-ai/nomic-embed-text-v1.5",
120
+ },
121
+ "model_file": "onnx/model_quantized.onnx",
122
+ },
123
+ {
124
+ "model": "thenlper/gte-large",
125
+ "dim": 1024,
126
+ "description": "Large general text embeddings model",
127
+ "size_in_GB": 1.20,
128
+ "sources": {
129
+ "hf": "qdrant/gte-large-onnx",
130
+ },
131
+ "model_file": "model.onnx",
132
+ },
133
+ {
134
+ "model": "mixedbread-ai/mxbai-embed-large-v1",
135
+ "dim": 1024,
136
+ "description": "MixedBread Base sentence embedding model, does well on MTEB",
137
+ "size_in_GB": 0.64,
138
+ "sources": {
139
+ "hf": "mixedbread-ai/mxbai-embed-large-v1",
140
+ },
141
+ "model_file": "onnx/model.onnx",
142
+ },
143
+ {
144
+ "model": "snowflake/snowflake-arctic-embed-xs",
145
+ "dim": 384,
146
+ "description": "Based on all-MiniLM-L6-v2 model with only 22m parameters, ideal for latency/TCO budgets.",
147
+ "size_in_GB": 0.09,
148
+ "sources": {
149
+ "hf": "snowflake/snowflake-arctic-embed-xs",
150
+ },
151
+ "model_file": "onnx/model.onnx",
152
+ },
153
+ {
154
+ "model": "snowflake/snowflake-arctic-embed-s",
155
+ "dim": 384,
156
+ "description": "Based on infloat/e5-small-unsupervised, does not trade off retrieval accuracy for its small size.",
157
+ "size_in_GB": 0.13,
158
+ "sources": {
159
+ "hf": "snowflake/snowflake-arctic-embed-s",
160
+ },
161
+ "model_file": "onnx/model.onnx",
162
+ },
163
+ {
164
+ "model": "snowflake/snowflake-arctic-embed-m",
165
+ "dim": 768,
166
+ "description": "Based on intfloat/e5-base-unsupervised model, provides the best retrieval without slowing down inference.",
167
+ "size_in_GB": 0.43,
168
+ "sources": {
169
+ "hf": "Snowflake/snowflake-arctic-embed-m",
170
+ },
171
+ "model_file": "onnx/model.onnx",
172
+ },
173
+ {
174
+ "model": "snowflake/snowflake-arctic-embed-m-long",
175
+ "dim": 768,
176
+ "description": "Based on nomic-ai/nomic-embed-text-v1-unsupervised model, 8192 context-length model",
177
+ "size_in_GB": 0.54,
178
+ "sources": {
179
+ "hf": "snowflake/snowflake-arctic-embed-m-long",
180
+ },
181
+ "model_file": "onnx/model.onnx",
182
+ },
183
+ {
184
+ "model": "snowflake/snowflake-arctic-embed-l",
185
+ "dim": 1024,
186
+ "description": "Based on intfloat/e5-large-unsupervised, large model for most accurate retrieval.",
187
+ "size_in_GB": 1.02,
188
+ "sources": {
189
+ "hf": "snowflake/snowflake-arctic-embed-l",
190
+ },
191
+ "model_file": "onnx/model.onnx",
192
+ },
193
+ ]
194
+
195
+
196
+ class OnnxTextEmbedding(TextEmbeddingBase, OnnxModel[np.ndarray]):
197
+ """Implementation of the Flag Embedding model."""
198
+
199
+ @classmethod
200
+ def list_supported_models(cls) -> List[Dict[str, Any]]:
201
+ """
202
+ Lists the supported models.
203
+
204
+ Returns:
205
+ List[Dict[str, Any]]: A list of dictionaries containing the model information.
206
+ """
207
+ return supported_onnx_models
208
+
209
+ def __init__(
210
+ self,
211
+ model_name: str = "BAAI/bge-small-en-v1.5",
212
+ cache_dir: Optional[str] = None,
213
+ threads: Optional[int] = None,
214
+ providers: Optional[Sequence[OnnxProvider]] = None,
215
+ **kwargs,
216
+ ):
217
+ """
218
+ Args:
219
+ model_name (str): The name of the model to use.
220
+ cache_dir (str, optional): The path to the cache directory.
221
+ Can be set using the `FASTEMBED_CACHE_PATH` env variable.
222
+ Defaults to `fastembed_cache` in the system's temp directory.
223
+ threads (int, optional): The number of threads single onnxruntime session can use. Defaults to None.
224
+
225
+ Raises:
226
+ ValueError: If the model_name is not in the format <org>/<model> e.g. BAAI/bge-base-en.
227
+ """
228
+
229
+ super().__init__(model_name, cache_dir, threads, **kwargs)
230
+
231
+ model_description = self._get_model_description(model_name)
232
+ cache_dir = define_cache_dir(cache_dir)
233
+ model_dir = self.download_model(
234
+ model_description, cache_dir, local_files_only=self._local_files_only
235
+ )
236
+
237
+ self.load_onnx_model(
238
+ model_dir=model_dir,
239
+ model_file=model_description["model_file"],
240
+ threads=threads,
241
+ providers=providers,
242
+ )
243
+
244
+ def embed(
245
+ self,
246
+ documents: Union[str, Iterable[str]],
247
+ batch_size: int = 256,
248
+ parallel: Optional[int] = None,
249
+ **kwargs,
250
+ ) -> Iterable[np.ndarray]:
251
+ """
252
+ Encode a list of documents into list of embeddings.
253
+ We use mean pooling with attention so that the model can handle variable-length inputs.
254
+
255
+ Args:
256
+ documents: Iterator of documents or single document to embed
257
+ batch_size: Batch size for encoding -- higher values will use more memory, but be faster
258
+ parallel:
259
+ If > 1, data-parallel encoding will be used, recommended for offline encoding of large datasets.
260
+ If 0, use all available cores.
261
+ If None, don't use data-parallel processing, use default onnxruntime threading instead.
262
+
263
+ Returns:
264
+ List of embeddings, one per document
265
+ """
266
+ yield from self._embed_documents(
267
+ model_name=self.model_name,
268
+ cache_dir=str(self.cache_dir),
269
+ documents=documents,
270
+ batch_size=batch_size,
271
+ parallel=parallel,
272
+ )
273
+
274
+ @classmethod
275
+ def _get_worker_class(cls) -> Type["EmbeddingWorker"]:
276
+ return OnnxTextEmbeddingWorker
277
+
278
+ def _preprocess_onnx_input(self, onnx_input: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]:
279
+ """
280
+ Preprocess the onnx input.
281
+ """
282
+ return onnx_input
283
+
284
+ @classmethod
285
+ def _post_process_onnx_output(
286
+ cls, output: Tuple[np.ndarray, np.ndarray]
287
+ ) -> Iterable[np.ndarray]:
288
+ embeddings, _ = output
289
+ return normalize(embeddings[:, 0]).astype(np.float32)
290
+
291
+
292
+ class OnnxTextEmbeddingWorker(EmbeddingWorker):
293
+ def init_embedding(
294
+ self,
295
+ model_name: str,
296
+ cache_dir: str,
297
+ ) -> OnnxTextEmbedding:
298
+ return OnnxTextEmbedding(model_name=model_name, cache_dir=cache_dir, threads=1)
@@ -0,0 +1,93 @@
1
+ from typing import Any, Dict, Iterable, List, Optional, Type, Union, Sequence
2
+
3
+ import numpy as np
4
+
5
+ from fastembed.common import OnnxProvider
6
+ from fastembed.text.e5_onnx_embedding import E5OnnxEmbedding
7
+ from fastembed.text.jina_onnx_embedding import JinaOnnxEmbedding
8
+ from fastembed.text.onnx_embedding import OnnxTextEmbedding
9
+ from fastembed.text.text_embedding_base import TextEmbeddingBase
10
+
11
+
12
+ class TextEmbedding(TextEmbeddingBase):
13
+ EMBEDDINGS_REGISTRY: List[Type[TextEmbeddingBase]] = [
14
+ OnnxTextEmbedding,
15
+ E5OnnxEmbedding,
16
+ JinaOnnxEmbedding,
17
+ ]
18
+
19
+ @classmethod
20
+ def list_supported_models(cls) -> List[Dict[str, Any]]:
21
+ """
22
+ Lists the supported models.
23
+
24
+ Returns:
25
+ List[Dict[str, Any]]: A list of dictionaries containing the model information.
26
+
27
+ Example:
28
+ ```
29
+ [
30
+ {
31
+ "model": "intfloat/multilingual-e5-large",
32
+ "dim": 1024,
33
+ "description": "Multilingual model, e5-large. Recommend using this model for non-English languages",
34
+ "size_in_GB": 2.24,
35
+ "sources": {
36
+ "gcp": "https://storage.googleapis.com/qdrant-fastembed/fast-multilingual-e5-large.tar.gz",
37
+ "hf": "qdrant/multilingual-e5-large-onnx",
38
+ }
39
+ }
40
+ ]
41
+ ```
42
+ """
43
+ result = []
44
+ for embedding in cls.EMBEDDINGS_REGISTRY:
45
+ result.extend(embedding.list_supported_models())
46
+ return result
47
+
48
+ def __init__(
49
+ self,
50
+ model_name: str = "BAAI/bge-small-en-v1.5",
51
+ cache_dir: Optional[str] = None,
52
+ threads: Optional[int] = None,
53
+ providers: Optional[Sequence[OnnxProvider]] = None,
54
+ **kwargs,
55
+ ):
56
+ super().__init__(model_name, cache_dir, threads, **kwargs)
57
+
58
+ for EMBEDDING_MODEL_TYPE in self.EMBEDDINGS_REGISTRY:
59
+ supported_models = EMBEDDING_MODEL_TYPE.list_supported_models()
60
+ if any(model_name.lower() == model["model"].lower() for model in supported_models):
61
+ self.model = EMBEDDING_MODEL_TYPE(
62
+ model_name, cache_dir, threads, providers=providers, **kwargs
63
+ )
64
+ return
65
+
66
+ raise ValueError(
67
+ f"Model {model_name} is not supported in TextEmbedding."
68
+ "Please check the supported models using `TextEmbedding.list_supported_models()`"
69
+ )
70
+
71
+ def embed(
72
+ self,
73
+ documents: Union[str, Iterable[str]],
74
+ batch_size: int = 256,
75
+ parallel: Optional[int] = None,
76
+ **kwargs,
77
+ ) -> Iterable[np.ndarray]:
78
+ """
79
+ Encode a list of documents into list of embeddings.
80
+ We use mean pooling with attention so that the model can handle variable-length inputs.
81
+
82
+ Args:
83
+ documents: Iterator of documents or single document to embed
84
+ batch_size: Batch size for encoding -- higher values will use more memory, but be faster
85
+ parallel:
86
+ If > 1, data-parallel encoding will be used, recommended for offline encoding of large datasets.
87
+ If 0, use all available cores.
88
+ If None, don't use data-parallel processing, use default onnxruntime threading instead.
89
+
90
+ Returns:
91
+ List of embeddings, one per document
92
+ """
93
+ yield from self.model.embed(documents, batch_size, parallel, **kwargs)
@@ -0,0 +1,60 @@
1
+ from typing import Iterable, Optional, Union
2
+
3
+ import numpy as np
4
+
5
+ from fastembed.common.model_management import ModelManagement
6
+
7
+
8
+ class TextEmbeddingBase(ModelManagement):
9
+ def __init__(
10
+ self,
11
+ model_name: str,
12
+ cache_dir: Optional[str] = None,
13
+ threads: Optional[int] = None,
14
+ **kwargs,
15
+ ):
16
+ self.model_name = model_name
17
+ self.cache_dir = cache_dir
18
+ self.threads = threads
19
+ self._local_files_only = kwargs.pop("local_files_only", False)
20
+
21
+ def embed(
22
+ self,
23
+ documents: Union[str, Iterable[str]],
24
+ batch_size: int = 256,
25
+ parallel: Optional[int] = None,
26
+ **kwargs,
27
+ ) -> Iterable[np.ndarray]:
28
+ raise NotImplementedError()
29
+
30
+ def passage_embed(self, texts: Iterable[str], **kwargs) -> Iterable[np.ndarray]:
31
+ """
32
+ Embeds a list of text passages into a list of embeddings.
33
+
34
+ Args:
35
+ texts (Iterable[str]): The list of texts to embed.
36
+ **kwargs: Additional keyword argument to pass to the embed method.
37
+
38
+ Yields:
39
+ Iterable[np.ndarray]: The embeddings.
40
+ """
41
+
42
+ # This is model-specific, so that different models can have specialized implementations
43
+ yield from self.embed(texts, **kwargs)
44
+
45
+ def query_embed(self, query: Union[str, Iterable[str]], **kwargs) -> Iterable[np.ndarray]:
46
+ """
47
+ Embeds queries
48
+
49
+ Args:
50
+ query (Union[str, Iterable[str]]): The query to embed, or an iterable e.g. list of queries.
51
+
52
+ Returns:
53
+ Iterable[np.ndarray]: The embeddings.
54
+ """
55
+
56
+ # This is model-specific, so that different models can have specialized implementations
57
+ if isinstance(query, str):
58
+ yield from self.embed([query], **kwargs)
59
+ if isinstance(query, Iterable):
60
+ yield from self.embed(query, **kwargs)
@@ -0,0 +1,201 @@
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.