autorag.nodes.passagereranker.tart package

Submodules

autorag.nodes.passagereranker.tart.modeling_enc_t5 module

class autorag.nodes.passagereranker.tart.modeling_enc_t5.EncT5ForSequenceClassification(config: T5Config, dropout=0.1)[source]

Bases: T5PreTrainedModel

config_class

alias of T5Config

deparallelize()[source]
forward(input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, labels=None, output_attentions=None, output_hidden_states=None, return_dict=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

get_encoder()[source]
get_input_embeddings()[source]

Returns the model’s input embeddings.

Returns:

nn.Module: A torch module mapping vocabulary to hidden states.

parallelize(device_map=None)[source]
set_input_embeddings(new_embeddings)[source]

Fallback setter that handles ~70 % of models in the code‑base.

Order of attempts: 1. self.model.embed_tokens 2. self.embed_tokens 3. delegate to the base model if one exists 4. otherwise raise NotImplementedError so subclasses still can (and

should) override for exotic layouts.

autorag.nodes.passagereranker.tart.tart module

class autorag.nodes.passagereranker.tart.tart.Tart(project_dir: str, *args, **kwargs)[source]

Bases: BasePassageReranker

pure(previous_result: DataFrame, *args, **kwargs)[source]
autorag.nodes.passagereranker.tart.tart.tart_run_model(input_texts, contents_list, model, batch_size: int, tokenizer, device)[source]

autorag.nodes.passagereranker.tart.tokenization_enc_t5 module

class autorag.nodes.passagereranker.tart.tokenization_enc_t5.EncT5Tokenizer(vocab_file, bos_token='<s>', eos_token='</s>', unk_token='<unk>', pad_token='<pad>', extra_ids=100, additional_special_tokens=None, sp_model_kwargs: Dict[str, Any] | None = None, **kwargs)[source]

Bases: T5Tokenizer

build_inputs_with_special_tokens(token_ids_0: List[int], token_ids_1: List[int] | None = None) List[int][source]

Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. A sequence has the following format: - single sequence: <s> X </s> - pair of sequences: <s> A </s> B </s> Args:

token_ids_0 (List[int]):

List of IDs to which the special tokens will be added.

token_ids_1 (List[int], optional):

Optional second list of IDs for sequence pairs.

Returns:

List[int]: List of [input IDs](../glossary#input-ids) with the appropriate special tokens.

create_token_type_ids_from_sequences(token_ids_0: List[int], token_ids_1: List[int] | None = None) List[int][source]

Create a mask from the two sequences passed to be used in a sequence-pair classification task. T5 does not make use of token type ids, therefore a list of zeros is returned. Args:

token_ids_0 (List[int]):

List of IDs.

token_ids_1 (List[int], optional):

Optional second list of IDs for sequence pairs.

Returns:

List[int]: List of zeros.

get_special_tokens_mask(token_ids_0: List[int], token_ids_1: List[int] | None = None, already_has_special_tokens: bool = False) List[int][source]

Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer prepare_for_model method. Args:

token_ids_0 (List[int]):

List of IDs.

token_ids_1 (List[int], optional):

Optional second list of IDs for sequence pairs.

already_has_special_tokens (bool, optional, defaults to False):

Whether or not the token list is already formatted with special tokens for the model.

Returns:

List[int]: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.

Module contents