MCPcopy Create free account

hub / github.com/DLYuanGod/MegaTrain / functions

Functions5,181 in github.com/DLYuanGod/MegaTrain

↓ 2 callersFunctionapply_qat_patches
Apply NVFP4 patches to support dynamic weight updates. Call before model loading.
verl/verl/utils/qat/vllm_patch.py:737
↓ 2 callersFunctionapply_qat_to_modules
Apply ModelOpt fake quantization to a list of Megatron module chunks.
verl/verl/utils/modelopt/qat_utils.py:39
↓ 2 callersMethodapply_rotary
Apply rotary embeddings to query and key tensors. Args: q: Query tensor [B, T, num_heads, head_dim] k: Key t
infinity/ops/layers.py:98
↓ 2 callersFunctionapply_rotary_pos_emb_absolute
Reroute to the appropriate apply_rotary_pos_emb function depending on bshd (conventional) / thd (packed seq) format In Qwen2-VL, the sha
verl/verl/models/mcore/qwen2_5_vl/rope_utils.py:239
↓ 2 callersFunctionapply_router_replay_patch
Applies the monkey patch for MoE Router Replay functionality. This patch dynamically adds the 'enable_routing_replay' attribute to Transforme
verl/verl/utils/megatron/router_replay_patch.py:337
↓ 2 callersFunctionapply_tiled_mlp_monkey_patch
Apply TiledMLP monkey patch based on model_type. This function MUST be called BEFORE model instantiation to take effect. It patches the MLP c
verl/verl/models/transformers/tiled_mlp.py:177
↓ 2 callersFunctionapply_vllm_fp8_patches
()
verl/verl/utils/vllm/vllm_fp8_utils.py:723
↓ 2 callersFunctionassemble_batch_from_rollout_samples
Assemble gen_batch_output from RolloutSample objects Assembles batches from RolloutSample objects, similar to the _post_generate_batch logic
verl/verl/experimental/fully_async_policy/detach_utils.py:92
↓ 2 callersFunctionasync_copy_params
Async copy parameters from CPU to GPU buffer
infinity/cuda_pipeline/layer_pipeline.cpp:7
↓ 2 callersMethodasync_send_weights
Send weights to the receiver. Accepts a sync generator or async iterator. Args: weights: Generator or async iterator yie
verl/verl/workers/rollout/vllm_rollout/bucketed_weight_transfer.py:102
↓ 2 callersFunctionbackup_base_model_weights
Backup base model weights to CPU with LoRA temporarily disabled. This function temporarily disables LoRA adapters, backs up the clean base model
verl/verl/utils/fsdp_utils.py:936
↓ 2 callersMethodbegin_read
Start the read operation.
verl/verl/checkpoint_engine/nixl_checkpoint_engine.py:205
↓ 2 callersFunctionbroadcast_dict_tensor
Broadcast all tensors in a dictionary from source rank to all ranks. Iterates over all tensors in the dictionary and broadcasts each one from
verl/verl/utils/torch_functional.py:388
↓ 2 callersMethodbuild_packed_seq_params
( self, grid_thw: Optional[torch.Tensor], cu_seqlens: Optional[torch.Tensor] = None,
verl/verl/models/mcore/qwen2_5_vl/vision_model.py:289
↓ 2 callersFunctionbuild_peft_config_for_vllm
Build a peft_config dict compatible with vLLM's PEFTHelper from megatron lora config. Args: lora_config: Megatron lora configuration dict
verl/verl/utils/megatron_peft_utils.py:131
↓ 2 callersFunctionbuild_scheduler
Build and configure the scheduler for the diffusion model. The returned scheduler has timesteps and sigmas already set. Args: model_c
verl/verl/models/diffusers_model/utils.py:69
↓ 2 callersFunctionbuild_sglang_profiler_args
Build arguments for SGLang profiler. Args: profiler_config (ProfilerConfig): The unified profiler configuration. tool_config
verl/verl/utils/profiler/config.py:239
↓ 2 callersFunctionbuild_vllm_profiler_args
Build arguments and environment variables for vLLM profiler. Acts as an adapter to bridge verl's unified profiler config and vLLM's specific
verl/verl/utils/profiler/config.py:193
↓ 2 callersMethodbulk_offload_group
Bulk offload group.
verl/verl/utils/activation_offload.py:298
↓ 2 callersFunctioncalc_cpu_memory
Calculate required CPU memory in GB. MegaTrain stores on CPU: - FP32 master weights: 4 bytes/param - Adam optimizer states (m + v): 8
scripts/calc_resource.py:90
↓ 2 callersFunctioncalc_gpu_fixed
Calculate fixed GPU memory usage in GB. Fixed components: - CUDA context: ~2 GB - Double-buffered layer templates: 2 * layer_size_bf1
scripts/calc_resource.py:101
↓ 2 callersFunctioncalc_maj_val
Calculate a value based on majority voting. This function identifies the most common value for a specified vote key in the data, then re
verl/verl/trainer/ppo/metric_utils.py:478
↓ 2 callersMethodcalculate_score
Calculates a score for the interaction, potentially considering aspects like partial exposure & in-context task switching. sh
verl/verl/interactions/base.py:56
↓ 2 callersMethodcall_batch
(self, data: dict[str, Any])
verl/verl/experimental/vla/models/pi0_torch/pi0_utils.py:230
↓ 2 callersFunctioncall_sandbox_api
Calls the remote sandbox API to execute code with retry logic for Gateway Timeout, using increasing delay between retries. Logs internal call
verl/verl/utils/reward_score/sandbox_fusion/utils.py:67
↓ 2 callersFunctioncall_search_api
Calls the remote search API to perform retrieval with retry logic for various errors, using increasing delay between retries. Logs internal
verl/verl/tools/utils/search_r1_like_utils.py:34
↓ 2 callersFunctionceil_div
Perform ceiling division of two integers.
verl/verl/utils/kernel/fp8_kernel.py:41
↓ 2 callersFunctionceildiv
Compute ceiling division of a by b. Returns the smallest integer greater than or equal to a/b. Uses the identity: ceil(a/b) = floor((a + b -
verl/verl/utils/seqlen_balancing.py:305
↓ 2 callersFunctioncheck_exclude_modules
A helper method to check if the passed module's key name matches any of the exclude modules in the adapter_config. Adapted from https://githu
verl/verl/utils/model.py:263
↓ 2 callersFunctioncheck_mutually_exclusive
Validate mutually exclusive micro batch size configuration options. Ensures that users don't set both deprecated micro_batch_size and
verl/verl/utils/config.py:117
↓ 2 callersFunctioncheck_target_modules
A helper method to check if the passed module's key name matches any of the target modules in the adapter_config. Adapted from https://github
verl/verl/utils/model.py:286
↓ 2 callersMethodcleanup
Stop worker threads/processes and cleanup resources.
infinity/model/cpu_master.py:1876
↓ 2 callersMethodclear_kv_cache
(self)
verl/verl/workers/rollout/vllm_rollout/vllm_async_server.py:595
↓ 2 callersFunctioncompute_gae_advantage_return
Adapted from https://github.com/huggingface/trl/blob/main/trl/trainer/ppo_trainer.py Args: token_level_rewards: `(torch.Tensor)`
verl/verl/trainer/ppo/core_algos.py:216
↓ 2 callersFunctioncompute_grpo_outcome_advantage
Compute advantage for GRPO, operating only on Outcome reward (with only one scalar reward for each response). Args: token_level_
verl/verl/trainer/ppo/core_algos.py:268
↓ 2 callersMethodcompute_log_prob
(self, data: DataProto)
verl/verl/workers/megatron_workers.py:900
↓ 2 callersMethodcompute_log_prob
(self, data: DataProto)
verl/verl/workers/fsdp_workers.py:1125
↓ 2 callersFunctioncompute_response_mask
Compute the attention mask for the response part of the sequence. This function extracts the portion of the attention mask that corresponds to th
verl/verl/trainer/ppo/ray_trainer.py:118
↓ 2 callersFunctioncompute_rollout_corr_metrics_from_logprobs
Compute rollout correction metrics from log probabilities during training. This function is used in the actor to compute metrics using the CURREN
verl/verl/trainer/ppo/rollout_corr_helper.py:1063
↓ 2 callersMethodcompute_teacher_logprobs_single
Compute teacher log probabilities for a single unpadded sequence.
verl/verl/experimental/teacher_loop/teacher_manager.py:107
↓ 2 callersFunctionconcat_tensordict
Concatenate multiple TensorDicts along dimension zero. Combines a list of TensorDicts into a single TensorDict by concatenating all tensors a
verl/verl/utils/tensordict_utils.py:224
↓ 2 callersFunctionconvert_checkpoint_from_transformers_to_megatron_dpskv3
( hf_model, model, hf_config, tfconfig, layer_start_end: Optional[tuple[int, int]] = None,
verl/scripts/converter_hf_to_mcore.py:330
↓ 2 callersFunctionconvert_megatron_to_hf_target_modules
Convert megatron lora target modules to HF-style module names. Args: megatron_modules: List of megatron-style module names. Returns:
verl/verl/utils/megatron_peft_utils.py:112
↓ 2 callersMethodconvert_param
(self, name: str, params_one_group: list[torch.Tensor])
verl/verl/models/mcore/weight_converter.py:30
↓ 2 callersFunctioncopy_async
Async copy from src to dst on given stream.
infinity/runtime/stream.py:55
↓ 2 callersFunctioncreate_and_sync_state
(param_name, state, is_param)
verl/verl/utils/fsdp_utils.py:341
↓ 2 callersFunctioncreate_colocated_worker_raw_cls
This function returns a FusedWorker class. `FusedWorker.{class_name}` -> FusedClass Use `class_name` as a param to directly access t
verl/verl/single_controller/ray/base.py:1029
↓ 2 callersFunctioncreate_data_samples
(num_device: int, model_config: DiffusionModelConfig)
verl/tests/models/test_diffusers_fsdp_engine.py:106
↓ 2 callersFunctioncreate_data_samples
(tokenizer, data_source="ocr")
verl/tests/experimental/reward_loop/test_visual_reward_manager.py:26
↓ 2 callersFunctioncreate_device_mesh
(world_size, fsdp_size)
verl/verl/workers/fsdp_workers.py:104
↓ 2 callersFunctioncreate_model
Load a Qwen3-1.7B model with only 2 layers from pretrained weights.
verl/tests/models/test_tiled_mlp_accuracy.py:34
↓ 2 callersFunctioncreate_peft_model
()
verl/tests/utils/test_normalize_peft_param_name_on_cpu.py:36
↓ 2 callersFunctioncreate_random_input_ids
(batch_size, seq_len, vocab_size)
verl/tests/utils/test_activation_offload.py:33
↓ 2 callersFunctioncreate_random_input_ids
(batch_size, seq_len, vocab_size)
verl/tests/special_distributed/test_fsdp_ckpt.py:31
↓ 2 callersFunctioncreate_role_worker_mapping
Create mapping from roles to worker classes Args: config: Configuration object Returns: dict: Mapping from roles to wor
verl/verl/experimental/separation/utils.py:57
↓ 2 callersFunctioncreate_sft_dataset
Create a dataset.
verl/verl/trainer/sft_trainer_ray.py:395
↓ 2 callersFunctioncreate_sft_dataset
Create a dataset.
verl/verl/trainer/sft_trainer.py:464
↓ 2 callersFunctioncreate_test_image
(width: int = 224, height: int = 224)
verl/tests/workers/rollout/rollout_trtllm/test_trtllm_rollout_utils.py:35
↓ 2 callersFunctioncreate_training_config
(model_type, strategy, device_count, model)
verl/tests/models/test_engine.py:71
↓ 2 callersFunctiondefault_tp_concat_fn
name: name of the parameter train_params: training parameters infer_params (Iterable[torch.Tensor]): a iterator towards list of parameter
verl/verl/utils/megatron_utils.py:940
↓ 2 callersMethodembed_suffix
Embed state, action and time tokens as the transformer suffix. Args: state: (B, state_dim) robot state; ignored when pi05 is enab
verl/verl/experimental/vla/models/pi0_torch/model/modeling_pi0.py:304
↓ 2 callersFunctionenable_qat_fuse
Enable QAT fuse mode: sets up fusion siblings for weight scale fusion.
verl/verl/utils/qat/core.py:177
↓ 2 callersMethodencode
(self, query_list: list[str], is_query=True)
verl/examples/sglang_multiturn/search_r1_like/local_dense_retriever/retrieval_server.py:78
↓ 2 callersMethodencode_prompt
( self, prompt_ids: torch.Tensor, attention_mask: torch.Tensor | None = None,
verl/examples/flowgrpo_trainer/vllm_omni/pipeline_qwenimage.py:119
↓ 2 callersMethodenv_interact_step
This function is used to interact with the environment.
verl/verl/experimental/vla/workers/env/env_worker.py:145
↓ 2 callersMethodenv_keys
The keys of the environment variables that are used to configure the Worker.
verl/verl/single_controller/base/worker.py:169
↓ 2 callersMethodeval_mode
Context manager entry for switching the engine and model into evaluation mode. Usage: with engine.eval_mode():
verl/verl/workers/engine/base.py:67
↓ 2 callersMethodexecute_rank_zero_async
Execute a method on rank zero worker asynchronously. Args: method_name: Name of the method to execute *args: Position
verl/verl/single_controller/ray/base.py:808
↓ 2 callersFunctionexport_qat_weights
Process exported weights through QATWeightExporter for quantized weight sync.
verl/verl/utils/modelopt/qat_utils.py:53
↓ 2 callersFunctionextract_solution
Extract the equation from the solution string.
verl/verl/utils/reward_score/search_r1_like_qa_em.py:66
↓ 2 callersFunctionextract_step
(path)
verl/verl/utils/checkpoint/checkpoint_handler.py:33
↓ 2 callersMethodfinalize
( self, processing_class: PreTrainedTokenizer | PreTrainedTokenizerFast | ProcessorMixin,
verl/verl/workers/rollout/schemas.py:551
↓ 2 callersMethodfinish_rollout
(self, mode="train")
verl/verl/experimental/vla/workers/env/env_worker.py:244
↓ 2 callersMethodfit
The training loop of PPO. The driver process only need to call the compute functions of the worker group through RPC to const
verl/verl/trainer/ppo/ray_trainer.py:1295
↓ 2 callersMethodflow_sde_beta
(self)
verl/verl/experimental/vla/models/pi0_torch/modeling_pi0_torch.py:366
↓ 2 callersMethodforward
Full forward pass for one diffusion denoising step. Args: images: List of image tensors, each shaped (B, C, H, W) after batching.
verl/verl/experimental/vla/models/pi0_torch/model/modeling_pi0.py:161
↓ 2 callersMethodforward_and_backward_custom_loss
Forward + backward with an externally provided loss function. Used by VERL integration where the loss is computed externally (PPO, DPO, etc.)
infinity/model/cpu_master.py:1623
↓ 2 callersMethodforward_backward_batch
( self, data: DataProto, forward_only=False, use_dynamic_bsz=False, mi
verl/verl/workers/critic/megatron_critic.py:159
↓ 2 callersMethodforward_backward_batch
We assume: - The model takes input: (input_ids, attention_mask, position_ids). No rmpad for the input - The communication sha
verl/verl/workers/actor/megatron_actor.py:399
↓ 2 callersFunctionforward_base_model
r""" Copy paste LLaMa's forward https://github.com/linkedin/Liger-Kernel/blob/main/src/liger_kernel/transformers/model/llama.py This func
verl/verl/models/transformers/dense_common.py:29
↓ 2 callersMethodforward_step
(self, micro_batch: TensorDict, loss_function, forward_only)
verl/verl/workers/engine/fsdp/transformer_impl.py:623
↓ 2 callersMethodfrom_string
(cls, name: str)
verl/verl/trainer/ppo/utils.py:59
↓ 2 callersFunctionfused_forward_model_engine
(vision_model: bool = False)
verl/verl/models/mcore/model_forward_fused.py:140
↓ 2 callersMethodgated_residual
(self, x, y, gate)
verl/verl/experimental/vla/models/pi0_torch/model/paligemma_with_expert.py:496
↓ 2 callersMethodgenerate
Generate text using the SGLang server asynchronously.
verl/verl/workers/rollout/sglang_rollout/http_server_engine.py:831
↓ 2 callersMethodgenerate_backward_inputs
(self)
verl/tests/utils/test_linear_cross_entropy.py:160
↓ 2 callersMethodgenerate_forward_inputs
(self)
verl/tests/utils/test_linear_cross_entropy.py:146
↓ 2 callersMethodgenerate_hyper
(self)
verl/tests/utils/test_linear_cross_entropy.py:113
↓ 2 callersMethodgenerate_sequences
Generate sequences
verl/verl/experimental/vla/sac/naive_rollout_pi05.py:55
↓ 2 callersMethodget
(self)
verl/verl/protocol.py:1212
↓ 2 callersFunctionget_checkpoint_tracker_filename
Tracker file rescords the latest chckpoint during training to restart from.
verl/verl/utils/checkpoint/checkpoint_manager.py:230
↓ 2 callersFunctionget_common_default_kwargs_for_parallel_linear
()
verl/verl/utils/megatron/tensor_parallel.py:52
↓ 2 callersFunctionget_custom_reward_fn
Load and return a custom reward function from external file. Dynamically imports a reward function from a specified file path and wraps it wi
verl/verl/trainer/ppo/reward.py:50
↓ 2 callersFunctionget_data
()
verl/verl/utils/tensordict_utils.py:604
↓ 2 callersMethodget_data_parallel_group
(self)
verl/verl/workers/engine/veomni/transformer_impl.py:306
↓ 2 callersMethodget_data_parallel_group
(self)
verl/verl/workers/engine/fsdp/diffusers_impl.py:430
↓ 2 callersMethodget_data_parallel_rank
(self)
verl/verl/workers/engine/megatron/transformer_impl.py:524
↓ 2 callersMethodget_data_parallel_size
(self)
verl/verl/workers/engine/fsdp/transformer_impl.py:576
↓ 2 callersFunctionget_dp_group_size
Get data-parallel group size from device mesh.
verl/verl/workers/engine/automodel/utils.py:46
↓ 2 callersFunctionget_entropy_reduction_enum
Get the enum for the reduction method of cross entropy.
verl/verl/utils/kernel/kernels.py:129
← previousnext →901–1,000 of 5,181, ranked by callers