Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/DLYuanGod/MegaTrain
/ functions
Functions
5,181 in github.com/DLYuanGod/MegaTrain
⨍
Functions
5,181
◇
Types & classes
739
↳
Endpoints
136
↓ 6 callers
Method
check_this_step
(self)
verl/verl/utils/profiler/profile.py:143
↓ 6 callers
Function
combined_int_check
(val)
verl/verl/utils/reward_score/prime_code/testing_util.py:77
↓ 6 callers
Method
compute_ref_log_prob
(self, data: DataProto)
verl/verl/workers/fsdp_workers.py:1177
↓ 6 callers
Function
compute_reward
We compute dense reward here so that we can directly train RL without SFT
verl/tests/special_e2e/envs/digit_completion/task.py:139
↓ 6 callers
Function
compute_throughout_metrics
Computes throughput metrics for PPO training. This function calculates performance metrics related to token processing speed, including
verl/verl/trainer/ppo/metric_utils.py:273
↓ 6 callers
Function
compute_timing_metrics
Computes timing metrics for different processing stages in PPO training. This function calculates both raw timing metrics (in seconds) and p
verl/verl/trainer/ppo/metric_utils.py:231
↓ 6 callers
Function
create_rollout_worker_group
( resource_pool: RayResourcePool, model_config: HFModelConfig, rollout_config: RolloutConfig,
verl/tests/checkpoint_engine/test_utils.py:150
↓ 6 callers
Method
embedding
Token embedding module. Infinity execution: prefetch(adapter.embedding) hidden = adapter.embedding(input_ids
infinity/adapters/hf_decoder.py:234
↓ 6 callers
Method
execute_checkpoint_engine
(self, method: str, *args, **kwargs)
verl/verl/checkpoint_engine/base.py:295
↓ 6 callers
Method
from_tensordict
Create a DataProto from a TensorDict. This assumes that 1. All the tensor in tensor_dict have the same dim0 2. Only dim0 is the batch
verl/verl/protocol.py:546
↓ 6 callers
Method
generate
Generate text using the SGLang server. Args: prompt (Optional[str], optional): Text prompt for generation. Defaults to None.
verl/verl/workers/rollout/sglang_rollout/http_server_engine.py:422
↓ 6 callers
Method
get
Return a tensor with the input `shape` as a view into the 1-D data starting at `start_index`.
verl/verl/utils/megatron/memory.py:31
↓ 6 callers
Method
get
(self, key: str, default=None)
verl/verl/utils/modelopt/vllm_modelopt_patch.py:197
↓ 6 callers
Function
get_auto_model_for_vision2seq
Return the available VL auto model class across transformers versions.
verl/verl/utils/transformers_compat.py:61
↓ 6 callers
Function
get_constant_schedule_with_warmup
Create a constant LR schedule with a linear warmup phase. Args: optimizer (Optimizer): Wrapped optimizer. num_warmup_steps (
verl/verl/utils/torch_functional.py:761
↓ 6 callers
Method
get_dispatch_collect
Get all registered dispatch and collect dp_ranks. Returns: dict[str, int]: A dictionary mapping mesh names to the
verl/verl/single_controller/base/worker.py:136
↓ 6 callers
Function
get_hf_model_checkpoint_path
(checkpoint_path)
verl/verl/utils/megatron_utils.py:726
↓ 6 callers
Method
get_instance
(cls)
verl/verl/utils/rollout_trace.py:63
↓ 6 callers
Method
get_processor
(self)
verl/verl/workers/config/model.py:235
↓ 6 callers
Function
get_rollout_replica_class
(rollout: str)
verl/verl/workers/rollout/replica.py:396
↓ 6 callers
Function
get_transformer_layer_offset
Get the index offset of any pipeline stage, given the level of pipelining. Make pipeline_rank and vp_stage as two arguments to make it more
verl/verl/utils/megatron_utils.py:1167
↓ 6 callers
Function
get_visible_devices_keyword
Get the environment variable name for visible device selection. Returns the appropriate environment variable name based on the available acce
verl/verl/utils/device.py:58
↓ 6 callers
Function
is_non_local
Check if a path is a non-local (HDFS) path. Args: path (str): The path to check. Returns: bool: True if the path is an HDFS
verl/verl/utils/fs.py:34
↓ 6 callers
Method
is_r2_record_action
Return True if the current router_replay_action is RECORD (R2) for the local router instances. This inspects the first local RouterReplay ins
verl/verl/utils/megatron/router_replay_utils.py:508
↓ 6 callers
Method
load_checkpoint
Load model, optimizer, and scheduler states from a checkpoint. Args: local_path: Local filesystem path of the checkpoint
verl/verl/workers/engine/base.py:202
↓ 6 callers
Function
patch_vlm_for_ulysses_input_slicing
Applies a monkey patch to the forward method of a given model class to enable Ulysses sequence parallelism input slicing.
verl/verl/models/transformers/monkey_patch.py:158
↓ 6 callers
Function
postprocess_packed_seqs
Postprocess packed sequences
verl/verl/models/mcore/util.py:134
↓ 6 callers
Method
register
(cls, name: str)
verl/verl/experimental/agent_loop/tool_parser.py:72
↓ 6 callers
Method
reset
Reset the model engine to the initial state. If the engine is not initialized, we initialize it. Otherwise, reload ckpt and reset sta
verl/verl/workers/engine_workers.py:170
↓ 6 callers
Method
resume
Resume rollout weights or kv cache in GPU memory. Args: tags: weights or kv_cache.
verl/verl/workers/rollout/base.py:45
↓ 6 callers
Method
resume_memory_occupation
Resume GPU memory occupation. Args: tags (Optional[List[str]], optional): List of tags to specify which memory to resume.
verl/verl/workers/rollout/sglang_rollout/http_server_engine.py:545
↓ 6 callers
Method
save_checkpoint
Save model, optimizer, and scheduler states to a checkpoint. Args: local_path: Local filesystem path to save checkpoint.
verl/verl/workers/engine/base.py:182
↓ 6 callers
Method
set_dispatch_collect
Set the dispatch and collect dp_ranks for all registered meshes. Args: mesh_name (str): Mesh name to set dispatch and collect dp_
verl/verl/single_controller/base/worker.py:147
↓ 6 callers
Method
shutdown
Shutdown the HTTP server and clean up resources. This method performs the following cleanup operations: 1. Unregisters the worker fro
verl/verl/workers/rollout/sglang_rollout/http_server_engine.py:390
↓ 6 callers
Method
sleep
(self)
verl/verl/workers/rollout/sglang_rollout/async_sglang_server.py:344
↓ 6 callers
Function
t
(x: list[int])
verl/tests/experimental/agent_loop/test_agent_loop_extra_fields_schema_on_cpu.py:148
↓ 6 callers
Method
to
Move model parameters, optimizer states, or both to the specified device. Note that this function executes irrespective of offload co
verl/verl/workers/engine/veomni/transformer_impl.py:344
↓ 6 callers
Function
truncatefn
(s, length=300)
verl/verl/utils/reward_score/prime_code/testing_util.py:39
↓ 6 callers
Method
validate
Validate actor configuration with runtime parameters.
verl/verl/workers/config/actor.py:222
↓ 5 callers
Method
__init__
(self)
verl/verl/single_controller/ray/base.py:1003
↓ 5 callers
Method
__post_init__
(self)
verl/verl/workers/config/engine.py:114
↓ 5 callers
Function
_check_dispatch_mode
(dispatch_mode)
verl/verl/single_controller/base/decorator.py:369
↓ 5 callers
Function
_check_ext
()
infinity/csrc/__init__.py:14
↓ 5 callers
Method
_clear_search
(self)
verl/scripts/rollout_viewer.py:474
↓ 5 callers
Function
_compute_topk
(scores, topk, num_groups=None, group_topk=None)
verl/verl/utils/megatron/router_replay_patch.py:149
↓ 5 callers
Method
_get_gen_batch
(self, batch: DataProto)
verl/verl/experimental/vla/rob_ray_trainer.py:195
↓ 5 callers
Method
_get_wrapped_names
Return names of modules selected for wrapping.
verl/tests/utils/test_fsdp2_peft_wrapping.py:72
↓ 5 callers
Function
_hdfs_cmd
(cmd: str)
verl/verl/utils/hdfs_io.py:144
↓ 5 callers
Function
_pad_1d
(ids: list[int], *, length: int, pad_id: int = 0)
verl/tests/experimental/agent_loop/test_agent_loop_extra_fields_schema_on_cpu.py:118
↓ 5 callers
Function
_run_cmd
(cmd: str, timeout=None)
verl/verl/utils/hdfs_io.py:140
↓ 5 callers
Method
aggregate
(self)
verl/verl/utils/metric/utils.py:123
↓ 5 callers
Function
apply_kl_penalty
Apply KL penalty to the token-level rewards. This function computes the KL divergence between the reference policy and current policy, then a
verl/verl/trainer/ppo/ray_trainer.py:76
↓ 5 callers
Function
as_torch_index
Convert arbitrary group labels to a contiguous 1-D torch.long tensor (0..G-1). Args: index: Any iterable of labels or tensor/ndarray
verl/verl/utils/groupwise.py:91
↓ 5 callers
Function
build_optimizer
Build an optimizer based on the configuration. Dynamically imports and instantiates an optimizer class from the specified module. Args:
verl/verl/workers/config/optimizer.py:218
↓ 5 callers
Function
calculate_debug_metrics
calculate rollout vs actor logprobs diff, for debugging purpose Args: data: DataProto the data batch to calculate
verl/verl/utils/debug/metrics.py:63
↓ 5 callers
Function
check_and_construct_configs
Check and disable incompatible configurations for older Megatron version. Args: original_config (dict): The original model configura
verl/verl/models/mcore/config_converter.py:139
↓ 5 callers
Function
clean_traceback
(error_traceback)
verl/verl/utils/reward_score/prime_code/testing_util.py:81
↓ 5 callers
Function
compute_offpolicy_metrics
Compute off-policy diagnostic metrics (helper function). This helper function operates on raw tensors and is used internally by: - compute_ro
verl/verl/trainer/ppo/rollout_corr_helper.py:897
↓ 5 callers
Function
compute_policy_loss_vanilla
Compute the clipped policy objective and related metrics for PPO. Adapted from https://github.com/huggingface/trl/blob/main/trl/trainer/
verl/verl/trainer/ppo/core_algos.py:1279
↓ 5 callers
Function
deserialize_tensordict
(arr: Any)
verl/verl/protocol.py:275
↓ 5 callers
Method
dump_memory_snapshot
Generates a memory snapshot and saves it as a pickle file in a specified directory. The files are organized by timestamp in subdirect
verl/verl/utils/memory_utils.py:256
↓ 5 callers
Function
enable_full_determinism
Helper function for reproducibility in distributed training. See https://pytorch.org/docs/stable/notes/randomness.html for details.
verl/verl/workers/engine/utils.py:29
↓ 5 callers
Function
expand_as_nested
Args: tensor: a tensor with shape (bsz,) nested_tensor: a nested tensor with shape (bsz, xxx) Returns: a tensor wit
verl/verl/utils/torch_functional.py:982
↓ 5 callers
Function
find_latest_ckpt_path
Return the most recent checkpoint directory based on a tracker file. Args: path (str): Base directory containing the checkpoint trac
verl/verl/utils/checkpoint/checkpoint_manager.py:197
↓ 5 callers
Function
flash_attn_supports_top_left_mask
Fallback implementation for older transformers versions. Returns False to disable features that require this function.
verl/verl/utils/transformers_compat.py:32
↓ 5 callers
Method
forward
(self, x: torch.Tensor)
infinity/model/transformer.py:72
↓ 5 callers
Method
forward
( self, hidden_states: torch.FloatTensor, vocab_weights: torch.FloatTensor, in
verl/verl/utils/experimental/torch_functional.py:215
↓ 5 callers
Method
forward_backward_batch
Perform a forward pass and optionally a backward pass on a batch of data. Args: data: The input data for the forward pas
verl/verl/workers/engine/base.py:98
↓ 5 callers
Method
forward_logits
Forward-only pass that returns logits. Used for inference (rollout, ref policy, etc.). In multi-GPU mode, splits the batch across workers for
infinity/model/cpu_master.py:1173
↓ 5 callers
Method
generate_sequences
Spawn agent loop for each sample in the batch without waiting for the results.
verl/verl/trainer/main_ppo_sync.py:276
↓ 5 callers
Method
get_backend
(cls)
verl/verl/utils/rollout_trace.py:107
↓ 5 callers
Function
get_cosine_schedule_with_warmup
Create a schedule with a learning rate that decreases following the values of the cosine function between the initial lr set in the optimizer
verl/verl/utils/torch_functional.py:705
↓ 5 callers
Function
get_dict_from_prefix
Extract a sub-dictionary from a TensorDict based on a given prefix. Args: tensordict: The input TensorDict containing various keys.
verl/verl/experimental/vla/sac/sac_actor.py:39
↓ 5 callers
Function
get_hf_rope_theta
Return RoPE base frequency theta. Most configs expose ``rope_theta`` on the root. Newer models (e.g. Qwen3 in transformers>=5) store it under
verl/verl/utils/megatron_utils.py:173
↓ 5 callers
Function
get_local_gpus_num
(division=1)
verl/tests/single_controller/test_split_resource_pool.py:32
↓ 5 callers
Function
get_policy_loss_fn
Get the policy loss with a given name. Args: name: `(str)` The name of the policy loss. Returns: `(callable)`: T
verl/verl/trainer/ppo/core_algos.py:70
↓ 5 callers
Method
get_rng_state
()
verl/verl/utils/checkpoint/checkpoint_manager.py:175
↓ 5 callers
Function
hf_to_mcore_config
Convert huggingface PretrainedConfig to mcore TransformerConfig. Args: hf_config: The huggingface PretrainedConfig. dtype: The dt
verl/verl/models/mcore/registry.py:232
↓ 5 callers
Function
launch_server_process
Launch an SGLang HTTP server process and wait for it to be ready. This function starts a new process running an SGLang HTTP server, then waits
verl/verl/workers/rollout/sglang_rollout/http_server_engine.py:104
↓ 5 callers
Method
load_from_disk
(filepath)
verl/verl/protocol.py:431
↓ 5 callers
Function
load_fsdp_optimizer
(optimizer, device_id)
verl/verl/utils/fsdp_utils.py:219
↓ 5 callers
Function
normalize_final_answer
Normalize a final answer to a quantitative reasoning question. Args: final_answer: The answer string to normalize Returns: N
verl/verl/utils/reward_score/math_dapo.py:124
↓ 5 callers
Function
pad_dataproto_to_divisor
Pad a DataProto to size divisible by size_divisor Args: size_divisor (int): size divisor Returns: data: (DataProto): the pad
verl/verl/protocol.py:74
↓ 5 callers
Function
postprocess_batch_func
postprocess the output of a forward_backward_batch. output_lst is a list of dict containing outputs for each micro-batch reorder entropy and o
verl/verl/workers/engine/utils.py:99
↓ 5 callers
Function
postprocess_thd_engine
Postprocess packed sequences
verl/verl/models/mcore/util.py:476
↓ 5 callers
Function
preprocess_bshd_engine
Preprocess bshd sequences return "input_ids, attention_mask, position_ids"
verl/verl/models/mcore/util.py:557
↓ 5 callers
Function
process_validation_metrics
Process validation metrics into a structured format with statistical analysis. This function organizes validation metrics by data source and
verl/verl/trainer/ppo/metric_utils.py:514
↓ 5 callers
Method
reset
( self, env_idx: Optional[int | list[int] | np.ndarray] = None, reset_state_ids=None,
verl/verl/experimental/vla/envs/libero_env/libero_env.py:297
↓ 5 callers
Function
response_from_nested
Extract response from nested model output. Args: tensor: a nested tensor with shape (bsz, prompt_len + response_len) response_mas
verl/verl/workers/utils/padding.py:186
↓ 5 callers
Function
rmsnorm
Apply RMSNorm with custom gradient.
infinity/ops/layers.py:65
↓ 5 callers
Function
safe_create_task
Safely create a task with exception handling Args: coro: The coroutine to run name: Name for the task task_set: Optional
verl/verl/experimental/fully_async_policy/detach_utils.py:367
↓ 5 callers
Method
select_idxs
Select specific indices from the DataProto. Args: idxs (torch.Tensor or numpy.ndarray or list): Indices to select
verl/verl/protocol.py:635
↓ 5 callers
Function
serialize_tensordict
(batch: TensorDict)
verl/verl/protocol.py:247
↓ 5 callers
Method
set_global_router_replay_action
Sets the router replay action for all router instances.
verl/verl/utils/megatron/router_replay_patch.py:120
↓ 5 callers
Method
set_router_replay_action
Sets the router replay action for this layer.
verl/verl/utils/megatron/router_replay_patch.py:111
↓ 5 callers
Method
to
Move FSDP model and/or optimizer to CPU or GPU with offload support. Note that this function executes irrespective of offload config.
verl/verl/workers/engine/fsdp/diffusers_impl.py:657
↓ 5 callers
Function
tokenizer
()
verl/tests/utils/test_special_adapter_path_integration.py:38
↓ 5 callers
Method
train_batch
Perform a training step on a batch of data. Args: data: The input data for training, typically containing tensors and me
verl/verl/workers/engine/base.py:112
↓ 5 callers
Function
unpack_visual_output
Unpack the output from the visual encoder, handling both tuple and object return types. Newer versions of transformers return an object with `poo
verl/verl/utils/transformers_compat.py:77
↓ 5 callers
Function
unpad_dataproto
Unpad the data proto with pad_size. i.e. `data[:-pad_size]`
verl/verl/protocol.py:102
← previous
next →
301–400 of 5,181, ranked by callers