LightningIRConfig
- class lightning_ir.base.config.LightningIRConfig(*args, query_length: int = 32, doc_length: int = 512, **kwargs)[source]
Bases:
object
The configuration class to instantiate a LightningIR model. Acts as a mixin for the transformers.PretrainedConfig class.
- __init__(*args, query_length: int = 32, doc_length: int = 512, **kwargs)[source]
Initializes the configuration.
- Parameters:
query_length (int, optional) – Maximum query length, defaults to 32
doc_length (int, optional) – Maximum document length, defaults to 512
Methods
__init__
(*args[, query_length, doc_length])Initializes the configuration.
from_dict
(config_dict, *args, **kwargs)Loads the configuration from a dictionary.
from_pretrained
(...)Outputs a dictionary of the added arguments.
to_dict
()Overrides the transformers.PretrainedConfig.to_dict method to include the added arguments and the backbone model type.
Outputs a dictionary of the tokenizer arguments.
Attributes
Arguments added to the configuration.
Arguments for the tokenizer.
Backbone model type for the configuration.
Model type for the configuration.
- backbone_model_type: str | None = None
Backbone model type for the configuration. Set by
LightningIRModelClassFactory()
.
- classmethod from_dict(config_dict: Dict[str, Any], *args, **kwargs) LightningIRConfig [source]
Loads the configuration from a dictionary. Wraps the transformers.PretrainedConfig.from_dict method to return a derived LightningIRConfig class. See
LightningIRConfigClassFactory
for more details.- Parameters:
config_dict (Dict[str, Any]) – Configuration dictionary
- Raises:
ValueError – If the model type does not match the configuration model type
- Returns:
Derived LightningIRConfig class
- Return type:
- to_added_args_dict() Dict[str, Any] [source]
Outputs a dictionary of the added arguments.
- Returns:
Added arguments
- Return type:
Dict[str, Any]
- to_dict() Dict[str, Any] [source]
Overrides the transformers.PretrainedConfig.to_dict method to include the added arguments and the backbone model type.
- Returns:
Configuration dictionary
- Return type:
Dict[str, Any]
- to_tokenizer_dict() Dict[str, Any] [source]
Outputs a dictionary of the tokenizer arguments.
- Returns:
Tokenizer arguments
- Return type:
Dict[str, Any]