Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/AMAP-ML/EMF
/ functions
Functions
947 in github.com/AMAP-ML/EMF
⨍
Functions
947
◇
Types & classes
184
↳
Endpoints
9
↓ 3 callers
Method
log
Log `logs` on the various objects watching training, including stored metrics. Args: logs (`dict[str, float]`):
trl/trl/trainer/dpo_trainer.py:1901
↓ 3 callers
Method
null_ref_context
Context manager for handling null reference model (that is, peft adapter manipulation).
trl/trl/trainer/kto_trainer.py:810
↓ 3 callers
Method
null_ref_context
Context manager for handling null reference model (that is, peft adapter manipulation).
trl/trl/trainer/bco_trainer.py:874
↓ 3 callers
Method
post_process
(self, x)
tok/mm_autoencoder.py:31
↓ 3 callers
Function
print_rich_table
(df: pd.DataFrame)
trl/trl/trainer/utils.py:667
↓ 3 callers
Function
randn_tensor
A helper function to create random tensors on the desired `device` with the desired `dtype`. When passing a list of generators, you can seed each
trl/trl/core.py:113
↓ 3 callers
Method
remove
(self, val)
trl/trl/data_utils.py:465
↓ 3 callers
Function
scheduler_step
Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion process from the learned model ou
trl/trl/models/modeling_sd_base.py:189
↓ 3 callers
Method
search
(self, val)
trl/trl/data_utils.py:475
↓ 3 callers
Method
set_progress_bar_config
Sets the progress bar config for the pipeline
trl/trl/models/modeling_sd_base.py:127
↓ 2 callers
Method
__init__
(self, config, **kwargs)
trl/trl/models/modeling_value_head.py:27
↓ 2 callers
Method
_create_model_from_path
Creates a model from a path or model identifier.
trl/trl/trainer/dpo_trainer.py:516
↓ 2 callers
Method
_generate_and_score_completions
( self, inputs: list[dict[str, Union[torch.Tensor, Any]]] )
trl/trl/trainer/grpo_trainer.py:1400
↓ 2 callers
Method
_get_checkpoint_from_hub
( cls, pretrained_model, pretrained_model_name_or_path, index_filename,
trl/trl/models/modeling_base.py:337
↓ 2 callers
Method
_get_module
(self, module_name: str)
trl/trl/import_utils.py:142
↓ 2 callers
Method
_get_sample_prompt_embeddings
Sample instances from dataset and get prompt embeddings. Used for density ratio classifier training.
trl/trl/trainer/bco_trainer.py:813
↓ 2 callers
Method
_merge_and_maybe_push
(self, output_dir, global_step, model)
trl/trl/trainer/callbacks.py:553
↓ 2 callers
Method
_prepare_gradient_checkpointing
Prepare the gradienting checkpointing for the model.
trl/trl/trainer/dpo_trainer.py:596
↓ 2 callers
Method
_save_checkpoint
(self, model, trial)
trl/trl/trainer/rloo_trainer.py:645
↓ 2 callers
Method
_save_checkpoint
(self, model, trial)
trl/trl/trainer/ppo_trainer.py:752
↓ 2 callers
Method
_sync_fsdp1_params_to_vllm
Memory-efficient post-order traversal of FSDP modules to extract full parameters and sync with vLLM.
trl/trl/trainer/grpo_trainer.py:1174
↓ 2 callers
Method
_sync_fsdp2_params_to_vllm
(self, module: nn.Module)
trl/trl/trainer/grpo_trainer.py:1201
↓ 2 callers
Method
_sync_target_model
(model, target_model, alpha)
trl/trl/trainer/callbacks.py:107
↓ 2 callers
Method
_vectorize_prompt
Replaces processing_class.pad_token_id to embedding_tokenizer.pad_token_id and applies self.embedding_func
trl/trl/trainer/bco_trainer.py:774
↓ 2 callers
Function
add_bos_token_if_needed
( bos_token_id: Optional[int], prompt_len_input_ids: int, prompt_tokens: dict[str, list[int]],
trl/trl/trainer/utils.py:1130
↓ 2 callers
Function
add_eos_token_if_needed
( eos_token_id: int, chosen_tokens: dict[str, list[int]], rejected_tokens: dict[str, list[int]] )
trl/trl/trainer/utils.py:1152
↓ 2 callers
Function
apply_chat_template
r""" Apply a chat template to a conversational example along with the schema for a list of functions in `tools`. For more details, see [`mayb
trl/trl/data_utils.py:72
↓ 2 callers
Method
ar_sample
(self, x, args)
tok/mm_autoencoder.py:20
↓ 2 callers
Function
build_sana
(vision_tower_cfg, **kwargs)
blip3o/model/multimodal_decoder/builder.py:9
↓ 2 callers
Method
build_tokenized_answer
Llama tokenizer does satisfy `enc(a + b) = enc(a) + enc(b)`. It does ensure `enc(a + b) = enc(a) + enc(a + b)[len(enc(a)):]`. Referen
trl/trl/trainer/orpo_trainer.py:362
↓ 2 callers
Method
build_tokenized_answer
Llama tokenizer does satisfy `enc(a + b) = enc(a) + enc(b)`. It does ensure `enc(a + b) = enc(a) + enc(a + b)[len(enc(a)):]`. Referen
trl/trl/trainer/cpo_trainer.py:382
↓ 2 callers
Function
build_vae
(vision_tower_cfg, **kwargs)
blip3o/model/multimodal_decoder/builder.py:15
↓ 2 callers
Function
build_vision_tower
(vision_tower_cfg, **kwargs)
blip3o/model/multimodal_encoder/builder.py:4
↓ 2 callers
Function
cap_exp
(value, cap=-1)
trl/trl/trainer/utils.py:661
↓ 2 callers
Method
clip_embedding
(self, x)
tok/ar_dtok/ar_model.py:391
↓ 2 callers
Function
clone_chat_template
Clones a chat template from a source tokenizer to the target tokenizer and updates the model accordingly. This function: - Copies the ch
trl/trl/models/utils.py:147
↓ 2 callers
Method
complete
Mark the history as completed.
trl/trl/environment/base_environment.py:116
↓ 2 callers
Method
compute_reference_log_probs
Computes log probabilities of the reference model for a single padded batch of a KTO specific dataset.
trl/trl/trainer/kto_trainer.py:922
↓ 2 callers
Method
compute_reference_log_probs
Computes log probabilities of the reference model for a single padded batch of a BCO specific dataset.
trl/trl/trainer/bco_trainer.py:967
↓ 2 callers
Method
concatenated_inputs
Concatenate the `chosen` and `rejected` inputs from the batch into a single tensor for both the prompt and completion sequences.
trl/trl/trainer/dpo_trainer.py:917
↓ 2 callers
Function
conversations_formatting_function
r""" return a callable function that takes in a "messages" dataset and returns a formatted dataset, based on the tokenizer apply chat template
trl/trl/extras/dataset_formatting.py:38
↓ 2 callers
Function
convert_state_dict_to_diffusers
r""" Converts a state dict to new diffusers format. The state dict can be from previous diffusers format (`OLD_DIFFUSERS`), or PEFT format (`P
trl/trl/models/sd_utils.py:105
↓ 2 callers
Method
create_model_card
Creates a draft of a model card using the information available to the `Trainer`. Args: model_name (`str` or `None`, *op
trl/trl/trainer/ddpo_trainer.py:611
↓ 2 callers
Method
create_model_card
Creates a draft of a model card using the information available to the `Trainer`. Args: model_name (`str` or `None`, *op
trl/trl/trainer/alignprop_trainer.py:409
↓ 2 callers
Function
decode_and_strip_padding
Decodes the input tensor and strips the padding tokens. Args: inputs (`torch.Tensor`): The input tensor to be decoded.
trl/trl/trainer/utils.py:1211
↓ 2 callers
Method
encode_images
(self, images, modalities, pool_scale=None)
blip3o/model/blip3o_arch.py:169
↓ 2 callers
Function
find_multiple
(n: int, k: int)
tok/ar_dtok/ar_model.py:15
↓ 2 callers
Function
flatten_dict
Flatten dictionary and concatenate nested keys with separator.
trl/trl/core.py:26
↓ 2 callers
Function
flush_right
Shift non-zero elements in the mask and corresponding tensors to the right. See `flush_left` for details.
trl/trl/trainer/utils.py:1399
↓ 2 callers
Method
generate
Generate responses for a list of histories.
trl/trl/environment/base_environment.py:385
↓ 2 callers
Method
generate_on_policy_outputs
(model, inputs, generation_config, pad_token_id=None)
trl/trl/trainer/gkd_trainer.py:255
↓ 2 callers
Method
get_batch_logps
Compute the log probabilities of the given labels under the given logits. Args: logits: Logits of the model (unnormalized). Shape
trl/trl/trainer/bco_trainer.py:1011
↓ 2 callers
Method
get_batch_loss_metrics
Compute the KTO loss and other metrics for the given batch of inputs for train or test.
trl/trl/trainer/kto_trainer.py:1342
↓ 2 callers
Method
get_batch_loss_metrics
Compute the ORPO loss and other metrics for the given batch of inputs for train or test.
trl/trl/trainer/orpo_trainer.py:790
↓ 2 callers
Method
get_batch_loss_metrics
Compute the BCO loss and other metrics for the given batch of inputs for train or test.
trl/trl/trainer/bco_trainer.py:1168
↓ 2 callers
Method
get_batch_loss_metrics
Compute the DPO loss and other metrics for the given batch of inputs for train or test.
trl/trl/trainer/dpo_trainer.py:1645
↓ 2 callers
Method
get_batch_loss_metrics
Compute the CPO loss and other metrics for the given batch of inputs for train or test.
trl/trl/trainer/cpo_trainer.py:815
↓ 2 callers
Method
get_sana
(self)
blip3o/model/blip3o_arch.py:68
↓ 2 callers
Method
get_sana_vae
(self)
blip3o/model/blip3o_arch.py:76
↓ 2 callers
Function
get_stack_exchange_paired
Load the stack-exchange-paired dataset from Hugging Face and convert it to the necessary format. The dataset is converted to a dictionary with th
trl/examples/research_projects/stack_llama_2/scripts/dpo_llama2.py:103
↓ 2 callers
Method
get_trainable_layers
Returns the trainable parameters of the pipeline
trl/trl/models/modeling_sd_base.py:139
↓ 2 callers
Method
get_vision_tower
(self)
blip3o/model/blip3o_arch.py:166
↓ 2 callers
Method
init_communicator
Initializes the weight update group in a distributed setup for model synchronization. Args: device (`torch.device`, `str
trl/trl/extras/vllm_client.py:247
↓ 2 callers
Function
is_fastapi_available
()
trl/trl/import_utils.py:51
↓ 2 callers
Method
is_image_file
(self, filename)
blip3o/conversation.py:172
↓ 2 callers
Function
is_joblib_available
()
trl/trl/import_utils.py:91
↓ 2 callers
Function
is_pydantic_available
()
trl/trl/import_utils.py:67
↓ 2 callers
Function
is_requests_available
()
trl/trl/import_utils.py:71
↓ 2 callers
Function
is_uvicorn_available
()
trl/trl/import_utils.py:79
↓ 2 callers
Function
is_vllm_ascend_available
()
trl/trl/import_utils.py:87
↓ 2 callers
Method
load_checkpoint
Light wrapper around accelerate's register_lad_state_pre_hook which is run before loading state
trl/trl/models/modeling_sd_base.py:151
↓ 2 callers
Function
masked_whiten
Whiten values with masked values.
trl/trl/core.py:70
↓ 2 callers
Function
maybe_unpair_preference_dataset
r""" Unpair a preference dataset if it is paired. Args: dataset (`Dataset` or `DatasetDict`): Preference dataset to unpai
trl/trl/data_utils.py:281
↓ 2 callers
Method
on_step_end
(self, args, state, control, **kwargs)
trl/trl/trainer/callbacks.py:125
↓ 2 callers
Method
on_train_begin
(self, args: TrainingArguments, state: TrainerState, control: TrainerControl, **kwargs)
trl/trl/trainer/callbacks.py:286
↓ 2 callers
Method
on_train_end
(self, args, state, control, model=None, **kwargs)
trl/trl/trainer/callbacks.py:570
↓ 2 callers
Method
pad_sequence
(self, input_ids, batch_first, padding_value)
blip3o/data/dataset.py:360
↓ 2 callers
Function
prepare_dataset
pre-tokenize the dataset before training; only collate during training
trl/examples/scripts/rloo/rloo.py:105
↓ 2 callers
Function
prepare_dataset
pre-tokenize the dataset before training; only collate during training
trl/examples/scripts/rloo/rloo_tldr.py:103
↓ 2 callers
Function
prepare_dataset
pre-tokenize the dataset before training; only collate during training
trl/examples/scripts/ppo/ppo_tldr.py:136
↓ 2 callers
Function
prepare_dataset
pre-tokenize the dataset before training; only collate during training
trl/examples/scripts/ppo/ppo.py:133
↓ 2 callers
Function
prepare_fsdp
(model, accelerator)
trl/trl/models/utils.py:372
↓ 2 callers
Function
print_env
()
trl/trl/scripts/env.py:41
↓ 2 callers
Method
process_image
(self, image, image_process_mode, return_pil=False, image_format="PNG")
blip3o/conversation.py:111
↓ 2 callers
Function
process_vision_info
(messages: list[dict])
trl/examples/scripts/sft_vlm_gemma3.py:80
↓ 2 callers
Method
project_out
(self, z_cat)
tok/ar_dtok/bottleneck.py:48
↓ 2 callers
Method
reset_prefix_cache
Resets the prefix cache for the model.
trl/trl/extras/vllm_client.py:328
↓ 2 callers
Function
sample
(logits, temperature: float=1.0, top_k: int=0, top_p: float=1.0, sample_logits=True)
tok/ar_dtok/generate.py:55
↓ 2 callers
Method
save_checkpoint
Light wrapper around accelerate's register_save_state_pre_hook which is run before saving state
trl/trl/models/modeling_sd_base.py:145
↓ 2 callers
Method
save_pretrained
Saves all of the model weights
trl/trl/models/modeling_sd_base.py:133
↓ 2 callers
Method
set_eval_deterministic
(self, deterministic=True)
tok/ar_dtok/bottleneck.py:103
↓ 2 callers
Method
show_colour_legend
Print the colour legend.
trl/trl/environment/base_environment.py:192
↓ 2 callers
Function
split_to_even_chunks
Split a list of indices into `chunks` chunks of roughly equal lengths.
blip3o/train/blip3o_trainer.py:52
↓ 2 callers
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
trl/trl/models/modeling_value_head.py:199
↓ 2 callers
Method
store_metrics
(self, metrics: dict[str, float], train_eval: Literal["train", "eval"] = "train")
trl/trl/trainer/kto_trainer.py:1478
↓ 2 callers
Method
store_metrics
(self, metrics: dict[str, float], train_eval: Literal["train", "eval"] = "train")
trl/trl/trainer/orpo_trainer.py:934
↓ 2 callers
Method
store_metrics
(self, metrics: dict[str, float], train_eval: Literal["train", "eval"] = "train")
trl/trl/trainer/bco_trainer.py:1286
↓ 2 callers
Method
store_metrics
(self, metrics: dict[str, float], train_eval: Literal["train", "eval"] = "train")
trl/trl/trainer/dpo_trainer.py:1841
↓ 2 callers
Method
store_metrics
(self, metrics: dict[str, float], train_eval: Literal["train", "eval"] = "train")
trl/trl/trainer/cpo_trainer.py:950
↓ 2 callers
Method
task_end_check
Check if the current generation sequence has finished.
trl/trl/environment/base_environment.py:411
← previous
next →
101–200 of 947, ranked by callers