xinference 1.6.0.post1__py3-none-any.whl → 1.6.1__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.

Potentially problematic release.


This version of xinference might be problematic. Click here for more details.

Files changed (87) hide show
  1. xinference/_version.py +3 -3
  2. xinference/client/restful/restful_client.py +1 -1
  3. xinference/conftest.py +0 -7
  4. xinference/core/media_interface.py +9 -8
  5. xinference/core/model.py +13 -6
  6. xinference/core/scheduler.py +1 -10
  7. xinference/core/worker.py +0 -10
  8. xinference/model/audio/model_spec.json +53 -1
  9. xinference/model/audio/model_spec_modelscope.json +57 -1
  10. xinference/model/embedding/core.py +19 -11
  11. xinference/model/image/model_spec.json +10 -1
  12. xinference/model/image/model_spec_modelscope.json +20 -0
  13. xinference/model/llm/__init__.py +6 -54
  14. xinference/model/llm/core.py +19 -5
  15. xinference/model/llm/llama_cpp/core.py +59 -3
  16. xinference/model/llm/llama_cpp/memory.py +455 -0
  17. xinference/model/llm/llm_family.json +185 -397
  18. xinference/model/llm/llm_family.py +88 -16
  19. xinference/model/llm/llm_family_modelscope.json +199 -421
  20. xinference/model/llm/llm_family_openmind_hub.json +0 -34
  21. xinference/model/llm/sglang/core.py +4 -0
  22. xinference/model/llm/transformers/__init__.py +27 -6
  23. xinference/model/llm/transformers/chatglm.py +4 -2
  24. xinference/model/llm/transformers/core.py +49 -28
  25. xinference/model/llm/transformers/deepseek_v2.py +6 -49
  26. xinference/model/llm/transformers/gemma3.py +119 -164
  27. xinference/{thirdparty/omnilmm/train → model/llm/transformers/multimodal}/__init__.py +1 -1
  28. xinference/model/llm/transformers/{cogagent.py → multimodal/cogagent.py} +58 -95
  29. xinference/model/llm/transformers/multimodal/core.py +205 -0
  30. xinference/model/llm/transformers/{deepseek_vl2.py → multimodal/deepseek_vl2.py} +59 -120
  31. xinference/model/llm/transformers/multimodal/gemma3.py +117 -0
  32. xinference/model/llm/transformers/{glm4v.py → multimodal/glm4v.py} +57 -93
  33. xinference/model/llm/transformers/multimodal/intern_vl.py +412 -0
  34. xinference/model/llm/transformers/{minicpmv26.py → multimodal/minicpmv26.py} +55 -102
  35. xinference/model/llm/transformers/{ovis2.py → multimodal/ovis2.py} +114 -175
  36. xinference/model/llm/transformers/{qwen-omni.py → multimodal/qwen-omni.py} +82 -167
  37. xinference/model/llm/transformers/multimodal/qwen2_audio.py +131 -0
  38. xinference/model/llm/transformers/{qwen2_vl.py → multimodal/qwen2_vl.py} +224 -256
  39. xinference/model/llm/transformers/opt.py +4 -2
  40. xinference/model/llm/transformers/utils.py +6 -37
  41. xinference/model/llm/vllm/core.py +4 -0
  42. xinference/model/rerank/core.py +7 -1
  43. xinference/model/rerank/utils.py +17 -0
  44. xinference/web/ui/build/asset-manifest.json +3 -3
  45. xinference/web/ui/build/index.html +1 -1
  46. xinference/web/ui/build/static/js/main.ddf9eaee.js +3 -0
  47. xinference/web/ui/build/static/js/main.ddf9eaee.js.map +1 -0
  48. xinference/web/ui/node_modules/.cache/babel-loader/12e637ed5fa9ca6491b03892b6949c03afd4960fe36ac25744488e7e1982aa19.json +1 -0
  49. xinference/web/ui/node_modules/.cache/babel-loader/567e49df411efb24425d289bb484758cb57067ca54f8b5c67fe4505f698deb96.json +1 -0
  50. xinference/web/ui/node_modules/.cache/babel-loader/77ac2665a784e99501ae95d32ef5937837a0439a47e965d291b38e99cb619f5b.json +1 -0
  51. xinference/web/ui/node_modules/.cache/babel-loader/d4ed4e82bfe69915999ec83f5feaa4301c75ecc6bdf1c78f2d03e4671ecbefc8.json +1 -0
  52. xinference/web/ui/src/locales/en.json +3 -1
  53. xinference/web/ui/src/locales/zh.json +3 -1
  54. {xinference-1.6.0.post1.dist-info → xinference-1.6.1.dist-info}/METADATA +6 -4
  55. {xinference-1.6.0.post1.dist-info → xinference-1.6.1.dist-info}/RECORD +60 -76
  56. {xinference-1.6.0.post1.dist-info → xinference-1.6.1.dist-info}/WHEEL +1 -1
  57. xinference/model/llm/transformers/cogvlm2.py +0 -442
  58. xinference/model/llm/transformers/cogvlm2_video.py +0 -333
  59. xinference/model/llm/transformers/deepseek_vl.py +0 -280
  60. xinference/model/llm/transformers/glm_edge_v.py +0 -213
  61. xinference/model/llm/transformers/intern_vl.py +0 -526
  62. xinference/model/llm/transformers/internlm2.py +0 -94
  63. xinference/model/llm/transformers/minicpmv25.py +0 -193
  64. xinference/model/llm/transformers/omnilmm.py +0 -132
  65. xinference/model/llm/transformers/qwen2_audio.py +0 -179
  66. xinference/model/llm/transformers/qwen_vl.py +0 -360
  67. xinference/thirdparty/omnilmm/LICENSE +0 -201
  68. xinference/thirdparty/omnilmm/__init__.py +0 -0
  69. xinference/thirdparty/omnilmm/chat.py +0 -218
  70. xinference/thirdparty/omnilmm/constants.py +0 -4
  71. xinference/thirdparty/omnilmm/conversation.py +0 -332
  72. xinference/thirdparty/omnilmm/model/__init__.py +0 -1
  73. xinference/thirdparty/omnilmm/model/omnilmm.py +0 -595
  74. xinference/thirdparty/omnilmm/model/resampler.py +0 -166
  75. xinference/thirdparty/omnilmm/model/utils.py +0 -578
  76. xinference/thirdparty/omnilmm/train/train_utils.py +0 -150
  77. xinference/thirdparty/omnilmm/utils.py +0 -134
  78. xinference/web/ui/build/static/js/main.ae579a97.js +0 -3
  79. xinference/web/ui/build/static/js/main.ae579a97.js.map +0 -1
  80. xinference/web/ui/node_modules/.cache/babel-loader/2fdc61dcb6a9d1fbcb44be592d0e87d8c3f21297a7327559ef5345665f8343f7.json +0 -1
  81. xinference/web/ui/node_modules/.cache/babel-loader/3d596a3e8dd6430d7ce81d164e32c31f8d47cfa5f725c328a298754d78563e14.json +0 -1
  82. xinference/web/ui/node_modules/.cache/babel-loader/5c08e2cd07809ed3e41486b16652253404cbb63a3ff8d0366ee50f57e2413cea.json +0 -1
  83. xinference/web/ui/node_modules/.cache/babel-loader/8472e58a31720892d534f3febda31f746b25ec4aa60787eef34217b074e67965.json +0 -1
  84. /xinference/web/ui/build/static/js/{main.ae579a97.js.LICENSE.txt → main.ddf9eaee.js.LICENSE.txt} +0 -0
  85. {xinference-1.6.0.post1.dist-info → xinference-1.6.1.dist-info}/entry_points.txt +0 -0
  86. {xinference-1.6.0.post1.dist-info → xinference-1.6.1.dist-info}/licenses/LICENSE +0 -0
  87. {xinference-1.6.0.post1.dist-info → xinference-1.6.1.dist-info}/top_level.txt +0 -0
