MCPcopy Create free account

hub / github.com/NVlabs/GDPO / functions

Functions2,091 in github.com/NVlabs/GDPO

↓ 430 callersMethodfrom_pretrained
r""" Instantiates a new model from a pretrained model from `transformers`. The pretrained model is loaded using the `from_pretrained`
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:112
↓ 228 callersMethodto
move the batch to device Args: device (torch.device, str): torch device Returns: DataProto: the current Data
verl-GDPO/verl/protocol.py:316
↓ 182 callersMethodtrain
(self)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/ppo_trainer.py:346
↓ 144 callersMethodget
Return a tensor with the input `shape` as a view into the 1-D data starting at `start_index`.
verl-GDPO/verl/utils/memory_buffer.py:40
↓ 108 callersMethodnamed_parameters
(self)
verl-GDPO/verl/utils/memory_buffer.py:205
↓ 77 callersMethodpush_to_hub
r""" Push the pretrained model to the hub. This method is a wrapper around `transformers.PreTrainedModel.push_to_hub`. Please refer to
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:515
↓ 65 callersMethodget
(self)
verl-GDPO/verl/protocol.py:632
↓ 53 callersMethodget_rank
(prompt, candidates)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/judges.py:321
↓ 48 callersMethodpop
Pop a subset of the DataProto via `batch_keys` and `meta_info_keys` Args: batch_keys (list, optional): a list of strings indicati
verl-GDPO/verl/protocol.py:365
↓ 45 callersMethodfrom_dict
Create a DataProto from a dict of tensors. This assumes that 1. All the tensor in tensors have the same dim0 2. Only dim0 is the batch
verl-GDPO/verl/protocol.py:281
↓ 42 callersMethodgenerate
Generates model completions for the provided prompts. Args: prompts (`list[str]`): List of text prompts
trl-GDPO/trl-0.18.0-gdpo/trl/extras/vllm_client.py:164
↓ 41 callersFunctionlog_gpu_memory_usage
(head: str, logger: logging.Logger = None, level=logging.DEBUG, rank: int = 0)
verl-GDPO/verl/utils/debug/performance.py:20
↓ 39 callersMethodsave_model
(self, output_dir: Optional[str] = None, _internal_call: bool = False)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/ppo_trainer.py:331
↓ 36 callersMethodstate_dict
r""" Return the state_dict of the pretrained model.
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:560
↓ 35 callersMethodselect
Select a subset of the DataProto via batch_keys and meta_info_keys Args: batch_keys (list, optional): a list of strings indicatin
verl-GDPO/verl/protocol.py:330
↓ 32 callersMethodparse_args_and_config
Parse command-line args and config file into instances of the specified dataclass types. This method wraps [`transformers.HfArgument
trl-GDPO/trl-0.18.0-gdpo/trl/scripts/utils.py:174
↓ 31 callersMethoddecode
Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special tokens and clean up tokeniz
verl-GDPO/verl/workers/rollout/tokenizer.py:86
↓ 30 callersFunctionpad
Pads a list of tensors to the same shape along the first dimension. Args: tensors (`list[torch.Tensor]`): List of input
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:418
↓ 28 callersMethodupdate
(self, current_kl, n_steps)
verl-GDPO/verl/trainer/ppo/core_algos.py:52
↓ 27 callersMethodlog
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/kto_trainer.py:1611
↓ 26 callersMethodsave_pretrained
r""" Save the pretrained model to a directory. This method is a wrapper around `transformers.PreTrainedModel.save_pretrained`. Please
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:531
↓ 24 callersMethodautocast
Returns the autocast context manager
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_sd_base.py:121
↓ 23 callersMethodbackward
(ctx: Any, grad_output: Tensor)
verl-GDPO/verl/utils/ulysses.py:226
↓ 23 callersMethodto_dict
(self)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/ddpo_config.py:288
↓ 23 callersMethodtokenizer
Returns the tokenizer used for tokenizing text inputs
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_sd_base.py:100
↓ 22 callersFunctionget_peft_config
(model_args: ModelConfig)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:929
↓ 21 callersFunctionget_repetition_penalty_reward
Computes N-gram repetition penalty as described in Appendix C.2 of https://huggingface.co/papers/2502.03373. Reference implementation from: h
trl-GDPO/open-r1/src/open_r1/rewards.py:285
↓ 20 callersMethodeval
(self)
verl-GDPO/verl/workers/sharding_manager/megatron_vllm.py:149
↓ 20 callersFunctiongenerate_model_card
Generate a `ModelCard` from a template. Args: base_model (`str` or `None`): Base model name. model_name (`str`):
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1516
↓ 20 callersMethodupdate
Updates running moments from batch's moments computed across ranks
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:718
↓ 19 callersFunctionempty_cache
Empties the cache of the available torch device. This function checks for the availability of different torch devices (XPU, MLU, NPU, CUDA) a
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1480
↓ 18 callersMethodchunk
Split the batch among dim=0 into chunks. The meta_info is passed to each DataProto after split. Args: chunks (int): the number of
verl-GDPO/verl/protocol.py:482
↓ 18 callersFunctioncopy_local_path_from_hdfs
Copy src from hdfs to local if src is on hdfs or directly return src. If cache_dir is None, we will use the default cache dir of the system. Note
verl-GDPO/verl/utils/fs.py:55
↓ 18 callersMethodgeneralized_jsd_loss
Compute the generalized Jensen-Shannon Divergence loss for knowledge distillation using F.kl_div. See Eq. (1) of https://huggingface.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/gkd_trainer.py:157
↓ 18 callersMethodstep
Perform a single step of training. Args: epoch (int): The current epoch. global_step (int): The current glob
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/ddpo_trainer.py:220
↓ 17 callersMethodcreate
(self)
trl-GDPO/trl-0.18.0-gdpo/trl/mergekit_utils.py:253
↓ 17 callersFunctiondisable_dropout_in_model
(model: torch.nn.Module)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:836
↓ 17 callersMethodencode
Converts a string to a sequence of ids (integer), using the tokenizer and vocabulary. Args: text (`str`, `List[str]` or
verl-GDPO/verl/workers/rollout/tokenizer.py:70
↓ 17 callersFunctionget_comet_experiment_url
If Comet integration is enabled, return the URL of the current Comet experiment; otherwise, return `None`.
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1590
↓ 17 callersFunctionget_kbit_device_map
()
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:920
↓ 16 callersFunctionget_quantization_config
(model_args: ModelConfig)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:901
↓ 16 callersFunctionpad_to_length
(tensor: torch.Tensor, length: int, pad_value: Union[int, float], dim: int = -1)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:821
↓ 16 callersMethodrepeat
Repeat the batch data a specified number of times. Args: repeat_times (int): Number of times to repeat the data.
verl-GDPO/verl/protocol.py:547
↓ 15 callersMethodrun
Run the environment on a list of queries. Args: queries (list[str]): A list of queries to run the model in the environme
trl-GDPO/trl-0.18.0-gdpo/trl/environment/base_environment.py:272
↓ 15 callersFunctionselective_log_softmax
A memory-efficient implementation of the common `log_softmax -> gather` operation. This function is equivalent to the following naive implem
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1718
↓ 14 callersMethodadd
(self, idx: int, val: int)
verl-GDPO/verl/utils/seqlen_balancing.py:33
↓ 14 callersFunctionhf_tokenizer
Create a huggingface pretrained tokenizer. Args: name (str): The name of the tokenizer. correct_pad_token (bool): Whether to corr
verl-GDPO/verl/utils/tokenizer.py:35
↓ 14 callersFunctionis_conversational
r""" Check if the example is in a conversational format. Args: example (`dict[str, Any]`): A single data entry of a datas
trl-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:30
↓ 14 callersMethodto_dtype
(precision)
verl-GDPO/verl/utils/torch_dtypes.py:63
↓ 13 callersMethod_prepare_inputs
( self, generation_batch: dict[str, Union[torch.Tensor, Any]] )
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/grpo_trainer.py:972
↓ 13 callersMethodconcat
Concat a list of DataProto. The batch is concatenated among dim=0. The meta_info is assumed to be identical and will use the first one.
verl-GDPO/verl/protocol.py:515
↓ 12 callersFunctionprepare_deepspeed
Prepares the model for training with DeepSpeed (both for stage 2 and 3), configuring the appropriate settings based on the model and batch si
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1268
↓ 12 callersMethodtokenize_row
r""" Tokenize a row of the dataset. Args: features (`dict[str, str]`): Row of the dataset, should contain
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/prm_trainer.py:207
↓ 12 callersFunctionunwrap_model_for_generation
Context manager to unwrap distributed or accelerated models for generation tasks. Args: model (`Union[DistributedDataParallel, DeepS
trl-GDPO/trl-0.18.0-gdpo/trl/models/utils.py:186
↓ 11 callersMethoddata_collator
(features)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/grpo_trainer.py:508
↓ 11 callersFunctionlog_table_to_comet_experiment
If Comet integration is enabled logs a table to the Comet experiment if it is currently running. Args: name (`str`): Tab
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1603
↓ 10 callersMethodappend_segment
Append a new segment to the history. Args: text (`str`): The text of the new segment. tokens (`torch.LongTen
trl-GDPO/trl-0.18.0-gdpo/trl/environment/base_environment.py:88
↓ 10 callersFunctioncreate_reference_model
Creates a static reference copy of a model. Note that model will be in `.eval()` mode. Args: model (`PreTrainedModelWrapper`): The m
trl-GDPO/trl-0.18.0-gdpo/trl/models/modeling_base.py:605
↓ 10 callersFunctionget_reward
Computes the reward logits and the rewards for a given model and query responses. Args: model (`torch.nn.Module`): The m
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1186
↓ 10 callersFunctionis_diffusers_available
()
trl-GDPO/trl-0.18.0-gdpo/trl/import_utils.py:47
↓ 10 callersFunctionis_vllm_available
()
trl-GDPO/trl-0.18.0-gdpo/trl/import_utils.py:83
↓ 9 callersFunction_timer
(name: str, timing_raw: Dict[str, float])
verl-GDPO/verl/trainer/ppo/ray_trainer.py:372
↓ 9 callersMethodclear
(self)
trl-GDPO/trl-0.18.0-gdpo/trl/scripts/chat.py:257
↓ 9 callersFunctioncode_reward
Reward function that evaluates code snippets using a code execution provider. Assumes the dataset contains a `verification_info` column with test
trl-GDPO/open-r1/src/open_r1/rewards.py:511
↓ 9 callersMethodget_megatron_rank_info
(self)
verl-GDPO/verl/single_controller/base/megatron/worker.py:33
↓ 9 callersFunctionget_ulysses_sequence_parallel_group
Get ulysses sequence parallel process group.
verl-GDPO/verl/utils/ulysses.py:37
↓ 9 callersMethodjudge
(self, prompts: list[str], completions: list[str], shuffle_order: bool = True)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/judges.py:70
↓ 9 callersFunctionoffload_fsdp_param_and_grad
(module, offload_grad=False)
verl-GDPO/verl/utils/fsdp_utils.py:93
↓ 9 callersMethodpreprocess_data
(self, data: DataProto)
verl-GDPO/verl/workers/sharding_manager/base.py:29
↓ 9 callersFunctionsetup_chat_format
Setup chat format by adding special tokens to the tokenizer, setting the correct format, and extending the embedding layer of the model based on
trl-GDPO/trl-0.18.0-gdpo/trl/models/utils.py:76
↓ 8 callersMethod__enter__
(self)
verl-GDPO/verl/workers/sharding_manager/base.py:23
↓ 8 callersMethod__exit__
(self, exc_type, exc_value, traceback)
verl-GDPO/verl/workers/sharding_manager/base.py:26
↓ 8 callersFunctionchunk_list
Split list `lst` into `n` evenly distributed sublists. Example: >>> chunk_list([1, 2, 3, 4, 5, 6], 2) [[1, 2, 3], [4, 5, 6]]
trl-GDPO/trl-0.18.0-gdpo/trl/scripts/vllm_serve.py:319
↓ 8 callersFunctionget_formatting_func_from_dataset
r""" Finds the correct formatting function based on the dataset structure. Currently supported datasets are: - `ChatML` with [{"role": str, "c
trl-GDPO/trl-0.18.0-gdpo/trl/extras/dataset_formatting.py:78
↓ 8 callersFunctionmasked_mean
Compute mean of tensor with a masked values.
trl-GDPO/trl-0.18.0-gdpo/trl/core.py:43
↓ 8 callersMethodpostprocess_data
(self, data: DataProto)
verl-GDPO/verl/workers/sharding_manager/base.py:32
↓ 7 callersFunction_megatron_calc_global_rank
given TP,DP,PP rank to get the global rank.
verl-GDPO/verl/models/llama/megatron/checkpoint_utils/llama_saver.py:28
↓ 7 callersMethod_save_checkpoint
(self)
verl-GDPO/verl/trainer/ppo/ray_trainer.py:633
↓ 7 callersFunctionappend_to_dict
(data: Dict, new_data: Dict)
verl-GDPO/verl/utils/py_functional.py:41
↓ 7 callersMethodassertTensorEqual
(self, tensor1, tensor2)
trl-GDPO/trl-0.18.0-gdpo/tests/test_collators.py:26
↓ 7 callersFunctionflush_left
Shift non-zero elements in the mask and corresponding tensors to the left. This function operates on a binary mask and any number of additio
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1621
↓ 7 callersFunctionget_code_format_reward
Format reward function specifically for code responses. Args: language: Programming language supported by E2B https://e2b.dev/docs/code-i
trl-GDPO/open-r1/src/open_r1/rewards.py:595
↓ 7 callersFunctionload_fsdp_param_and_grad
(module, device_id, load_grad=False)
verl-GDPO/verl/utils/fsdp_utils.py:103
↓ 7 callersFunctionmain
()
trl-GDPO/trl-0.18.0-gdpo/trl/cli.py:34
↓ 7 callersFunctionmasked_mean
Compute mean of tensor with a masked values.
verl-GDPO/verl/utils/torch_functional.py:107
↓ 7 callersFunctionpeft_module_casting_to_bf16
(model)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:891
↓ 7 callersMethodrun_code
Executes a batch of scripts in the sandbox environment. Args: scripts (list[str]): A list of code scripts to execute.
trl-GDPO/open-r1/src/open_r1/utils/routed_sandbox.py:41
↓ 7 callersMethodtorch_call
(self, examples: list[Union[list[int], Any, dict[str, Any]]])
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:134
↓ 7 callersMethodtrain
(self)
verl-GDPO/verl/workers/sharding_manager/megatron_vllm.py:153
↓ 6 callersFunction_broadcast_tensor
broadcast tensor from rank0 across mp_group
verl-GDPO/verl/models/llama/megatron/checkpoint_utils/llama_loader.py:97
↓ 6 callersMethod_get_per_token_logps
(self, model, input_ids, attention_mask, logits_to_keep, batch_size=None)
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/grpo_trainer.py:857
↓ 6 callersFunctionapply_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-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:71
↓ 6 callersFunctionbatch_generation
( model: torch.nn.Module, queries: torch.Tensor, local_rollout_forward_batch_size: int, pad_to
trl-GDPO/trl-0.18.0-gdpo/trl/trainer/utils.py:1385
↓ 6 callersFunctiongather_seq_scatter_heads
A func to sync embedding input with alltoall in sequence parallel gather sequence dimension and scatter head dim: e.g. seq_dim: 1, head_d
verl-GDPO/verl/utils/ulysses.py:61
↓ 6 callersMethodget
Return a tensor with the input `shape` as a view into the 1-D data starting at `start_index`.
verl-GDPO/verl/utils/megatron/memory.py:33
↓ 6 callersFunctionget_dataset
Load a dataset or a mixture of datasets based on the configuration. Args: args (ScriptArguments): Script arguments containing dataset con
trl-GDPO/open-r1/src/open_r1/utils/data.py:12
↓ 6 callersFunctionlogprobs_from_logits
See: https://github.com/pytorch/pytorch/issues/563#issuecomment-330103591
verl-GDPO/verl/utils/torch_functional.py:49
↓ 6 callersFunctionmaybe_apply_chat_template
r""" If the example is in a conversational format, apply a chat template to it. Args: example (`dict[str, list[dict[str, str]]`):
trl-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:172
↓ 6 callersFunctionmaybe_unpair_preference_dataset
r""" Unpair a preference dataset if it is paired. Args: dataset (`Dataset` or `DatasetDict`): Preference dataset to unpai
trl-GDPO/trl-0.18.0-gdpo/trl/data_utils.py:282
↓ 6 callersFunctionpad_sequence_to_length
pad a 2D tensors (e.g. responses, logprobs) in the last dim to max_seq_length. input shape: [bs, seq_length] output shape: [bs, max_seq_l
verl-GDPO/verl/utils/torch_functional.py:209
next →1–100 of 2,091, ranked by callers