Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/NVlabs/GDPO
/ functions
Functions
2,091 in github.com/NVlabs/GDPO
⨍
Functions
2,091
◇
Types & classes
346
↳
Endpoints
46
↓ 3 callers
Method
_split_kwargs
Separate the kwargs from the arguments that we support inside `supported_args` and the ones that we don't.
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:413
↓ 3 callers
Method
_validate
(self)
verl-GDPO/verl/trainer/ppo/ray_trainer.py:481
↓ 3 callers
Function
apply_monkey_patch
(config: PretrainedConfig, verbose=True)
verl-GDPO/verl/models/transformers/monkey_patch.py:42
↓ 3 callers
Function
apply_rotary_pos_emb
(q, k, cos, sin, position_ids)
verl-GDPO/verl/models/llama/megatron/layers/parallel_attention.py:123
↓ 3 callers
Function
build_memory_buffer
Build the memory buffer given weight_buffer_meta Args: weight_buffer_meta: contains mapping from name to a dictionary containing shape an
verl-GDPO/verl/utils/memory_buffer.py:68
↓ 3 callers
Function
calc_padded_numel
for cuda memory alignment, make sure alignment by 128-bits
verl-GDPO/verl/utils/memory_buffer.py:51
↓ 3 callers
Method
calculate_loss
Calculate the loss for a batch of an unpacked sample Args: latents (torch.Tensor): The latents sampled f
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/ddpo_trainer.py:326
↓ 3 callers
Function
check_model_support_rmpad
(model_type: str)
verl-GDPO/verl/models/registry.py:27
↓ 3 callers
Function
clear_chat_history
(system_prompt)
trl-GDPO/trl-0.18.0-gdpo/trl/scripts/chat.py:307
↓ 3 callers
Method
compute_ref_log_probs
Computes log probabilities of the reference model for a single padded batch of a DPO specific dataset.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/dpo_trainer.py:801
↓ 3 callers
Function
compute_transformers_input_shapes
(batches, meta_info)
verl-GDPO/verl/utils/megatron/pipeline_parallel.py:22
↓ 3 callers
Method
convert_ids_to_tokens
Converts a single index or a sequence of indices in a token or a sequence of tokens, using the vocabulary and added tokens.
verl-GDPO/verl/workers/rollout/tokenizer.py:116
↓ 3 callers
Function
copy
r"""Works like shutil.copy() for file, and shutil.copytree for dir, and supports hdfs. Copy data and mode bits ("cp src dst"). Return the file's
verl-GDPO/verl/utils/hdfs_io.py:84
↓ 3 callers
Method
dpo_loss
Compute the DPO loss for a batch of policy and reference model log probabilities. Args: chosen_logps (`torch.FloatTensor
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/dpo_trainer.py:883
↓ 3 callers
Method
execute_all_async
(self, method_name: str, *args, **kwargs)
verl-GDPO/verl/single_controller/ray/base.py:335
↓ 3 callers
Method
execute_all_sync
(self, method_name: str, *args, **kwargs)
verl-GDPO/verl/single_controller/ray/base.py:332
↓ 3 callers
Method
execute_rank_zero_async
(self, method_name: str, *args, **kwargs)
verl-GDPO/verl/single_controller/ray/base.py:322
↓ 3 callers
Function
extract_prompt
r""" Extracts the shared prompt from a preference data example, where the prompt is implicit within both the chosen and rejected completions.
trl-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:330
↓ 3 callers
Function
format_reward
Reward function that checks if the reasoning process is enclosed within <think> and </think> tags, while the final answer is enclosed within <answer>
trl-GDPO/open-r1/src/open_r1/rewards.py:85
↓ 3 callers
Method
forward
( self, model: nn.Module, batch: dict[str, Union[list, torch.LongTensor]] )
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/kto_trainer.py:1039
↓ 3 callers
Method
forward
( self, model: nn.Module, batch: dict[str, Union[list, torch.LongTensor]] )
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/bco_trainer.py:1050
↓ 3 callers
Method
generate_sequences
Generate sequences
verl-GDPO/verl/workers/rollout/base.py:35
↓ 3 callers
Method
get
(self)
verl-GDPO/verl/utils/rendezvous/ray_backend.py:30
↓ 3 callers
Function
get_default_kwargs_for_model_parallel_config
()
verl-GDPO/verl/utils/megatron/tensor_parallel.py:32
↓ 3 callers
Function
get_lighteval_tasks
()
trl-GDPO/open-r1/src/open_r1/utils/evaluation.py:62
↓ 3 callers
Function
get_parallel_model_from_config
(config, megatron_config, pre_process=None, post_process=None, value=False)
verl-GDPO/verl/utils/model.py:234
↓ 3 callers
Function
get_reverse_idx
(idx_map)
verl-GDPO/verl/utils/seqlen_balancing.py:259
↓ 3 callers
Function
get_tokenizer
Get the tokenizer for the model.
trl-GDPO/open-r1/src/open_r1/utils/model_utils.py:9
↓ 3 callers
Function
import_external_libs
(external_libs=None)
verl-GDPO/verl/utils/import_utils.py:41
↓ 3 callers
Function
init_model_parallel_config
(config: DictConfig)
verl-GDPO/verl/utils/megatron_utils.py:201
↓ 3 callers
Function
is_joblib_available
()
trl-GDPO/trl-0.18.0-gdpo/trl/import_utils.py:91
↓ 3 callers
Method
log
Log `logs` on the various objects watching training, including stored metrics. Args: logs (`dict[str, float]`):
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/dpo_trainer.py:1515
↓ 3 callers
Function
make_batch_generator
(batches, vpp_size)
verl-GDPO/verl/utils/megatron/pipeline_parallel.py:43
↓ 3 callers
Function
masked_whiten
Whiten values with masked values.
trl-GDPO/trl-0.18.0-gdpo/trl/core.py:70
↓ 3 callers
Method
null_ref_context
Context manager for handling null reference model (that is, peft adapter manipulation).
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/kto_trainer.py:808
↓ 3 callers
Method
null_ref_context
Context manager for handling null reference model (that is, peft adapter manipulation).
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/bco_trainer.py:874
↓ 3 callers
Function
pack_dataset
r""" Pack sequences in a dataset into chunks of size `seq_length`. Args: dataset (`Dataset` or `DatasetDict`): Dataset to
trl-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:475
↓ 3 callers
Function
print_prompt_completions_sample
Print out a sample of model completions to the console with multiple reward metrics. This function creates a nicely formatted table showing
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1753
↓ 3 callers
Function
print_rich_table
(df: pd.DataFrame)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:981
↓ 3 callers
Method
rank
(self)
verl-GDPO/verl/single_controller/base/worker.py:175
↓ 3 callers
Method
save_checkpoint
(self, step)
verl-GDPO/verl/trainer/fsdp_sft_trainer.py:295
↓ 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-GDPO/trl-0.18.0-gdpo/trl/models/modeling_sd_base.py:189
↓ 3 callers
Method
set_input_tensor
Set input tensor to be used instead of forward()'s input. When doing pipeline parallelism the input from the previous stage comes fro
verl-GDPO/verl/models/llama/megatron/modeling_llama_megatron.py:457
↓ 3 callers
Method
set_progress_bar_config
Sets the progress bar config for the pipeline
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_sd_base.py:127
↓ 3 callers
Function
set_random_seed
(seed)
verl-GDPO/verl/workers/megatron_workers.py:47
↓ 3 callers
Function
split_dict_tensor_into_batches
(tensors: TensorDict, batch_size)
verl-GDPO/verl/utils/torch_functional.py:203
↓ 3 callers
Function
split_tensor_dict
Splits a dictionary of tensors along the first dimension into `num_chunks` equal parts. Example: >>> x = torch.arange(12).reshape(6,
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/grpo_trainer.py:215
↓ 3 callers
Method
tearDownClass
(cls)
trl-GDPO/trl-0.18.0-gdpo/tests/test_vllm_client_server.py:119
↓ 3 callers
Function
think_format_reward
r""" Reward function that checks if the reasoning process is enclosed within `"<think>"` and `"</think>"` tags. The function returns a reward
trl-GDPO/trl-0.18.0-gdpo/trl/rewards/format_rewards.py:18
↓ 3 callers
Method
to_str
(precision)
verl-GDPO/verl/utils/torch_dtypes.py:74
↓ 3 callers
Function
unpair_preference_dataset
r""" Unpair a preference dataset. Args: dataset (`Dataset` or `DatasetDict`): Preference dataset to unpair. The dataset m
trl-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:241
↓ 3 callers
Function
vocab_parallel_log_probs_from_logits
TODO(zhangchi.usc1992): We may change the implementation later
verl-GDPO/verl/utils/megatron/tensor_parallel.py:136
↓ 2 callers
Method
__init__
(self, config)
verl-GDPO/verl/workers/megatron_workers.py:410
↓ 2 callers
Method
__init__
(self, config)
verl-GDPO/verl/workers/fsdp_workers.py:509
↓ 2 callers
Method
__init__
(self, config, **kwargs)
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_value_head.py:27
↓ 2 callers
Method
_build_model_optimizer
(self, model_path, megatron_config: ModelParalle
verl-GDPO/verl/workers/megatron_workers.py:124
↓ 2 callers
Method
_build_model_optimizer
(self, model_path, fsdp_config,
verl-GDPO/verl/workers/fsdp_workers.py:111
↓ 2 callers
Method
_check_failed_endpoint
(self, endpoint)
trl-GDPO/open-r1/src/open_r1/utils/competitive_programming/piston_client.py:124
↓ 2 callers
Method
_compute_loss
(self, batch)
verl-GDPO/verl/trainer/fsdp_sft_trainer.py:218
↓ 2 callers
Function
_compute_response_info
(batch)
verl-GDPO/verl/trainer/ppo/ray_trainer.py:216
↓ 2 callers
Method
_forward_micro_batch
(self, micro_batch)
verl-GDPO/verl/workers/critic/dp_critic.py:53
↓ 2 callers
Method
_forward_micro_batch
Returns: entropy: # (bs, response_len) log_probs: # (bs, response_len)
verl-GDPO/verl/workers/actor/dp_actor.py:58
↓ 2 callers
Method
_generate_and_score_completions
( self, inputs: list[dict[str, Union[torch.Tensor, Any]]] )
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/grpo_trainer.py:1004
↓ 2 callers
Method
_get_checkpoint_from_hub
( cls, pretrained_model, pretrained_model_name_or_path, index_filename,
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:343
↓ 2 callers
Method
_get_module
(self, module_name: str)
trl-GDPO/trl-0.18.0-gdpo/trl/import_utils.py:142
↓ 2 callers
Method
_get_or_create_base_snapshot
Get or create a snapshot with the necessary dependencies and scripts for evaluation.
trl-GDPO/open-r1/src/open_r1/utils/competitive_programming/morph_client.py:337
↓ 2 callers
Method
_get_sample_prompt_embeddings
Sample instances from dataset and get prompt embeddings. Used for density ratio classifier training.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/bco_trainer.py:812
↓ 2 callers
Function
_init_event_loop
Initialize or get the current event loop.
trl-GDPO/open-r1/src/open_r1/rewards.py:357
↓ 2 callers
Function
_is_non_local
(path)
verl-GDPO/verl/utils/fs.py:29
↓ 2 callers
Method
_merge_and_maybe_push
(self, output_dir, global_step, model)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/callbacks.py:551
↓ 2 callers
Method
_offload_params_to_cpu
(self, pp_rank, to_empty=False)
verl-GDPO/verl/workers/sharding_manager/megatron_vllm.py:102
↓ 2 callers
Function
_pad_tensor
(x: Tensor, dim: int, padding_size: int)
verl-GDPO/verl/utils/ulysses.py:103
↓ 2 callers
Method
_pad_to_length
(self, input_ids, attention_mask)
verl-GDPO/verl/utils/dataset/rm_dataset.py:99
↓ 2 callers
Method
_release_endpoint
(self, endpoint)
trl-GDPO/open-r1/src/open_r1/utils/competitive_programming/piston_client.py:98
↓ 2 callers
Method
_send_request
(self, endpoint, route, data=None, method="post")
trl-GDPO/open-r1/src/open_r1/utils/competitive_programming/piston_client.py:101
↓ 2 callers
Method
_set_cos_sin_cache
(self, seq_len, device, dtype)
verl-GDPO/verl/models/llama/megatron/layers/parallel_attention.py:51
↓ 2 callers
Method
_sync_fsdp_params_to_vllm
Memory-efficient post-order traversal of FSDP modules to extract full parameters and sync with vLLM.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/grpo_trainer.py:880
↓ 2 callers
Method
_sync_target_model
(model, target_model, alpha)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/callbacks.py:107
↓ 2 callers
Function
_unpad_tensor
(x: Tensor, dim: int, padding_size: int)
verl-GDPO/verl/utils/ulysses.py:110
↓ 2 callers
Function
_unwrap_ray_remote
(cls)
verl-GDPO/verl/single_controller/ray/base.py:414
↓ 2 callers
Method
_vectorize_prompt
Replaces processing_class.pad_token_id to embedding_tokenizer.pad_token_id and applies self.embedding_func
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/bco_trainer.py:772
↓ 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-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1417
↓ 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-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1439
↓ 2 callers
Function
all_to_all_tensor
( local_input: Tensor, scatter_dim: int, gather_dim: int, group: Optional[dist.ProcessGroup] =
verl-GDPO/verl/utils/ulysses.py:132
↓ 2 callers
Method
allgather_params
allgather params of all pp ranks. Return a list of handles
verl-GDPO/verl/workers/sharding_manager/megatron_vllm.py:118
↓ 2 callers
Function
batched
Batch data into lists of length n. The last batch may be shorter.
trl-GDPO/open-r1/src/open_r1/utils/competitive_programming/utils.py:4
↓ 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)):]`.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/orpo_trainer.py:355
↓ 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)):]`.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/cpo_trainer.py:380
↓ 2 callers
Function
cap_exp
(value, cap=-1)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:975
↓ 2 callers
Method
compute_loss
( self, model: Union[PreTrainedModel, nn.Module], inputs: dict[str, Union[torch.Tensor
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/reward_trainer.py:260
↓ 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-GDPO/trl-0.18.0-gdpo/trl/trainer/kto_trainer.py:920
↓ 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-GDPO/trl-0.18.0-gdpo/trl/trainer/bco_trainer.py:967
↓ 2 callers
Method
compute_reward
Compute the reward for a list of histories.
trl-GDPO/trl-0.18.0-gdpo/trl/environment/base_environment.py:367
↓ 2 callers
Method
compute_rewards
(self, prompt_image_pairs, is_async=False)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/ddpo_trainer.py:200
↓ 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-GDPO/trl-0.18.0-gdpo/trl/extras/dataset_formatting.py:30
↓ 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-GDPO/trl-0.18.0-gdpo/trl/models/sd_utils.py:106
↓ 2 callers
Function
create_and_sync_state
(param_name, state, is_param)
verl-GDPO/verl/utils/fsdp_utils.py:243
↓ 2 callers
Method
estimate_flops
Estimate the FLOPS based on the number of valid tokens in the current batch and the time taken. Args: batch_seqlens (Lis
verl-GDPO/verl/utils/flops_counter.py:107
↓ 2 callers
Function
extract_xml_answer
(text: str)
trl-GDPO/open-r1/src/open_r1/gsm8k.py:75
↓ 2 callers
Method
fit
The training loop of PPO. The driver process only need to call the compute functions of the worker group through RPC to construct the
verl-GDPO/verl/trainer/ppo/ray_trainer.py:664
← previous
next →
201–300 of 2,091, ranked by callers