Auto Classes¶
Auto Classes는 이름이나 경로를 기반으로 비슷한 트랜스포머 모델(가중치, 설정, 어휘 등)을 자동으로 불러옵니다. 이를 통해 사용자는 정확한 모델 아키텍처를 알지 못해도 모델을 쉽게 불러올 수 있습니다.
주요 클래스¶
RBLNAutoConfig
: 오토 모델을 위한 설정 클래스RBLNAutoModel
: RBLN NPU를 사용하여 지원하는 트랜스포머 모델을 실행하기 위한 클래스RBLNAutoModelForCTC
: RBLN NPU를 사용하여 연결주의 시간 분류 (Connectionist Temporal Classification, CTC) 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForCausalLM
: RBLN NPU를 사용하여 인과적 자연어 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForSeq2SeqLM
: RBLN NPU를 사용하여 시퀀스에서 시퀀스를 생성하는 자연어 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForDepthEstimation
: RBLN NPU를 사용하여 시퀀스에서 깊이를 추정하는 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForSequenceClassification
: RBLN NPU를 사용하여 시퀀스 분류 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForSpeechSeq2Seq
: RBLN NPU를 사용하여 음성 시퀀스에서 시퀀스를 생성하는 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForVision2Seq
: RBLN NPU를 사용하여 이미지에서 시퀀스를 생성하는 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForImageTextToText
: RBLN NPU를 사용하여 이미지 및 문자에서 문자를 생성하는 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForMaskedLM
: RBLN NPU를 사용하여 마스킹 자연어 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForAudioClassification
: RBLN NPU를 사용하여 오디오 분류 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForImageClassification
: RBLN NPU를 사용하여 이미지 분류 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForQuestionAnswering
: RBLN NPU를 사용하여 질문-답변 모델을 실행하기 위한 오토 모델 클래스RBLNAutoModelForTextEncoding
: RBLN NPU에서 문자 인코딩을 실행하기 위한 오토 모델 클래스RBLNAutoModelForZeroShotObjectDetection
: RBLN NPU에서 제로샷 객체 탐지를 실행하기 위한 오토 모델 클래스
커스텀 클래스 등록¶
AutoClass
에는 커스텀 클래스를 추가하여 기능을 확장할 수 있는 register()
메서드가 있습니다. 예를 들어, RBLNMistralNeMoForTextUpsampler
라는 커스텀 모델과 그 설정 클래스인 RBLNMistralNeMoForTextUpsamplerConfig
를 만들었다면, 이들을 AutoClass
에 추가하여 자동으로 불러올 수 있습니다.
- 컴파일
- 추론
지원되는 모델¶
- 연결 시계열 분류 (CTC)
Model | Model Architecture | AutoClass |
---|---|---|
Wav2Vec2 | Wav2Vec2ForCTC | RBLNAutoModelForCTC |
- 인과 언어 모델 (CausalLM)
Model | Model Architecture | AutoClass |
---|---|---|
DeepSeek-R1-Distill-Llama-8b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
DeepSeek-R1-Distill-Llama-70b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
DeepSeek-R1-Distill-Qwen-1.5b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
DeepSeek-R1-Distill-Qwen-7b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
DeepSeek-R1-Distill-Qwen-14b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
DeepSeek-R1-Distill-Qwen-32b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Llama3.3-70b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama3.2-3b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama3.1-70b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama3.1-8b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama3-8b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama3-8b + LoRA | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama2-7b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Llama2-13b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Phi-2 | PhiForCausalLM | RBLNAutoModelForCausalLM |
Gemma-7b | GemmaForCausalLM | RBLNAutoModelForCausalLM |
Gemma-2b | GemmaForCausalLM | RBLNAutoModelForCausalLM |
OPT-2.7b | OPTForCausalLM | RBLNAutoModelForCausalLM |
Mistral-7b | MistralForCausalLM | RBLNAutoModelForCausalLM |
A.X-4.0-Light | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2-7b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-0.5b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-1.5b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-3b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-7b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-14b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-32b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen2.5-72b | Qwen2ForCausalLM | RBLNAutoModelForCausalLM |
Qwen3-0.6b | Qwen3ForCausalLM | RBLNAutoModelForCausalLM |
Qwen3-1.7b | Qwen3ForCausalLM | RBLNAutoModelForCausalLM |
Qwen3-4b | Qwen3ForCausalLM | RBLNAutoModelForCausalLM |
Qwen3-8b | Qwen3ForCausalLM | RBLNAutoModelForCausalLM |
Qwen3-32b | Qwen3ForCausalLM | RBLNAutoModelForCausalLM |
Midm-2.0-Mini | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Midm-2.0-Base | LlamaForCausalLM | RBLNAutoModelForCausalLM |
Salamandra-7b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
KONI-Llama3.1-8b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
EXAONE-3.0-7.8b | ExaoneForCausalLM | RBLNAutoModelForCausalLM |
EXAONE-3.5-2.4b | ExaoneForCausalLM | RBLNAutoModelForCausalLM |
EXAONE-3.5-7.8b | ExaoneForCausalLM | RBLNAutoModelForCausalLM |
EXAONE-3.5-32b | ExaoneForCausalLM | RBLNAutoModelForCausalLM |
GPT2 | GPT2LMHeadModel | RBLNAutoModelForCausalLM |
GPT2-medium | GPT2LMHeadModel | RBLNAutoModelForCausalLM |
GPT2-large | GPT2LMHeadModel | RBLNAutoModelForCausalLM |
GPT2-xl | GPT2LMHeadModel | RBLNAutoModelForCausalLM |
OPT-6.7b | OPTForCausalLM | RBLNAutoModelForCausalLM |
SOLAR-10.7b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
EEVE-Korean-10.8b | LlamaForCausalLM | RBLNAutoModelForCausalLM |
- 시퀀스-투-시퀀스 언어 모델 (Seq2SeqLM)
Model | Model Architecture | AutoClass |
---|---|---|
T5-11b | T5ForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
T5-small | T5ForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
T5-base | T5ForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
T5-large | T5ForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
T5-3b | T5ForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
BART-base | BartForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
BART-large | BartForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
KoBART-base | BartForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
Pegasus | PegasusForConditionalGeneration | RBLNAutoModelForSeq2SeqLM |
- 깊이 추정 (DepthEstimation)
Model | Model Architecture | AutoClass |
---|---|---|
Depth-Anything-V2-Small | DepthAnythingForDepthEstimation | RBLNAutoModelForDepthEstimation |
Depth-Anything-V2-Base | DepthAnythingForDepthEstimation | RBLNAutoModelForDepthEstimation |
Depth-Anything-V2-Large | DepthAnythingForDepthEstimation | RBLNAutoModelForDepthEstimation |
DPT-large | DPTForDepthEstimation | RBLNAutoModelForDepthEstimation |
- 시퀀스 분류 (SequenceClassification)
Model | Model Architecture | AutoClass |
---|---|---|
RoBERTa | RobertaForSequenceClassification | RBLNAutoModelForSequenceClassification |
BGE-Reranker-V2-M3 | XLMRobertaForSequenceClassification | RBLNAutoModelForSequenceClassification |
BGE-Reranker-Base | XLMRobertaForSequenceClassification | RBLNAutoModelForSequenceClassification |
BGE-Reranker-Large | XLMRobertaForSequenceClassification | RBLNAutoModelForSequenceClassification |
Ko-Reranker | XLMRobertaForSequenceClassification | RBLNAutoModelForSequenceClassification |
- 음성 시퀀스에서 시퀀스 생성 (SpeechSeq2Seq)
Model | Model Architecture | AutoClass |
---|---|---|
Whisper-tiny | WhisperForConditionalGeneration | RBLNAutoModelForSpeechSeq2Seq |
Whisper-base | WhisperForConditionalGeneration | RBLNAutoModelForSpeechSeq2Seq |
Whisper-small | WhisperForConditionalGeneration | RBLNAutoModelForSpeechSeq2Seq |
Whisper-medium | WhisperForConditionalGeneration | RBLNAutoModelForSpeechSeq2Seq |
Whisper-large-v3 | WhisperForConditionalGeneration | RBLNAutoModelForSpeechSeq2Seq |
Whisper-large-v3-turbo | WhisperForConditionalGeneration | RBLNAutoModelForSpeechSeq2Seq |
- 이미지에서 시퀀스 생성 (Vision2Seq)
Model | Model Architecture | AutoClass |
---|---|---|
Qwen2-VL-7b | Qwen2VLForConditionalGeneration | RBLNAutoModelForVision2Seq |
Qwen2.5-VL-7b | Qwen2_5_VLForConditionalGeneration | RBLNAutoModelForVision2Seq |
Idefics3-8B-Llama3 | Idefics3ForConditionalGeneration | RBLNAutoModelForVision2Seq |
Llava-v1.5-7b | LlavaForConditionalGeneration | RBLNAutoModelForVision2Seq |
Llava-v1.6-mistral-7b | LlavaNextForConditionalGeneration | RBLNAutoModelForVision2Seq |
Pixtral-12b | LlavaForConditionalGeneration | RBLNAutoModelForVision2Seq |
BLIP2-6.7b | RBLNBlip2ForConditionalGeneration | RBLNAutoModelForVision2Seq |
BLIP2-2.7b | RBLNBlip2ForConditionalGeneration | RBLNAutoModelForVision2Seq |
- 이미지 및 문자에서 문자 생성 (ImageTextToText)
Model | Model Architecture | AutoClass |
---|---|---|
Gemma3-4b | Gemma3ForConditionalGeneration | RBLNAutoModelForImageTextToText |
Gemma3-12b | Gemma3ForConditionalGeneration | RBLNAutoModelForImageTextToText |
Gemma3-27b | Gemma3ForConditionalGeneration | RBLNAutoModelForImageTextToText |
Qwen2-VL-7b | Qwen2VLForConditionalGeneration | RBLNAutoModelForImageTextToText |
Qwen2.5-VL-7b | Qwen2_5_VLForConditionalGeneration | RBLNAutoModelForImageTextToText |
Idefics3-8B-Llama3 | Idefics3ForConditionalGeneration | RBLNAutoModelForImageTextToText |
Llava-v1.5-7b | LlavaForConditionalGeneration | RBLNAutoModelForImageTextToText |
Llava-v1.6-mistral-7b | LlavaNextForConditionalGeneration | RBLNAutoModelForImageTextToText |
Pixtral-12b | LlavaForConditionalGeneration | RBLNAutoModelForImageTextToText |
BLIP2-6.7b | RBLNBlip2ForConditionalGeneration | RBLNAutoModelForImageTextToText |
BLIP2-2.7b | RBLNBlip2ForConditionalGeneration | RBLNAutoModelForImageTextToText |
- 마스킹 자연어 모델 (MaskedLM)
Model | Model Architecture | AutoClass |
---|---|---|
BERT-base | BertForMaskedLM | RBLNAutoModelForMaskedLM |
BERT-large | BertForMaskedLM | RBLNAutoModelForMaskedLM |
SecureBERT | RobertaForMaskedLM | RBLNAutoModelForMaskedLM |
- 음성 분류 (AudioClassification)
Model | Model Architecture | AutoClass |
---|---|---|
Audio-Spectogram-Transformer | ASTForAudioClassification | RBLNAutoModelForAudioClassification |
- 이미지 분류 (ImageClassification)
Model | Model Architecture | AutoClass |
---|---|---|
ViT-large | ViTForImageClassification | RBLNAutoModelForImageClassification |
ResNet50 | ResNetForImageClassification | RBLNAutoModelForImageClassification |
- 질문-답변 (QuestionAnswering)
Model | Model Architecture | AutoClass |
---|---|---|
BERT-base | BertForQuestionAnswering | RBLNAutoModelForQuestionAnswering |
BERT-large | BertForQuestionAnswering | RBLNAutoModelForQuestionAnswering |
- 문자 인코딩 (TextEncoding)
Model | Model Architecture | AutoClass |
---|---|---|
T5-Enc-11b | T5EncoderModel | RBLNAutoModelForTextEncoding |
Qwen3-Embedding-4b | Qwen3Model | RBLNAutoModelForTextEncoding |
Qwen3-Embedding-0.6b | Qwen3Model | RBLNAutoModelForTextEncoding |
E5-base-4K | BertModel | RBLNAutoModelForTextEncoding |
KR-SBERT-V40K-klueNLI-augSTS | BertModel | RBLNAutoModelForTextEncoding |
BGE-Small-EN-v1.5 | RBLNBertModel | RBLNAutoModelForTextEncoding |
BGE-Large-EN-v1.5 | RBLNBertModel | RBLNAutoModelForTextEncoding |
BGE-M3/Dense-Embedding | XLMRobertaModel | RBLNAutoModelForTextEncoding |
BGE-M3/Multi-Vector | XLMRobertaModel | RBLNAutoModelForTextEncoding |
BGE-M3/Sparse-Embedding | XLMRobertaModel | RBLNAutoModelForTextEncoding |
- 제로샷 객체 탐지 (Zero-Shot Object Detection)
Model | Model Architecture | AutoClass |
---|---|---|
GroundingDino-Tiny | GroundingDinoForObjectDetection | RBLNAutoModelForZeroShotObjectDetection |
GroundingDino-Base | GroundingDinoForObjectDetection | RBLNAutoModelForZeroShotObjectDetection |
API 참조¶
Classes¶
RBLNAutoConfig
¶
Resolver and factory for RBLN model configurations.
This class selects the concrete RBLNModelConfig
subclass, validates the
provided data, and returns a frozen configuration object that serves as the
single source of truth during export and load. It does not define the schema
or control model behavior.
Functions¶
register(config, exist_ok=False)
staticmethod
¶
Register a new configuration for this class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
RBLNModelConfig
|
The config to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
load(path, passed_rbln_config=None, kwargs={}, return_unused_kwargs=False)
staticmethod
¶
Load RBLNModelConfig from a path.
Class name is automatically inferred from the rbln_config.json
file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to the RBLNModelConfig. |
required |
passed_rbln_config
|
Optional[RBLNModelConfig]
|
RBLNModelConfig to pass its runtime options. |
None
|
Returns:
Name | Type | Description |
---|---|---|
RBLNModelConfig |
Union[RBLNModelConfig, Tuple[RBLNModelConfig, Dict[str, Any]]]
|
The loaded RBLNModelConfig. |
Classes¶
RBLNAutoModel
¶
Bases: _BaseAutoModelClass
Automatically detect all supported transformers models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForCTC
¶
Bases: _BaseAutoModelClass
Automatically detect Connectionist Temporal Classification (CTC) head Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForCausalLM
¶
Bases: _BaseAutoModelClass
Automatically detect Casual Language Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForSeq2SeqLM
¶
Bases: _BaseAutoModelClass
Automatically detect Sequence to Sequence Language Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForSpeechSeq2Seq
¶
Bases: _BaseAutoModelClass
Automatically detect Sequence to Sequence Generation Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForDepthEstimation
¶
Bases: _BaseAutoModelClass
Automatically detect Speech Sequence to Sequence Language Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForSequenceClassification
¶
Bases: _BaseAutoModelClass
Automatically detect Sequence Classification Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForVision2Seq
¶
Bases: _BaseAutoModelClass
Automatically detect Vision to Sequence Generation Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForImageTextToText
¶
Bases: _BaseAutoModelClass
Automatically detect Image and Text to Text Generation Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForMaskedLM
¶
Bases: _BaseAutoModelClass
Automatically detect Masked Lanuage Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForAudioClassification
¶
Bases: _BaseAutoModelClass
Automatically detect Audio Classification Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForImageClassification
¶
Bases: _BaseAutoModelClass
Automatically detect Image Classification Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForQuestionAnswering
¶
Bases: _BaseAutoModelClass
Automatically detect Question Answering Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForTextEncoding
¶
Bases: _BaseAutoModelClass
Automatically detect Text Encoding Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoModelForZeroShotObjectDetection
¶
Bases: _BaseAutoModelClass
Automatically detect Zero Shot Object Detection Models.
Functions¶
from_pretrained(model_id, export=None, rbln_config=None, **kwargs)
classmethod
¶
Load an RBLN-accelerated model from a pretrained checkpoint or a compiled RBLN artifact.
This convenience method determines the concrete RBLN*
model class that matches the
underlying HuggingFace architecture and dispatches to that class's
from_pretrained()
implementation. Depending on whether a compiled RBLN folder is
detected (or if export=True
is passed), it will either:
- Compile from a HuggingFace checkpoint to an RBLN model
- Or load an already-compiled RBLN model directory/repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
Union[str, Path]
|
HF repo id or local path. For compiled models, this should point to a directory
(optionally under |
required |
export
|
bool
|
Force compilation from a HuggingFace checkpoint. When |
None
|
rbln_config
|
Optional[Union[Dict, RBLNModelConfig]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an
instance of the specific model's config class (e.g., |
None
|
kwargs
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
An instantiated RBLN model ready for inference on RBLN NPUs. |
from_model(model, config=None, rbln_config=None, **kwargs)
classmethod
¶
Convert and compile an in-memory HuggingFace model into an RBLN model.
This method resolves the appropriate concrete RBLN*
class from the input model's class
name (e.g., LlamaForCausalLM
-> RBLNLlamaForCausalLM
) and then delegates to that
class's from_model()
implementation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
PreTrainedModel
|
A HuggingFace model instance to convert. |
required |
config
|
Optional[PretrainedConfig]
|
The configuration object associated with the model. |
None
|
rbln_config
|
Optional[Union[RBLNModelConfig, Dict]]
|
RBLN compilation/runtime configuration. May be provided as a dictionary or as an instance of the specific model's config class. |
None
|
kwargs
|
Any
|
Additional keyword arguments.
- Arguments prefixed with |
{}
|
Returns:
Type | Description |
---|---|
RBLNBaseModel
|
An instantiated RBLN model ready for inference on RBLN NPUs. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|