@@ -1,360 +0,0 @@
1
- # Copyright 2022-2023 XProbe Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- import base64
15
- import logging
16
- import operator
17
- import tempfile
18
- import typing
19
- import uuid
20
- from typing import Dict, Iterator, List, Optional, Tuple, Union
21
-
22
- import torch
23
- from transformers import PreTrainedTokenizer
24
-
25
- from ....core.scheduler import InferenceRequest
26
- from ....model.utils import select_device
27
- from ....types import ChatCompletion, ChatCompletionChunk, CompletionChunk
28
- from ..llm_family import LLMFamilyV1, LLMSpecV1
29
- from ..utils import generate_chat_completion, generate_completion_chunk
30
- from .core import PytorchChatModel, PytorchGenerateConfig
31
- from .utils import cache_clean, pad_prefill_tokens
32
-
33
- logger = logging.getLogger(__name__)
34
-
35
-
36
- class QwenVLChatModel(PytorchChatModel):
37
- def __init__(self, *args, **kwargs):
38
- super().__init__(*args, **kwargs)
39
- self._tokenizer = None
40
- self._model = None
41
- self._device = None
42
-
43
- @classmethod
44
- def match_json(
45
- cls, model_family: "LLMFamilyV1", model_spec: "LLMSpecV1", quantization: str
46
- ) -> bool:
47
- llm_family = model_family.model_family or model_family.model_name
48
- if "qwen-" in llm_family and "vision" in model_family.model_ability:
49
- return True
50
- return False
51
-
52
- def load(self):
53
- from transformers import AutoModelForCausalLM, AutoTokenizer
54
- from transformers.generation import GenerationConfig
55
-
56
- if self._check_tensorizer_integrity():
57
- self._model, self._tokenizer = self._load_tensorizer(
58
- code_revision=self.model_spec.model_revision
59
- )
60
- self._apply_lora()
61
- return
62
-
63
- device = self._pytorch_model_config.get("device", "auto")
64
- device = select_device(device)
65
- self._device = device
66
- # for multiple GPU, set back to auto to make multiple devices work
67
- device = "auto" if device == "cuda" else device
68
-
69
- kwargs = self.apply_bnb_quantization()
70
-
71
- self._tokenizer = AutoTokenizer.from_pretrained(
72
- self.model_path,
73
- trust_remote_code=True,
74
- code_revision=self.model_spec.model_revision,
75
- )
76
- self._model = AutoModelForCausalLM.from_pretrained(
77
- self.model_path,
78
- device_map=device,
79
- trust_remote_code=True,
80
- code_revision=self.model_spec.model_revision,
81
- **kwargs,
82
- ).eval()
83
-
84
- # Specify hyperparameters for generation
85
- self._model.generation_config = GenerationConfig.from_pretrained(
86
- self.model_path,
87
- trust_remote_code=True,
88
- code_revision=self.model_spec.model_revision,
89
- )
90
- self._apply_lora()
91
- self._save_tensorizer(code_revision=self.model_spec.model_revision)
92
-
93
- def _message_content_to_qwen(self, content) -> str:
94
- def _ensure_url(_url):
95
- if _url.startswith("data:"):
96
- logging.info("Parse url by base64 decoder.")
97
- # https://platform.openai.com/docs/guides/vision/uploading-base-64-encoded-images
98
- # e.g. f"data:image/jpeg;base64,{base64_image}"
99
- _type, data = _url.split(";")
100
- _, ext = _type.split("/")
101
- data = data[len("base64,") :]
102
- data = base64.b64decode(data.encode("utf-8"))
103
-
104
- with tempfile.NamedTemporaryFile(suffix=f".{ext}", delete=False) as f:
105
- f.write(data)
106
- logging.info("Dump base64 data to %s", f.name)
107
- return f.name
108
- else:
109
- if len(_url) > 2048:
110
- raise Exception(f"Image url is too long, {len(_url)} > 2048.")
111
- return _url
112
-
113
- if not isinstance(content, str):
114
- # TODO(codingl2k1): Optimize _ensure_url
115
- content = [
116
- (
117
- {"image": _ensure_url(c["image_url"]["url"]), "type": "image"}
118
- if c.get("type") == "image_url"
119
- else c
120
- )
121
- for c in content
122
- ]
123
- content = sorted(content, key=operator.itemgetter("type"))
124
- return self._tokenizer.from_list_format(content)
125
- return content
126
-
127
- def _get_prompt_and_chat_history(self, messages: List[Dict]):
128
- qwen_history = []
129
- query_to_response: List = []
130
- for message in messages[:-1]:
131
- role = message["role"]
132
- content = self._message_content_to_qwen(message["content"])
133
- if len(query_to_response) == 0 and role == "user":
134
- query_to_response.append(content)
135
- if len(query_to_response) == 1 and role == "assistant":
136
- query_to_response.append(content)
137
- if len(query_to_response) == 2:
138
- qwen_history.append(query_to_response)
139
- query_to_response = []
140
- prompt = self._message_content_to_qwen(messages[-1]["content"])
141
- return prompt, qwen_history
142
-
143
- @cache_clean
144
- def chat(
145
- self,
146
- messages: List[Dict],
147
- generate_config: Optional[PytorchGenerateConfig] = None,
148
- ) -> Union[ChatCompletion, Iterator[ChatCompletionChunk]]:
149
- prompt, qwen_history = self._get_prompt_and_chat_history(messages)
150
-
151
- stream = generate_config.get("stream", False) if generate_config else False
152
- stream_options = (
153
- generate_config.pop("stream_options", None) if generate_config else None
154
- )
155
- include_usage = (
156
- stream_options["include_usage"]
157
- if isinstance(stream_options, dict)
158
- else False
159
- )
160
- if stream:
161
- it = self._generate_stream(prompt, qwen_history, include_usage) # type: ignore
162
- return self._to_chat_completion_chunks(it)
163
- else:
164
- return self._generate(prompt, qwen_history) # type: ignore
165
-
166
- def _generate(self, prompt: str, qwen_history: List) -> ChatCompletion:
167
- response, history = self._model.chat(
168
- self._tokenizer, query=prompt, history=qwen_history
169
- )
170
- return generate_chat_completion(self.model_uid, response)
171
-
172
- def _generate_stream(
173
- self, prompt: str, qwen_history: List, include_usage
174
- ) -> Iterator[CompletionChunk]:
175
- response_generator = self._model.chat_stream(
176
- self._tokenizer, query=prompt, history=qwen_history
177
- )
178
- completion_id = str(uuid.uuid1())
179
- prompt_tokens, completion_tokens, total_tokens = 0, 0, 0
180
- input_ids = self._tokenizer(prompt, allowed_special="all").input_ids
181
- prompt_tokens = len(input_ids)
182
- full_response = ""
183
- for response in response_generator:
184
- inc_content = response[len(full_response) :]
185
- full_response = response
186
- completion_tokens = completion_tokens + 1
187
- total_tokens = prompt_tokens + completion_tokens
188
- yield generate_completion_chunk(
189
- chunk_text=inc_content,
190
- finish_reason=None,
191
- chunk_id=completion_id,
192
- model_uid=self.model_uid,
193
- prompt_tokens=prompt_tokens,
194
- completion_tokens=completion_tokens,
195
- total_tokens=total_tokens,
196
- )
197
- yield generate_completion_chunk(
198
- chunk_text=None,
199
- finish_reason="stop",
200
- chunk_id=completion_id,
201
- model_uid=self.model_uid,
202
- prompt_tokens=prompt_tokens,
203
- completion_tokens=completion_tokens,
204
- total_tokens=total_tokens,
205
- has_choice=True,
206
- has_content=False,
207
- )
208
- if include_usage:
209
- yield generate_completion_chunk(
210
- chunk_text=None,
211
- finish_reason=None,
212
- chunk_id=completion_id,
213
- model_uid=self.model_uid,
214
- prompt_tokens=prompt_tokens,
215
- completion_tokens=completion_tokens,
216
- total_tokens=total_tokens,
217
- has_choice=False,
218
- has_content=False,
219
- )
220
-
221
- @staticmethod
222
- def get_batch_size_and_seq_len_indexes_from_kv() -> Tuple[int, int]:
223
- """
224
- Qwen-vl is very special for its kv_cache impl.
225
- Its dimension is `bs * seq_len * head_num * dim`.
226
- See https://huggingface.co/Qwen/Qwen-VL-Chat/blob/main/modeling_qwen.py
227
- """
228
- return 0, 1
229
-
230
- @staticmethod
231
- @typing.no_type_check
232
- def make_context(
233
- tokenizer: PreTrainedTokenizer,
234
- query: str,
235
- history: List[Tuple[str, str]] = None,
236
- system: str = "",
237
- max_window_size: int = 6144,
238
- chat_format: str = "chatml",
239
- ):
240
- """
241
- This function is from https://huggingface.co/Qwen/Qwen-VL-Chat/blob/main/qwen_generation_utils.py.
242
- Use this function to get input_ids with image.
243
- """
244
- if history is None:
245
- history = []
246
-
247
- if chat_format == "chatml":
248
- im_start, im_end = "<|im_start|>", "<|im_end|>"
249
- im_start_tokens = [tokenizer.im_start_id]
250
- im_end_tokens = [tokenizer.im_end_id]
251
- nl_tokens = tokenizer.encode("\n")
252
-
253
- def _tokenize_str(role, content):
254
- return f"{role}\n{content}", tokenizer.encode(
255
- role, allowed_special=set(tokenizer.IMAGE_ST)
256
- ) + nl_tokens + tokenizer.encode(
257
- content, allowed_special=set(tokenizer.IMAGE_ST)
258
- )
259
-
260
- system_text, system_tokens_part = _tokenize_str("system", system)
261
- system_tokens = im_start_tokens + system_tokens_part + im_end_tokens
262
-
263
- raw_text = ""
264
- context_tokens = []
265
-
266
- for turn_query, turn_response in reversed(history):
267
- query_text, query_tokens_part = _tokenize_str("user", turn_query)
268
- query_tokens = im_start_tokens + query_tokens_part + im_end_tokens
269
- if turn_response is not None:
270
- response_text, response_tokens_part = _tokenize_str(
271
- "assistant", turn_response
272
- )
273
- response_tokens = (
274
- im_start_tokens + response_tokens_part + im_end_tokens
275
- )
276
-
277
- next_context_tokens = (
278
- nl_tokens + query_tokens + nl_tokens + response_tokens
279
- )
280
- prev_chat = f"\n{im_start}{query_text}{im_end}\n{im_start}{response_text}{im_end}"
281
- else:
282
- next_context_tokens = nl_tokens + query_tokens + nl_tokens
283
- prev_chat = f"\n{im_start}{query_text}{im_end}\n"
284
-
285
- current_context_size = (
286
- len(system_tokens) + len(next_context_tokens) + len(context_tokens)
287
- )
288
- if current_context_size < max_window_size:
289
- context_tokens = next_context_tokens + context_tokens
290
- raw_text = prev_chat + raw_text
291
- else:
292
- break
293
-
294
- context_tokens = system_tokens + context_tokens
295
- raw_text = f"{im_start}{system_text}{im_end}" + raw_text
296
- context_tokens += (
297
- nl_tokens
298
- + im_start_tokens
299
- + _tokenize_str("user", query)[1]
300
- + im_end_tokens
301
- + nl_tokens
302
- + im_start_tokens
303
- + tokenizer.encode("assistant")
304
- + nl_tokens
305
- )
306
- raw_text += f"\n{im_start}user\n{query}{im_end}\n{im_start}assistant\n"
307
-
308
- elif chat_format == "raw":
309
- raw_text = query
310
- context_tokens = tokenizer.encode(raw_text)
311
- else:
312
- raise NotImplementedError(f"Unknown chat format {chat_format!r}")
313
-
314
- return raw_text, context_tokens
315
-
316
- def _get_full_prompt(self, messages: List[Dict], tools, generate_config: dict): # type: ignore
317
- prompt, qwen_history = self._get_prompt_and_chat_history(messages)
318
- _, context_tokens = self.make_context(self._tokenizer, prompt, qwen_history)
319
- return context_tokens
320
-
321
- def prepare_sanitize_generate_config(self, req: InferenceRequest):
322
- """
323
- Refer to https://huggingface.co/Qwen/Qwen-VL-Chat/blob/main/generation_config.json
324
- """
325
- raw_config = req.inference_kwargs.get("raw_params", {})
326
- top_p = raw_config.get("top_p", None)
327
- if top_p is None:
328
- raw_config["top_p"] = 0.3
329
- top_k = raw_config.get("top_k", None)
330
- if top_k is None:
331
- raw_config["top_k"] = 0
332
- return raw_config
333
-
334
- def build_prefill_inputs(self, prompts: List, req_list: List[InferenceRequest]):
335
- context_len = self.get_context_len()
336
- inputs = pad_prefill_tokens(prompts, context_len, req_list)
337
- input_ids = torch.as_tensor(
338
- pad_prefill_tokens(inputs, context_len, req_list), device=self._device
339
- )
340
- return input_ids
341
-
342
- def build_prefill_position_ids(
343
- self, batch_size: int, seq_length: int, reqs: List[InferenceRequest]
344
- ):
345
- """
346
- Qwen-vl fill `1` for position_ids padding
347
- """
348
- res = []
349
- for r in reqs:
350
- real_seq_len = seq_length - r.padding_len
351
- res.append(
352
- torch.cat(
353
- [
354
- torch.full((r.padding_len,), 1, dtype=torch.long),
355
- torch.arange(0, real_seq_len, dtype=torch.long),
356
- ]
357
- )
358
- )
359
- r.extra_kwargs["max_position_id"] = real_seq_len - 1
360
- return torch.stack(res).to(self._device)
@@ -1,201 +0,0 @@
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 2024 OpenBMB
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.
File without changes