MCPcopy Create free account

hub / github.com/DLYuanGod/MegaTrain / functions

Functions5,181 in github.com/DLYuanGod/MegaTrain

↓ 820 callersMethodget
Dict-like get for compatibility with code that uses skip.get('enable', False).
verl/verl/workers/config/rollout.py:52
↓ 799 callersMethodappend
(self, value: Union[Numeric, "Metric"])
verl/verl/utils/metric/utils.py:103
↓ 298 callersMethodto
Move model parameters, optimizer states, or both to the specified device. Args: device: Target device identifier.
verl/verl/workers/engine/base.py:169
↓ 209 callersMethodget
(self)
verl/tests/single_controller/test_nested_worker.py:31
↓ 206 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/verl/protocol.py:721
↓ 198 callersFunctionget_device_name
Get the device type string based on available accelerators. Detects the available accelerator and returns the corresponding PyTorch device ty
verl/verl/utils/device.py:71
↓ 178 callersMethodget
Get the value associated with the given key. If the key does not exist, return the default value. Args: key (str): The attribute
verl/verl/base_config.py:40
↓ 166 callersMethodsplit
split the dataset into num_splits sub-datasets Args: num_splits: specified number of splits Returns:
verl/verl/utils/dataset/rl_dataset.py:416
↓ 153 callersMethodtime
Time a code block.
infinity/simple_profiler.py:36
↓ 145 callersMethodget
Get parameter with default.
verl/verl/utils/qat/vllm_patch.py:193
↓ 145 callersMethodupdate
Update method for fixed KL controller (no-op). Args: current_kl (float): Current KL divergence value (unused). n_step
verl/verl/trainer/ppo/core_algos.py:183
↓ 141 callersMethodparameters
(self)
infinity/model/transformer.py:80
↓ 138 callersMethodcpu
Move working copy back to CPU and free GPU memory.
infinity/optimizer.py:22
↓ 131 callersMethodtolist
(self)
verl/tests/utils/test_tokenizer_normalize_on_cpu.py:30
↓ 130 callersMethodload
Load the replay pool from a directory.
verl/verl/experimental/vla/sac/replay_pool.py:242
↓ 122 callersFunctionget_torch_device
Get the PyTorch device module for the current accelerator. Returns the torch device namespace (e.g., torch.cuda, torch.npu) based on the dete
verl/verl/utils/device.py:89
↓ 117 callersMethodgetenv
(self, key)
verl/tests/single_controller/test_ray_local_envs_on_cpu.py:31
↓ 108 callersMethodextend
(self, values: Union["Metric", list[Numeric]])
verl/verl/utils/metric/utils.py:115
↓ 105 callersMethodto
(self, device: torch.device | str)
verl/verl/experimental/vla/models/pi0_torch/pi0_utils.py:54
↓ 103 callersMethodget
Get a rollout replica class by name.
verl/verl/workers/rollout/replica.py:315
↓ 102 callersMethodto
(self, device: torch.device)
infinity/model/transformer.py:75
↓ 97 callersMethodrecord
(self, stream: Optional[torch.cuda.Stream] = None)
infinity/csrc/__init__.py:67
↓ 91 callersFunctionget_device_id
Get the index of the current accelerator device. Returns: int: The current device index (e.g., 0 for 'cuda:0').
verl/verl/utils/device.py:107
↓ 90 callersFunctionomega_conf_to_dataclass
Convert an OmegaConf DictConfig to a dataclass. Args: config: The OmegaConf DictConfig or dict to convert. dataclass_type: T
verl/verl/utils/config.py:23
↓ 90 callersMethodsynchronize
Block until event completes.
infinity/csrc/__init__.py:75
↓ 90 callersMethodvalues
(cls)
verl/verl/utils/py_functional.py:255
↓ 89 callersFunctionmarked_timer
Context manager for timing with platform markers. This utility function measures the execution time of code within its context, accumulates t
verl/verl/utils/profiler/performance.py:172
↓ 87 callersMethodto
move the batch to device Args: device (torch.device, str): torch device Returns: DataProto: the current Data
verl/verl/protocol.py:586
↓ 86 callersFunctionlog_gpu_memory_usage
Log GPU memory usage information. Args: head (str): A descriptive header for the memory usage log message. logger (logging.Logger
verl/verl/utils/profiler/performance.py:63
↓ 80 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/verl/protocol.py:496
↓ 71 callersMethodcreate
Create a tool instance. Args: instance_id: The instance id of the tool. Returns: The instance id of the tool
verl/verl/tools/base_tool.py:46
↓ 67 callersFunctionsafe_copy
( src_tensor: torch.Tensor, dst_tensor: torch.Tensor, skip_dtype_assert: bool = False, )
verl/scripts/converter_hf_to_mcore.py:209
↓ 66 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/verl/protocol.py:600
↓ 66 callersMethodstate_dict
(self)
verl/verl/workers/engine/torchtitan/utils.py:57
↓ 65 callersMethodinit
(self)
verl/tests/single_controller/test_rvdz.py:26
↓ 65 callersMethodshutdown
(self)
verl/tests/utils/test_special_megatron_kl_loss_tp.py:46
↓ 65 callersMethodupdate
(self, batch: DataProto)
verl/verl/experimental/dataset/sampler.py:39
↓ 55 callersMethodfrom_pretrained
(cls, save_directory: str | os.PathLike, **kwargs)
verl/tests/special_e2e/envs/digit_completion/tokenizer.py:151
↓ 49 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/verl/protocol.py:864
↓ 48 callersMethodsleep
Sleep each rollout server.
verl/verl/workers/rollout/replica.py:279
↓ 47 callersMethodclose
(self)
verl/verl/experimental/vla/envs/isaac_env/isaac_env.py:303
↓ 44 callersMethodlog
(self, data, step, backend=None)
verl/verl/utils/tracking.py:181
↓ 42 callersFunctionlog_with_rank
_summary_ Log a message with rank information using a logger. This function logs the message only if `log_only_rank_0` is False or if the rank
verl/verl/utils/logger/aggregate_logger.py:128
↓ 42 callersMethodsplit
Split the batch among dim=0 into chunks. The meta_info is passed to each DataProto after split. Args: split_size (int): the size
verl/verl/protocol.py:905
↓ 42 callersMethodzero_grad
Zero out accumulated gradients.
infinity/optimizer.py:27
↓ 40 callersMethodrepeat
Repeat the batch data a specified number of times. Args: repeat_times (int): Number of times to repeat the data.
verl/verl/protocol.py:971
↓ 40 callersMethodwhere
Return current device of a layer.
infinity/memory/layer_manager.py:31
↓ 39 callersFunctionfsdp_version
(model)
verl/verl/utils/fsdp_utils.py:402
↓ 38 callersFunctionfunc
(self, *args, **kwargs)
verl/verl/single_controller/ray/base.py:931
↓ 37 callersMethodconcat
Concat a list of DataProto. The batch is concatenated among dim=0. The meta_info is merged, with special handling for metrics from different w
verl/verl/protocol.py:917
↓ 37 callersFunctionhf_tokenizer
Create a huggingface pretrained tokenizer which correctness handles eos and pad tokens. Args: name (str): The name of the tokenizer.
verl/verl/utils/tokenizer.py:74
↓ 36 callersMethodrun
Execute the main PPO training workflow. This method sets up the distributed training environment, initializes workers, datasets, and
verl/verl/trainer/main_ppo.py:310
↓ 36 callersMethodstep
(self)
verl/verl/utils/rollout_skip.py:154
↓ 35 callersMethodfrom_pretrained
(cls, pretrained_model_name_or_path, *model_args, **kwargs)
verl/verl/experimental/vla/models/pi0_torch/modeling_pi0_torch.py:254
↓ 35 callersMethodstart
(self, **kwargs)
verl/verl/utils/profiler/profile.py:149
↓ 33 callersFunctioncopy_to_local
Copy files/directories from HDFS to local cache with validation. Args: src (str): Source path - HDFS path (hdfs://...), local filesystem
verl/verl/utils/fs.py:195
↓ 33 callersMethodwait_event
Make this stream wait for an event.
infinity/runtime/stream.py:39
↓ 32 callersMethoddecode
(self, ids: list[int] | torch.Tensor, skip_special_tokens: bool = True)
verl/tests/experimental/agent_loop/test_agent_loop_extra_fields_schema_on_cpu.py:113
↓ 31 callersMethodto_dtype
(precision)
verl/verl/utils/torch_dtypes.py:61
↓ 30 callersMethodpad
( self, encoded_inputs: dict[str, list[int]], *, padding: str, max_len
verl/tests/experimental/agent_loop/test_agent_loop_extra_fields_schema_on_cpu.py:83
↓ 30 callersMethodsearch
(self, query: str, num: int = None, return_score: bool = False)
verl/examples/sglang_multiturn/search_r1_like/local_dense_retriever/retrieval_server.py:139
↓ 30 callersFunctionunwrap_model
(model, module_instances=ALL_MODULE_WRAPPER_CLASSNAMES)
verl/verl/utils/megatron_utils.py:381
↓ 29 callersMethodadd
(self, idx: int, val: int)
verl/verl/utils/seqlen_balancing.py:78
↓ 29 callersMethodsub
(self, data: DataProto)
verl/tests/single_controller/test_colocated_workers.py:47
↓ 28 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/verl/utils/ulysses.py:62
↓ 28 callersMethodprofile
Context manager for profiling a code block.
infinity/profiler.py:66
↓ 28 callersMethodsleep
Sleep all rollout replica instances.
verl/verl/experimental/reward_loop/reward_model.py:107
↓ 27 callersMethodinit_process_group
Init process group for checkpoint engine. Args: **kwargs: Keyword arguments from `build_topology`.
verl/verl/checkpoint_engine/base.py:144
↓ 27 callersMethodsave
Save the replay pool to a directory.
verl/verl/experimental/vla/sac/replay_pool.py:203
↓ 26 callersMethodsave_pretrained
(self, save_directory: str | os.PathLike, **kwargs)
verl/tests/special_e2e/envs/digit_completion/tokenizer.py:144
↓ 25 callersMethodacquire
Acquire tokens from the bucket, waiting if necessary. This method will block (using asyncio.sleep) until sufficient tokens are availa
verl/verl/experimental/reward_loop/reward_manager/limited.py:90
↓ 25 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/verl/workers/rollout/tokenizer.py:89
↓ 25 callersMethodfrom_config
(cls, config: dict)
verl/tests/special_e2e/envs/digit_completion/tokenizer.py:137
↓ 24 callersFunctionagg_loss
Aggregate the loss across global batch to ensure the loss is invariant to fsdp/megatron parallelism. NOTE: The returned loss has different b
verl/verl/trainer/ppo/core_algos.py:1138
↓ 24 callersMethodfrom_dict
(cls, data: dict[str, Numeric], aggregation: str | AggregationType)
verl/verl/utils/metric/utils.py:159
↓ 24 callersMethodgenerate_sequences
Batch generate sequences in sync mode. Args: prompts: The input prompts. Returns: The output sequences.
verl/verl/workers/rollout/base.py:71
↓ 24 callersMethodget_resource_pool
Get the resource pool of the worker_cls
verl/verl/single_controller/ray/base.py:211
↓ 24 callersFunctionoffload_fsdp_model_to_cpu
(model: FSDP, empty_cache: bool = True)
verl/verl/utils/fsdp_utils.py:147
↓ 24 callersFunctionprint_rank_0
If distributed is initialized, print only on rank 0.
verl/verl/utils/logger/aggregate_logger.py:89
↓ 24 callersMethodunion
(self, other: "ProfilerConfig")
verl/verl/utils/profiler/config.py:160
↓ 23 callersMethodinit
( cls, project_name: str, experiment_name: str, backend: str, token2te
verl/verl/utils/rollout_trace.py:69
↓ 23 callersFunctionlogprobs_from_logits
Compute per-token log-probabilities for the given labels. Uses a Flash-Attention–based cross-entropy (if available) for efficient backward,
verl/verl/utils/torch_functional.py:72
↓ 23 callersMethodstore
(self)
verl/verl/single_controller/base/worker_group.py:60
↓ 22 callersMethodbackward
Backward pass with proper gradient computation. Returns: grad_x, grad_weight, None (for eps)
infinity/ops/layers.py:44
↓ 22 callersFunctioncopy
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/verl/utils/hdfs_io.py:84
↓ 22 callersMethodget
(self)
verl/verl/utils/rendezvous/ray_backend.py:28
↓ 21 callersMethodfrom_single_dict
(cls, data, meta_info=None, auto_padding=False)
verl/tests/test_protocol_on_cpu.py:580
↓ 21 callersFunctionload_fsdp_model_to_gpu
(model: FSDP)
verl/verl/utils/fsdp_utils.py:181
↓ 21 callersFunctionnormalize_token_ids
Normalize tokenizer outputs into a flat ``list[int]``. This handles Transformers 4/5 differences where ``apply_chat_template(tokenize=True)``
verl/verl/utils/tokenizer.py:22
↓ 20 callersMethodapply_chat_template
Apply chat template to messages with optional tools, images, and videos. Args: messages (list[dict]): Input messages.
verl/verl/experimental/agent_loop/agent_loop.py:329
↓ 20 callersFunctioncompute_rollout_correction_and_rejection_mask
Unified interface for computing IS weights and rejection masks. This function combines IS weight calculation (truncated) and rejection sampling (
verl/verl/trainer/ppo/rollout_corr_helper.py:779
↓ 20 callersMethoddump
(self, outputs: DataProto)
verl/verl/utils/rollout_skip.py:318
↓ 20 callersMethodelapsed_time
Milliseconds between this event and end_event.
infinity/csrc/__init__.py:79
↓ 20 callersFunctionmakedirs
r"""Works like os.makedirs() but supports hdfs. Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except tha
verl/verl/utils/hdfs_io.py:50
↓ 19 callersMethod_register_dispatch_collect_info
Register the dp_rank for a given mesh name. This function is meant to be called by the worker Args: mesh_name (str):
verl/verl/single_controller/base/worker.py:86
↓ 19 callersFunctionaggressive_empty_cache
More aggressive GPU memory cleanup function, tries to release PyTorch reserved but unallocated memory. Args: force_sync: Whether
verl/verl/utils/memory_utils.py:31
↓ 19 callersFunctionhf_processor
Create a huggingface processor to process multimodal data. Args: name_or_path (str): The name of the processor. Returns: Opt
verl/verl/utils/tokenizer.py:104
↓ 19 callersMethodspawn
Spawn to a dictionary of worker groups, each with a subset of method with prefix. Args: prefix_set: Set of prefixes to create wor
verl/verl/single_controller/ray/base.py:712
↓ 19 callersMethodstart_interaction
Create a tool instance. Args: instance_id: The instance id of the tool. Returns: The instance id of the tool
verl/verl/interactions/base.py:25
↓ 19 callersMethodto_tensordict
Convert this DataProto to TensorDict. Note that this requires tensordict version at least 0.10 Returns:
verl/verl/protocol.py:1102
next →1–100 of 5,181, ranked by callers