Huggingface
HuggingFace Trainer Mixin
            HuggingFaceTrainerProtocol
¶
    
              Bases: Protocol
Source code in src/fed_rag/trainers/huggingface/mixin.py
                
              
            HuggingFaceTrainerMixin
¶
    
              Bases: BaseModel, ABC
HuggingFace Trainer Mixin.
Source code in src/fed_rag/trainers/huggingface/mixin.py
                HuggingFace LM-Supervised Retriever Trainer
            HuggingFaceTrainerForLSR
¶
    
              Bases: HuggingFaceTrainerMixin, BaseRetrieverTrainer
HuggingFace LM-Supervised Retriever Trainer.
Source code in src/fed_rag/trainers/huggingface/lsr.py
                
            LSRSentenceTransformerTrainer
¶
    
              Bases: SentenceTransformerTrainer
Source code in src/fed_rag/trainers/huggingface/lsr.py
                
            compute_loss
¶
    Compute LSR loss.
NOTE: the forward pass of the model is taken care of in the DataCollatorForLSR.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                model
             | 
            
                  SentenceTransformer
             | 
            
               description  | 
            required | 
                inputs
             | 
            
                  dict[str, Tensor | Any]
             | 
            
               description  | 
            required | 
                return_outputs
             | 
            
                  bool
             | 
            
               description. Defaults to False.  | 
            
                  False
             | 
          
                num_items_in_batch
             | 
            
                  Any | None
             | 
            
               description. Defaults to None.  | 
            
                  None
             | 
          
Raises:
| Type | Description | 
|---|---|
                  NotImplementedError
             | 
            
               description  | 
          
Returns:
| Type | Description | 
|---|---|
                  Tensor | tuple[Tensor, dict[str, Any]]
             | 
            
               torch.Tensor | tuple[torch.Tensor, dict[str, Any]]: description  | 
          
Source code in src/fed_rag/trainers/huggingface/lsr.py
              HuggingFace Retrieval-Augmented Generator Trainer
            HuggingFaceTrainerForRALT
¶
    
              Bases: HuggingFaceTrainerMixin, BaseGeneratorTrainer
HuggingFace Trainer for Retrieval-Augmented LM Training/Fine-Tuning.