optimum-rbln 0.1.1__py3-none-any.whl → 0.1.4__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.
- optimum/rbln/__init__.py +2 -0
- optimum/rbln/__version__.py +1 -1
- optimum/rbln/modeling_base.py +3 -3
- optimum/rbln/transformers/__init__.py +2 -0
- optimum/rbln/transformers/models/__init__.py +1 -0
- optimum/rbln/transformers/models/llama/llama_architecture.py +49 -17
- optimum/rbln/transformers/models/llama/llama_architecture_cb.py +759 -0
- optimum/rbln/transformers/models/llama/modeling_llama.py +126 -32
- optimum/rbln/transformers/models/midm/__init__.py +32 -0
- optimum/rbln/transformers/models/midm/hf_hub_cached/configuration_midm.py +22 -0
- optimum/rbln/transformers/models/midm/hf_hub_cached/midm_bitext_tokenization.py +303 -0
- optimum/rbln/transformers/models/midm/hf_hub_cached/modeling_midm.py +1473 -0
- optimum/rbln/transformers/models/midm/hf_hub_cached/rotary_position_embedding.py +98 -0
- optimum/rbln/transformers/models/midm/midm_architecture.py +506 -0
- optimum/rbln/transformers/models/midm/modeling_midm.py +426 -0
- {optimum_rbln-0.1.1.dist-info → optimum_rbln-0.1.4.dist-info}/METADATA +5 -4
- {optimum_rbln-0.1.1.dist-info → optimum_rbln-0.1.4.dist-info}/RECORD +19 -11
- {optimum_rbln-0.1.1.dist-info → optimum_rbln-0.1.4.dist-info}/WHEEL +1 -1
- {optimum_rbln-0.1.1.dist-info → optimum_rbln-0.1.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,426 @@
|
|
1
|
+
# Copyright 2024 Rebellions 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
|
+
|
15
|
+
# Portions of this software are licensed under the Apache License,
|
16
|
+
# Version 2.0. See the NOTICE file distributed with this work for
|
17
|
+
# additional information regarding copyright ownership.
|
18
|
+
|
19
|
+
# All other portions of this software, including proprietary code,
|
20
|
+
# are the intellectual property of Rebellions Inc. and may not be
|
21
|
+
# copied, modified, or distributed without prior written permission
|
22
|
+
# from Rebellions Inc.
|
23
|
+
|
24
|
+
import inspect
|
25
|
+
import logging
|
26
|
+
from pathlib import Path
|
27
|
+
from tempfile import TemporaryDirectory
|
28
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
|
29
|
+
|
30
|
+
import rebel
|
31
|
+
import torch
|
32
|
+
from optimum.exporters import TasksManager
|
33
|
+
from transformers import AutoModelForCausalLM, PretrainedConfig, PreTrainedModel
|
34
|
+
from transformers.modeling_outputs import CausalLMOutputWithCrossAttentions
|
35
|
+
|
36
|
+
from ....modeling_base import RBLNBaseModel
|
37
|
+
from ....modeling_config import DEFAULT_COMPILED_MODEL_NAME, RBLNConfig, RBLNRuntimeConfig
|
38
|
+
from ....utils.runtime_utils import RBLNPytorchRuntime
|
39
|
+
from ....utils.save_utils import maybe_save_preprocessors
|
40
|
+
from ...generation.utils import RBLNGenerationMixin
|
41
|
+
from .hf_hub_cached.modeling_midm import MidmLMHeadModel
|
42
|
+
from .midm_architecture import (
|
43
|
+
MidmLMHeadModelWrapper,
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
logger = logging.getLogger(__name__)
|
48
|
+
|
49
|
+
if TYPE_CHECKING:
|
50
|
+
from transformers import (
|
51
|
+
AutoFeatureExtractor,
|
52
|
+
AutoProcessor,
|
53
|
+
AutoTokenizer,
|
54
|
+
PretrainedConfig,
|
55
|
+
)
|
56
|
+
|
57
|
+
|
58
|
+
class RBLNRuntimeDecoder(RBLNPytorchRuntime):
|
59
|
+
mandatory_members = ["main_input_name"]
|
60
|
+
|
61
|
+
# RBLN_Runtimemodule
|
62
|
+
def forward(
|
63
|
+
self,
|
64
|
+
input_ids: torch.LongTensor = None,
|
65
|
+
attention_mask: torch.LongTensor = None,
|
66
|
+
cache_position: torch.Tensor = None,
|
67
|
+
**kwargs: Dict[str, Any],
|
68
|
+
):
|
69
|
+
logits = super().forward(
|
70
|
+
input_ids=input_ids,
|
71
|
+
attention_mask=attention_mask,
|
72
|
+
cache_position=cache_position,
|
73
|
+
)
|
74
|
+
return logits
|
75
|
+
|
76
|
+
|
77
|
+
class RBLNMidmLMHeadModel(RBLNBaseModel, RBLNGenerationMixin):
|
78
|
+
"""
|
79
|
+
The Midm Model transformer with a language modeling head on top (linear layer with weights tied to the input
|
80
|
+
embeddings).
|
81
|
+
|
82
|
+
This model inherits from [`RBLNBaseModel`]. Check the superclass documentation for the generic methods the
|
83
|
+
library implements for all its model.
|
84
|
+
|
85
|
+
It implements the methods to convert a pre-trained transformers Midm model into a RBLN transformer model by:
|
86
|
+
- transferring the checkpoint weights of the original into an optimized RBLN graph,
|
87
|
+
- compiling the resulting graph using the RBLN compiler.
|
88
|
+
|
89
|
+
"""
|
90
|
+
|
91
|
+
model_type = "rbln_model"
|
92
|
+
auto_model_class = AutoModelForCausalLM
|
93
|
+
main_input_name = "input_ids"
|
94
|
+
|
95
|
+
def __init__(
|
96
|
+
self,
|
97
|
+
models: List[Union[PreTrainedModel, rebel.RBLNCompiledModel]],
|
98
|
+
config: PretrainedConfig = None,
|
99
|
+
preprocessors: Optional[List] = None,
|
100
|
+
rbln_config: Optional[RBLNConfig] = None,
|
101
|
+
rbln_device: Optional[List[int]] = None,
|
102
|
+
rbln_device_map: Optional[Dict[str, int]] = None,
|
103
|
+
**kwargs,
|
104
|
+
):
|
105
|
+
super().__init__(
|
106
|
+
models,
|
107
|
+
config,
|
108
|
+
preprocessors,
|
109
|
+
rbln_config,
|
110
|
+
rbln_device=rbln_device,
|
111
|
+
rbln_device_map=rbln_device_map,
|
112
|
+
**kwargs,
|
113
|
+
)
|
114
|
+
self.batch_size = self.rbln_config.meta["rbln_batch_size"]
|
115
|
+
self.prefill_chunk_size = self.rbln_config.meta["rbln_prefill_chunk_size"]
|
116
|
+
self.max_seq_len = self.rbln_config.meta["rbln_max_seq_len"]
|
117
|
+
|
118
|
+
self.prefill_attention_mask = torch.zeros(
|
119
|
+
self.batch_size, 1, self.prefill_chunk_size, self.max_seq_len, dtype=torch.int64
|
120
|
+
)
|
121
|
+
self.causal_mask = 1 - torch.triu(
|
122
|
+
torch.ones(self.batch_size, 1, self.prefill_chunk_size, self.prefill_chunk_size), diagonal=1
|
123
|
+
)
|
124
|
+
|
125
|
+
self.prefill_decoder = RBLNRuntimeDecoder(runtime=self.runtimes[0], main_input_name="input_ids")
|
126
|
+
self.decoder = RBLNRuntimeDecoder(runtime=self.runtimes[1], main_input_name="input_ids")
|
127
|
+
self.past_cached_length = 0
|
128
|
+
|
129
|
+
def can_generate(self):
|
130
|
+
return True
|
131
|
+
|
132
|
+
def __getattr__(self, __name: str) -> Any:
|
133
|
+
"""This is the key method to implement RBLN-Midm.
|
134
|
+
|
135
|
+
Returns:
|
136
|
+
Any: Midm's corresponding method
|
137
|
+
"""
|
138
|
+
|
139
|
+
def redirect(func):
|
140
|
+
return lambda *pargs, **kwargs: func(self, *pargs, **kwargs)
|
141
|
+
|
142
|
+
val = getattr(MidmLMHeadModel, __name)
|
143
|
+
if isinstance(val, Callable) and "self" in set(inspect.signature(val).parameters):
|
144
|
+
return redirect(val)
|
145
|
+
return val
|
146
|
+
|
147
|
+
def _reorder_cache(self, past_key_values, beam_idx):
|
148
|
+
# TODO(jongho): implement
|
149
|
+
raise NotImplementedError
|
150
|
+
|
151
|
+
@classmethod
|
152
|
+
def _export(
|
153
|
+
cls,
|
154
|
+
model_id: str,
|
155
|
+
config: "PretrainedConfig",
|
156
|
+
use_auth_token: Optional[Union[bool, str]] = None,
|
157
|
+
revision: Optional[str] = None,
|
158
|
+
force_download: bool = False,
|
159
|
+
cache_dir: Optional[str] = None,
|
160
|
+
subfolder: str = "",
|
161
|
+
local_files_only: bool = False,
|
162
|
+
trust_remote_code: bool = False,
|
163
|
+
model_save_dir: Optional[Union[str, Path, TemporaryDirectory]] = None,
|
164
|
+
**kwargs,
|
165
|
+
) -> "RBLNMidmLMHeadModel":
|
166
|
+
|
167
|
+
task = kwargs.pop("task", None)
|
168
|
+
if task is None:
|
169
|
+
task = TasksManager.infer_task_from_model(cls.auto_model_class)
|
170
|
+
|
171
|
+
if model_save_dir is None:
|
172
|
+
save_dir = TemporaryDirectory()
|
173
|
+
save_dir_path = Path(save_dir.name)
|
174
|
+
else:
|
175
|
+
save_dir = model_save_dir
|
176
|
+
if isinstance(save_dir, TemporaryDirectory):
|
177
|
+
save_dir_path = Path(model_save_dir.name)
|
178
|
+
else:
|
179
|
+
save_dir_path = Path(model_save_dir)
|
180
|
+
save_dir_path.mkdir(exist_ok=True)
|
181
|
+
|
182
|
+
def update_configs(kwargs):
|
183
|
+
max_seq_len = kwargs.get("rbln_max_seq_len", None)
|
184
|
+
if max_seq_len is not None:
|
185
|
+
kwargs.update({"max_position_embeddings": max_seq_len})
|
186
|
+
|
187
|
+
kwargs.update(
|
188
|
+
{
|
189
|
+
"torchscript": True,
|
190
|
+
"return_dict": False,
|
191
|
+
"use_cache": True,
|
192
|
+
"torch_dtype": torch.float32,
|
193
|
+
"_attn_implementation": "eager",
|
194
|
+
}
|
195
|
+
)
|
196
|
+
|
197
|
+
return kwargs
|
198
|
+
|
199
|
+
kwargs = update_configs(kwargs)
|
200
|
+
|
201
|
+
rbln_config_kwargs, rbln_constructor_kwargs = cls.pop_rbln_kwargs_from_kwargs(kwargs)
|
202
|
+
|
203
|
+
model: MidmLMHeadModel = TasksManager.get_model_from_task(
|
204
|
+
task=task,
|
205
|
+
model_name_or_path=model_id,
|
206
|
+
subfolder=subfolder,
|
207
|
+
revision=revision,
|
208
|
+
framework="pt",
|
209
|
+
cache_dir=cache_dir,
|
210
|
+
use_auth_token=use_auth_token,
|
211
|
+
local_files_only=local_files_only,
|
212
|
+
force_download=force_download,
|
213
|
+
trust_remote_code=trust_remote_code,
|
214
|
+
ignore_mismatched_sizes=True,
|
215
|
+
**kwargs,
|
216
|
+
)
|
217
|
+
|
218
|
+
if config is None:
|
219
|
+
config = model.config
|
220
|
+
|
221
|
+
config.save_pretrained(save_dir_path)
|
222
|
+
preprocessors = maybe_save_preprocessors(model_id, save_dir_path, src_subfolder=subfolder)
|
223
|
+
|
224
|
+
# Get compilation arguments
|
225
|
+
if rbln_config_kwargs.get("rbln_config", None) is None:
|
226
|
+
rbln_config = cls.get_rbln_config(
|
227
|
+
preprocessors=preprocessors, model_config=model.config, **rbln_config_kwargs
|
228
|
+
)
|
229
|
+
|
230
|
+
def compile_midm():
|
231
|
+
wrapped_decoder = MidmLMHeadModelWrapper(model).eval()
|
232
|
+
prefill_rbln_runtime_config = rbln_config[DEFAULT_COMPILED_MODEL_NAME][0]
|
233
|
+
dec_rbln_runtime_config = rbln_config[DEFAULT_COMPILED_MODEL_NAME][1]
|
234
|
+
|
235
|
+
prefill_example_inputs = prefill_rbln_runtime_config.get_dummy_inputs(fill=0)
|
236
|
+
dec_example_inputs = dec_rbln_runtime_config.get_dummy_inputs(fill=0)
|
237
|
+
|
238
|
+
prefill_scripted_model = torch.jit.trace(wrapped_decoder, prefill_example_inputs)
|
239
|
+
dec_scripted_model = torch.jit.trace(wrapped_decoder, dec_example_inputs)
|
240
|
+
|
241
|
+
prefill_ir = rebel.torchscript_to_ir(
|
242
|
+
prefill_scripted_model,
|
243
|
+
input_names=[v[0] for v in prefill_rbln_runtime_config.input_info],
|
244
|
+
)
|
245
|
+
dec_ir = rebel.torchscript_to_ir(
|
246
|
+
dec_scripted_model,
|
247
|
+
input_names=[v[0] for v in dec_rbln_runtime_config.input_info],
|
248
|
+
)
|
249
|
+
|
250
|
+
connections = [
|
251
|
+
(prefill_ir.outputs[1 + i], prefill_ir.inputs[3 + i]) for i in range(model.config.n_layer * 2)
|
252
|
+
]
|
253
|
+
|
254
|
+
compiled_model = rebel.compile(
|
255
|
+
prefill_ir,
|
256
|
+
dec_ir,
|
257
|
+
connections=connections,
|
258
|
+
fusion=prefill_rbln_runtime_config.fusion,
|
259
|
+
npu=prefill_rbln_runtime_config.npu,
|
260
|
+
tensor_parallel_size=prefill_rbln_runtime_config.tensor_parallel_size,
|
261
|
+
use_weight_sharing=True,
|
262
|
+
)
|
263
|
+
compiled_model.save(save_dir_path / f"{DEFAULT_COMPILED_MODEL_NAME}.rbln")
|
264
|
+
|
265
|
+
compile_midm()
|
266
|
+
|
267
|
+
rbln_config.save(save_dir_path)
|
268
|
+
|
269
|
+
return cls._from_pretrained(
|
270
|
+
model_id=save_dir_path,
|
271
|
+
config=config,
|
272
|
+
model_save_dir=save_dir,
|
273
|
+
**rbln_constructor_kwargs,
|
274
|
+
**kwargs,
|
275
|
+
)
|
276
|
+
|
277
|
+
@classmethod
|
278
|
+
def _get_rbln_config(
|
279
|
+
cls,
|
280
|
+
preprocessors: Union["AutoFeatureExtractor", "AutoProcessor", "AutoTokenizer"],
|
281
|
+
model_config: "PretrainedConfig",
|
282
|
+
rbln_prefill_chunk_size: Optional[int] = 128,
|
283
|
+
rbln_max_seq_len: Optional[int] = None,
|
284
|
+
rbln_batch_size: Optional[int] = None,
|
285
|
+
) -> RBLNConfig:
|
286
|
+
meta = {}
|
287
|
+
if rbln_max_seq_len is None:
|
288
|
+
rbln_max_seq_len = getattr(model_config, "max_position_embeddings", None)
|
289
|
+
|
290
|
+
if rbln_max_seq_len is None:
|
291
|
+
for tokenizer in preprocessors:
|
292
|
+
if hasattr(tokenizer, "model_max_length"):
|
293
|
+
rbln_max_seq_len = tokenizer.model_max_length
|
294
|
+
break
|
295
|
+
if rbln_max_seq_len is None:
|
296
|
+
raise ValueError("`rbln_max_seq_len` should be specified!")
|
297
|
+
|
298
|
+
if rbln_batch_size is None:
|
299
|
+
rbln_batch_size = 1
|
300
|
+
|
301
|
+
meta["rbln_prefill_chunk_size"] = rbln_prefill_chunk_size
|
302
|
+
meta["rbln_max_seq_len"] = rbln_max_seq_len
|
303
|
+
meta["rbln_batch_size"] = rbln_batch_size if rbln_batch_size is not None else 1
|
304
|
+
|
305
|
+
def get_input_info(query_length):
|
306
|
+
input_info = [
|
307
|
+
("input_ids", [rbln_batch_size, query_length], "int64"),
|
308
|
+
("attention_mask", [rbln_batch_size, 1, query_length, rbln_max_seq_len], "int64"),
|
309
|
+
(
|
310
|
+
"cache_position",
|
311
|
+
[],
|
312
|
+
"int32",
|
313
|
+
),
|
314
|
+
]
|
315
|
+
input_info.extend(
|
316
|
+
[
|
317
|
+
(
|
318
|
+
f"past_key_values_{i}",
|
319
|
+
[
|
320
|
+
rbln_batch_size,
|
321
|
+
model_config.n_head,
|
322
|
+
rbln_max_seq_len,
|
323
|
+
model_config.hidden_size // model_config.n_head,
|
324
|
+
],
|
325
|
+
"float32",
|
326
|
+
)
|
327
|
+
for i in range(model_config.n_layer * 2)
|
328
|
+
]
|
329
|
+
)
|
330
|
+
return input_info
|
331
|
+
|
332
|
+
# model input info
|
333
|
+
prefill_input_info = get_input_info(query_length=rbln_prefill_chunk_size)
|
334
|
+
dec_input_info = get_input_info(query_length=1)
|
335
|
+
|
336
|
+
prefill_rbln_runtime_config = RBLNRuntimeConfig(input_info=prefill_input_info)
|
337
|
+
dec_rbln_runtime_config = RBLNRuntimeConfig(input_info=dec_input_info)
|
338
|
+
|
339
|
+
dec_rbln_runtime_config.batch_size = rbln_batch_size
|
340
|
+
|
341
|
+
rbln_config = RBLNConfig.from_rbln_runtime_configs(
|
342
|
+
[prefill_rbln_runtime_config, dec_rbln_runtime_config],
|
343
|
+
_rbln_meta=meta,
|
344
|
+
)
|
345
|
+
|
346
|
+
return rbln_config
|
347
|
+
|
348
|
+
def _create_runtimes(self, rbln_device_map: Dict[str, int]) -> List[rebel.Runtime]:
|
349
|
+
device_val = rbln_device_map[DEFAULT_COMPILED_MODEL_NAME]
|
350
|
+
return [
|
351
|
+
self.compiled_models[0].create_runtime(input_info_index=0, tensor_type="pt", device=device_val),
|
352
|
+
self.compiled_models[0].create_runtime(input_info_index=1, tensor_type="pt", device=device_val),
|
353
|
+
]
|
354
|
+
|
355
|
+
def prepare_inputs_for_generation(self, input_ids, past_key_values=0, attention_mask=None, **kwargs):
|
356
|
+
batch_size, cur_len = input_ids.shape
|
357
|
+
past_cached_length = past_key_values
|
358
|
+
|
359
|
+
if past_cached_length == 0:
|
360
|
+
mod_len = cur_len % self.prefill_chunk_size
|
361
|
+
self.pad_len = self.prefill_chunk_size - mod_len if mod_len > 0 else 0
|
362
|
+
|
363
|
+
prompt_attn_mask = torch.nn.functional.pad(attention_mask, (self.pad_len, 0), value=0)
|
364
|
+
self.prompt_attn_mask = prompt_attn_mask.reshape(batch_size, 1, 1, -1).contiguous()
|
365
|
+
|
366
|
+
input_ids = torch.nn.functional.pad(input_ids, (self.pad_len, 0), value=0)
|
367
|
+
attention_mask = self.prefill_attention_mask.clone()
|
368
|
+
cache_position = torch.tensor(past_cached_length, dtype=torch.int32)
|
369
|
+
|
370
|
+
query_length = cur_len + self.pad_len
|
371
|
+
else:
|
372
|
+
attention_mask = torch.nn.functional.pad(
|
373
|
+
attention_mask, (self.pad_len, self.max_seq_len - cur_len - self.pad_len)
|
374
|
+
)
|
375
|
+
attention_mask = attention_mask.reshape(batch_size, 1, 1, -1).contiguous()
|
376
|
+
cache_position = torch.tensor(past_cached_length, dtype=torch.int32)
|
377
|
+
input_ids = input_ids[:, -1:].contiguous()
|
378
|
+
query_length = 1
|
379
|
+
|
380
|
+
model_inputs = {
|
381
|
+
"input_ids": input_ids,
|
382
|
+
"past_key_values": past_cached_length,
|
383
|
+
"attention_mask": attention_mask,
|
384
|
+
"cache_position": cache_position,
|
385
|
+
"query_length": query_length,
|
386
|
+
}
|
387
|
+
|
388
|
+
return model_inputs
|
389
|
+
|
390
|
+
def forward(
|
391
|
+
self,
|
392
|
+
input_ids: Optional[torch.LongTensor] = None,
|
393
|
+
past_key_values: int = None,
|
394
|
+
attention_mask: Optional[torch.FloatTensor] = None,
|
395
|
+
cache_position: Optional[torch.Tensor] = None,
|
396
|
+
query_length: Optional[torch.Tensor] = None,
|
397
|
+
**kwargs,
|
398
|
+
) -> Union[Tuple, CausalLMOutputWithCrossAttentions]:
|
399
|
+
past_cached_length = past_key_values
|
400
|
+
|
401
|
+
if past_cached_length is not None:
|
402
|
+
past_cached_length += query_length
|
403
|
+
|
404
|
+
if cache_position == 0:
|
405
|
+
for step in range(0, query_length, self.prefill_chunk_size):
|
406
|
+
sliced_input_ids = input_ids[:, step : step + self.prefill_chunk_size]
|
407
|
+
attention_mask[:, :, :, :step] = 1
|
408
|
+
attention_mask[:, :, :, step : step + self.prefill_chunk_size] = self.causal_mask
|
409
|
+
attention_mask[:, :, :, :query_length] *= self.prompt_attn_mask
|
410
|
+
|
411
|
+
output = self.prefill_decoder(
|
412
|
+
input_ids=sliced_input_ids.contiguous(),
|
413
|
+
attention_mask=attention_mask,
|
414
|
+
cache_position=cache_position + step,
|
415
|
+
)
|
416
|
+
cache_position += self.prefill_chunk_size
|
417
|
+
else:
|
418
|
+
output = self.decoder(
|
419
|
+
input_ids=input_ids.contiguous(),
|
420
|
+
attention_mask=attention_mask,
|
421
|
+
cache_position=cache_position,
|
422
|
+
)
|
423
|
+
return CausalLMOutputWithCrossAttentions(logits=output, past_key_values=past_cached_length)
|
424
|
+
|
425
|
+
def __repr__(self):
|
426
|
+
return repr(self.runtimes[0]) + "\n" + repr(self.runtimes[1])
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: optimum-rbln
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.4
|
4
4
|
Summary: Optimum RBLN is the interface between the Hugging Face Transformers and Diffusers libraries and RBLN accelerators.
|
5
5
|
It provides a set of tools enabling easy model loading and inference on single and multiple rbln device settings for different downstream tasks.
|
6
6
|
Keywords: transformers,diffusers,inference,rbln,atom,rebel
|
@@ -20,11 +20,12 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
20
|
Project-URL: Homepage, https://rebellions.ai
|
21
21
|
Project-URL: Documentation, https://docs.rbln.ai
|
22
22
|
Requires-Python: <3.11,>=3.8
|
23
|
-
Requires-Dist: torch
|
23
|
+
Requires-Dist: torch==2.2.1
|
24
24
|
Requires-Dist: optimum>=1.17.1
|
25
25
|
Requires-Dist: accelerate>=0.28.0
|
26
|
-
Requires-Dist: transformers
|
27
|
-
Requires-Dist:
|
26
|
+
Requires-Dist: transformers==4.40.2
|
27
|
+
Requires-Dist: diffusers==0.27.2
|
28
|
+
Requires-Dist: einops>=0.8.0
|
28
29
|
Requires-Dist: diffusers>=0.27.1; extra == "diffusers"
|
29
30
|
Requires-Dist: pytest>=8.1.1; extra == "tests"
|
30
31
|
Requires-Dist: psutil>=5.9.8; extra == "tests"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
optimum/rbln/__init__.py,sha256=
|
2
|
-
optimum/rbln/__version__.py,sha256=
|
1
|
+
optimum/rbln/__init__.py,sha256=J9OmYkTDCm3a4TmmBbOOScMQA23SJFwZzE4InpwKePg,4111
|
2
|
+
optimum/rbln/__version__.py,sha256=K0nJliLE8urvUSONsZC4x-EeWHUpKHvT74DFSIT6PZI,21
|
3
3
|
optimum/rbln/diffusers/__init__.py,sha256=JWeu2ihHKiYD0Uzs9jXbaAq-bA1G86UCMPPx_oiJYFU,2606
|
4
4
|
optimum/rbln/diffusers/models/__init__.py,sha256=aY6Llq_31dZjdB9HPBDvi7sXVtdQT9r11gokXG5ffxA,1139
|
5
5
|
optimum/rbln/diffusers/models/autoencoder_kl.py,sha256=ifgsAoqZE1dOlJv6z7HJv7rp_IJ8KXMEmI_LOg98ITU,12566
|
@@ -20,14 +20,14 @@ optimum/rbln/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_x
|
|
20
20
|
optimum/rbln/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py,sha256=rGJFKMo6aKbJwwLTS-N3fkFUrRXHr-2hWdatiFzySYk,5516
|
21
21
|
optimum/rbln/modeling.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
optimum/rbln/modeling_alias.py,sha256=pyYGME31QaiBaLqnjQq3LwUF1T6dLeb8QLB91gzNsLM,1574
|
23
|
-
optimum/rbln/modeling_base.py,sha256=
|
23
|
+
optimum/rbln/modeling_base.py,sha256=2A6BJKwrGKMJvlPy4fCFP8OUGJ6-wszak1adIuOR8qE,26552
|
24
24
|
optimum/rbln/modeling_config.py,sha256=R0GBd-upavJrpR-2SvfgCCxP7f5Zr0NxIqdKmwBfVCk,6439
|
25
25
|
optimum/rbln/modeling_seq2seq.py,sha256=eLPiUnei0XGFK01JbIsfS03-hJ_5EkazpoBONv65JNI,19549
|
26
|
-
optimum/rbln/transformers/__init__.py,sha256=
|
26
|
+
optimum/rbln/transformers/__init__.py,sha256=loWV0nNu8woMq4WJbV7IbhYZW8VkbBM9uT5THDkW47M,1920
|
27
27
|
optimum/rbln/transformers/generation/__init__.py,sha256=6MmqS9D21ir4dcH6_fq8kRsX1VK3QspSn6Qw83F4ORE,1081
|
28
28
|
optimum/rbln/transformers/generation/streamers.py,sha256=X-dEmL1L_0Oy0QSFj2RNdamb_xbDWLXd-Ms8ckx6OZ4,5778
|
29
29
|
optimum/rbln/transformers/generation/utils.py,sha256=F8gnVYG79kzg_IvQynD-p409E_5loy5VaIXvfi094u0,19464
|
30
|
-
optimum/rbln/transformers/models/__init__.py,sha256=
|
30
|
+
optimum/rbln/transformers/models/__init__.py,sha256=ysQWodX3tHE--R54KGerEmoUHh5IFPiCI4EmXtt1ZIE,1276
|
31
31
|
optimum/rbln/transformers/models/bart/__init__.py,sha256=SGUcpQ_5iLsVxySxtbwhRpmGt7BgVUTxHAjxAjQStdU,1063
|
32
32
|
optimum/rbln/transformers/models/bart/bart_architecture.py,sha256=H8yVoBFa5uMXQv_wYCHKRW6tIIjdD50ho9C0vcMsbSo,14956
|
33
33
|
optimum/rbln/transformers/models/clip/__init__.py,sha256=tbco8qW9QhBe3dtWoKgslLZMsXu9dg_KfJ4IgjvK248,1071
|
@@ -36,8 +36,16 @@ optimum/rbln/transformers/models/gpt2/__init__.py,sha256=jsOKYXUclG9G6cwUTUX4eeK
|
|
36
36
|
optimum/rbln/transformers/models/gpt2/gpt2_architecture.py,sha256=RQ0Y5f7IKQ73onmuIRB-aw379asSR7kfhUPclLHCOkY,10348
|
37
37
|
optimum/rbln/transformers/models/gpt2/modeling_gpt2.py,sha256=UbVUmegs-v2jBUQUYwxIQ50EpT2dHDzBiPXshLHtuCQ,15079
|
38
38
|
optimum/rbln/transformers/models/llama/__init__.py,sha256=5mX-MuKzVBj6WQeVxyPhtvFTv0jeZXAFfg4RZ2nVUh0,1042
|
39
|
-
optimum/rbln/transformers/models/llama/llama_architecture.py,sha256=
|
40
|
-
optimum/rbln/transformers/models/llama/
|
39
|
+
optimum/rbln/transformers/models/llama/llama_architecture.py,sha256=VAJqz1rsS2tEk2ECb7VjPCrrQn3VP29LpsStpoHz6Uk,27123
|
40
|
+
optimum/rbln/transformers/models/llama/llama_architecture_cb.py,sha256=6Ih0rIBuOLAgV7NmW3aOhafAat6x6AGkWqvkKpRf5yc,32664
|
41
|
+
optimum/rbln/transformers/models/llama/modeling_llama.py,sha256=_b_3jE-uxkqE5oAXlRHdDY5m_mTHU3A2AVun3gAo2Bk,21027
|
42
|
+
optimum/rbln/transformers/models/midm/__init__.py,sha256=_6kYchy47frGMZ8uoUspZ9IwrmCBQJ-8kVfXM7xOMew,1249
|
43
|
+
optimum/rbln/transformers/models/midm/hf_hub_cached/configuration_midm.py,sha256=P5JqTTcx56HOccxKbR14ZjA67BI0RNnJycG738JMaJ4,833
|
44
|
+
optimum/rbln/transformers/models/midm/hf_hub_cached/midm_bitext_tokenization.py,sha256=p8U2Owo8KJzOnrI5vAcDkT2DCt3r-05zFDD2m6D4pEg,12835
|
45
|
+
optimum/rbln/transformers/models/midm/hf_hub_cached/modeling_midm.py,sha256=v5M_uQsdRUyPaiWEATv_FHp-2Duq2moyQJKSFVY-k1U,61035
|
46
|
+
optimum/rbln/transformers/models/midm/hf_hub_cached/rotary_position_embedding.py,sha256=5ywaUVKTvqO8GRsHOSXOOGlbiEn-DbGkpJs59_dFb18,4059
|
47
|
+
optimum/rbln/transformers/models/midm/midm_architecture.py,sha256=G3fSKuh9CGZXyjM1UPZ3wQAYDDLJZcRlKmV_NgcyfJE,19138
|
48
|
+
optimum/rbln/transformers/models/midm/modeling_midm.py,sha256=y2qFgBrE11_MT9-a3LdFfmAc_3lEcy0b3YRbYLkdtlQ,16174
|
41
49
|
optimum/rbln/transformers/models/t5/__init__.py,sha256=dK6F1jbBf001h79WZiVdiNZoXm5kOe2fskzhREhu0EE,1057
|
42
50
|
optimum/rbln/transformers/models/t5/t5_architecture.py,sha256=2nFovfOdiJdY9jdAR9BngwPO3d2Oofn9jqVWgZ-YYZ0,18091
|
43
51
|
optimum/rbln/transformers/models/wav2vec2/__init__.py,sha256=mz4cXqG9b0tDpTAw3qYn3FaJuolX601VmKBE3gohLSw,1043
|
@@ -49,7 +57,7 @@ optimum/rbln/utils/__init__.py,sha256=wr7ep1WliFYR0825f7BbHevtT3xhlMSwpDkvAPzShg
|
|
49
57
|
optimum/rbln/utils/import_utils.py,sha256=OL3aBy3XLWj7KDb6VZKBPJWiEcktL4qRxlpQpDBcMRg,1116
|
50
58
|
optimum/rbln/utils/runtime_utils.py,sha256=EzEabg2E18nq2WZRDZWsZ_hgrdgQ7u_NElTMAYpSDvM,2545
|
51
59
|
optimum/rbln/utils/save_utils.py,sha256=eFIPtmiblCJ3MvtxEPxmAR3iuLEUrzpyzwtVotDauhw,3283
|
52
|
-
optimum_rbln-0.1.
|
53
|
-
optimum_rbln-0.1.
|
54
|
-
optimum_rbln-0.1.
|
55
|
-
optimum_rbln-0.1.
|
60
|
+
optimum_rbln-0.1.4.dist-info/METADATA,sha256=dh0AyheyqiCICYYtofJApo2-DDp4W1ymrzay6f2VzVw,6197
|
61
|
+
optimum_rbln-0.1.4.dist-info/WHEEL,sha256=SOP-4bEE0jbVaCHQGVvF08uWxk5rcSsfEybvoQVHlD8,90
|
62
|
+
optimum_rbln-0.1.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
optimum_rbln-0.1.4.dist-info/RECORD,,
|
File without changes
|