Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ContextualAI/HALOs
/ functions
Functions
162 in github.com/ContextualAI/HALOs
⨍
Functions
162
◇
Types & classes
29
Method
__iter__
(self)
train/dataloader.py:288
Method
__iter__
(self)
train/dataloader.py:382
Method
__iter__
(self)
train/dataloader.py:519
Method
__iter__
(self)
train/dataloader.py:712
Method
__iter__
(self)
train/data.py:128
Method
__len__
(self)
train/data.py:125
Method
__setattr__
Set prompt ID automatically.
train/data.py:52
Method
__setitem__
(self, key, value)
train/data.py:116
Method
clean
(text: str)
train/data.py:95
Function
clip_by_value
Tensor extenstion to torch.clamp https://github.com/pytorch/pytorch/issues/2793#issuecomment-428784713
train/utils.py:131
Function
delete_dict
Delete all items inside the dict.
train/utils.py:200
Function
disable_dropout
Disable dropout in a model.
train/utils.py:193
Method
forward
(self, hidden_states)
train/models.py:231
Method
forward
r""" Applies a forward pass to the wrapped model and returns the logits of the value head. Args: input_ids (`torch.LongTe
train/models.py:317
Method
from_pretrained
(cls, load_from, *args, **kwargs)
train/models.py:414
Method
from_pretrained
Overrides from_pretrained to ensure num_labels=2. Args: pretrained_model_name_or_path: Either: -
train/models.py:557
Function
get_alpacaeval
Load the AlpacaEval dataset (for evaluation only) and convert it into a Dataset. Args: - split: must be 'test'; otherwise error will
train/data.py:132
Method
get_batch_metrics
Compute the loss and other metrics for the given batch of inputs. Args: batch: dictionary of inputs for the batch (should
train/trainers.py:555
Method
get_batch_metrics
Compute the loss and other metrics for the given batch of inputs.
train/trainers.py:615
Method
get_batch_metrics
Compute the loss and other metrics for the given batch of inputs.
train/trainers.py:713
Method
get_batch_metrics
Compute the loss and other metrics for the given batch of inputs.
train/trainers.py:962
Method
get_batch_metrics
Compute the loss and other metrics for the given batch of inputs.
train/trainers.py:1060
Method
get_batch_metrics
Compute metrics for a batch of examples. Args: batch: The input batch mode: Either 'train' or 'eval'
train/trainers.py:1605
Function
get_feedback
Load feedback data created by label.py and convert it into a Dataset. Supports both binary and pairwise feedback formats. Args:
train/data.py:191
Method
get_flat_data
(self, prompts)
train/dataloader.py:280
Method
get_flat_data
Return a flat list of examples given a list of prompts that index self.full_data. Prepend the examples with the appropriate control t
train/dataloader.py:363
Method
get_flat_data
Return a flat list of examples given a list of prompts that index self.full_data.
train/dataloader.py:468
Method
get_flat_data
Return a flat list of examples given a list of prompts that index self.full_data. Assumes that there are a list of scores.
train/dataloader.py:634
Method
get_flat_data
Return a flat list of examples given a list of prompts that index self.full_data. Only use one preference pair per input.
train/dataloader.py:665
Method
get_flat_data
Return a flat list of examples given a list of prompts.
train/dataloader.py:695
Function
get_hh_harmless
(split: str)
train/data.py:396
Function
get_hh_helpful
(split: str)
train/data.py:392
Method
get_num_training_steps
Get the number of training steps.
train/dataloader.py:337
Method
get_num_training_steps
(self)
train/dataloader.py:437
Method
get_num_training_steps
(self)
train/dataloader.py:576
Method
get_num_training_steps
(self)
train/dataloader.py:751
Function
get_oasst
Load the Open Assistant dataset from Huggingface and convert it into to a Dataset. For this dataset, the SFT text is the preferred response.
train/data.py:400
Method
get_process_data
Return the subset of data to be processed in the current process. Examples sharing the same prompt ID will appear consecutively, in
train/dataloader.py:597
Method
get_reward_scores
Get reward scores from reward model. Args: batch: Dictionary containing batch data Returns:
train/trainers.py:224
Function
get_s1k_11
Load the Ultrafeedback (binarized) dataset from Huggingface and convert it into to a Dataset. For this dataset, the SFT text is the preferred
train/data.py:592
Function
get_safe_rlhf
Load the PKU-Alignment PKU-SafeRLHF dataset from Huggingface and convert it into to a Dataset. For this dataset, the SFT text is the preferre
train/data.py:627
Function
get_sampled_data
Load samples generated by train.sample and convert it into a Dataset.
train/data.py:165
Function
get_shp
Load the Stanford Human Preferences dataset from Huggingface and convert it into to a Dataset. We filter preference pairs to only keep pairs
train/data.py:287
Function
get_ultrabin
Load the Ultrafeedback (binarized) dataset from Huggingface and convert it into to a Dataset. For this dataset, the SFT text is the preferred
train/data.py:464
Function
get_ultrachat
(split: str)
train/data.py:573
Function
get_ultrafeedback_armorm
(split: str)
train/data.py:513
Function
get_ultrafeedback_armorm_gemma
(split: str)
train/data.py:543
Function
get_wildbench
Load the AllenAI WildBench dataset from Huggingface and convert it into to a Dataset. For this dataset, the SFT text is the preferred respons
train/data.py:666
Method
loss
Args: batch: batch of data, mapping keys to Tensors policy_chosen_logps: Log probabilities of the policy model for th
train/trainers.py:190
Method
loss
Compute the CDPO loss for a batch of policy and reference model token-level log probabilities.
train/trainers.py:768
Method
loss
Compute the IPO loss for a batch of policy and reference model token-level log probabilities.
train/trainers.py:791
Method
loss
Compute the SimPO loss for a batch of policy and reference model token-level log probabilities.
train/trainers.py:809
Method
loss
Compute the SLIC loss as defined by Zhao et al. in https://arxiv.org/pdf/2305.10425.pdf Calibration loss defined as: L(x, y) := m
train/trainers.py:827
Method
post_init
r""" We add the state dictionary of the value head to the state dictionary of the wrapped model by prepending the key with `v_head.`.
train/models.py:391
Method
prepare_accelerator
Prepare the Accelerator.
train/trainers.py:1110
Function
print_gpu_memory
Print the amount of GPU memory currently allocated for each GPU.
train/utils.py:213
Method
push_to_hub
(self, *args, **kwargs)
train/models.py:387
Method
save_pretrained
Save a model and its configuration file to a directory. Ensures the config maintains num_labels=2 and padding token configuration whe
train/models.py:593
Method
state_dict
r""" Returns the state dictionary of the model. We add the state dictionary of the value head to the state dictionary of the wrapped m
train/models.py:375
Method
train
Begin either SFT or HALO training, with periodic evaluation. This is subclassed when implementing PPO.
train/trainers.py:312
Method
update_batch
Args: batch: the original offline batch completions: the online generations from the updated reference model (after s
train/trainers.py:513
Method
weights_init
(m)
train/models.py:310
← previous
101–162 of 162, ranked by callers