Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/McGill-NLP/the-markovian-thinker
/ functions
Functions
2,081 in github.com/McGill-NLP/the-markovian-thinker
⨍
Functions
2,081
◇
Types & classes
332
↳
Endpoints
60
↓ 679 callers
Method
get
Return a tensor with the input `shape` as a view into the 1-D data starting at `start_index`.
verl/utils/memory_buffer.py:45
↓ 215 callers
Method
to
Move model parameters, optimizer states, or both to the specified device. Args: device: Target device identifier.
verl/workers/engine/base.py:152
↓ 157 callers
Method
update
Update method for fixed KL controller (no-op). Args: current_kl (float): Current KL divergence value (unused). n_step
verl/trainer/ppo/core_algos.py:176
↓ 156 callers
Method
split
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/protocol.py:833
↓ 124 callers
Function
get_torch_device
Return the corresponding torch attribute based on the device type string. Returns: module: The corresponding torch device namespace, or to
verl/utils/device.py:55
↓ 112 callers
Function
get_device_id
Return current device id based on the device type. Returns: device index
verl/utils/device.py:68
↓ 93 callers
Method
pop
Pop a subset of the DataProto via `batch_keys` and `meta_info_keys` Args: batch_keys (list, optional): a list of strings indicati
verl/protocol.py:649
↓ 89 callers
Function
log_gpu_memory_usage
Log GPU memory usage information. Args: head (str): A descriptive header for the memory usage log message. logger (logging.Logger
verl/utils/profiler/performance.py:63
↓ 85 callers
Function
print_rank_0
If distributed is initialized, print only on rank 0.
verl/utils/logger/aggregate_logger.py:89
↓ 70 callers
Method
get
Return a tensor with the input `shape` as a view into the 1-D data starting at `start_index`.
verl/utils/megatron/memory.py:31
↓ 67 callers
Function
safe_copy
( src_tensor: torch.Tensor, dst_tensor: torch.Tensor, skip_dtype_assert: bool = False, )
scripts/converter_hf_to_mcore.py:193
↓ 52 callers
Method
chunk
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/protocol.py:792
↓ 42 callers
Function
marked_timer
Context manager for timing with platform markers. This utility function measures the execution time of code within its context, accumulates t
verl/utils/profiler/performance.py:172
↓ 40 callers
Function
log_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/utils/logger/aggregate_logger.py:128
↓ 39 callers
Function
get_device_name
Function that gets the torch.device based on the current machine. This currently only supports CPU, CUDA, NPU. Returns: device
verl/utils/device.py:40
↓ 36 callers
Function
copy_to_local
Copy files/directories from HDFS to local cache with validation. Args: src (str): Source path - HDFS path (hdfs://...) or local filesyste
verl/utils/fs.py:195
↓ 34 callers
Method
decode
Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special tokens and clean up tokeniz
verl/workers/rollout/tokenizer.py:89
↓ 34 callers
Method
select
Select a subset of the DataProto via batch_keys and meta_info_keys Args: batch_keys (list, optional): a list of strings indicatin
verl/protocol.py:528
↓ 30 callers
Function
omega_conf_to_dataclass
Convert an OmegaConf DictConfig to a dataclass. Args: config: The OmegaConf DictConfig or dict to convert. dataclass_type: T
verl/utils/config.py:23
↓ 26 callers
Function
pad_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/utils/torch_functional.py:371
↓ 25 callers
Method
concat
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/protocol.py:845
↓ 25 callers
Method
repeat
Repeat the batch data a specified number of times. Args: repeat_times (int): Number of times to repeat the data.
verl/protocol.py:875
↓ 25 callers
Method
values
(cls)
verl/utils/py_functional.py:229
↓ 22 callers
Method
create
Create a tool instance. Args: instance_id: The instance id of the tool. Returns: The instance id of the tool
verl/tools/base_tool.py:46
↓ 22 callers
Function
gather_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/utils/ulysses.py:62
↓ 22 callers
Function
hf_tokenizer
Create a huggingface pretrained tokenizer which correctness handles eos and pad tokens. Args: name (str): The name of the tokenizer.
verl/utils/tokenizer.py:36
↓ 21 callers
Method
get
(self)
verl/utils/rendezvous/ray_backend.py:28
↓ 20 callers
Method
add
(self, idx: int, val: int)
verl/utils/seqlen_balancing.py:33
↓ 20 callers
Function
fsdp_version
(model)
verl/utils/fsdp_utils.py:398
↓ 20 callers
Method
store
(self)
verl/single_controller/base/worker_group.py:60
↓ 20 callers
Function
unwrap_model
(model, module_instances=ALL_MODULE_WRAPPER_CLASSNAMES)
verl/utils/megatron_utils.py:224
↓ 19 callers
Function
func
(self, *args, **kwargs)
verl/single_controller/ray/base.py:699
↓ 19 callers
Method
union
(self, other: "ProfilerConfig")
verl/utils/profiler/config.py:100
↓ 18 callers
Function
offload_fsdp_model_to_cpu
(model: FSDP, empty_cache: bool = True)
verl/utils/fsdp_utils.py:143
↓ 17 callers
Method
from_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/protocol.py:465
↓ 17 callers
Method
get_rng_state
()
verl/utils/checkpoint/checkpoint_manager.py:145
↓ 17 callers
Method
to_dtype
(precision)
verl/utils/torch_dtypes.py:61
↓ 16 callers
Function
convert_config
[Deprecated] convert config Args: hf_config (PretrainedConfig): _description_ megatron_config (_type_): _description_ Return
verl/utils/megatron_utils.py:239
↓ 16 callers
Method
generate_sequences
Generate sequences
verl/workers/rollout/base.py:26
↓ 15 callers
Method
_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/single_controller/base/worker.py:82
↓ 15 callers
Function
agg_loss
Aggregate the loss matrix into a scalar. Args: loss_mat: `(torch.Tensor)`: shape: (bs, response_length) loss_mas
verl/trainer/ppo/core_algos.py:703
↓ 15 callers
Method
encode
Converts a string to a sequence of ids (integer), using the tokenizer and vocabulary. Args: text (`str`, `List[str]` or
verl/workers/rollout/tokenizer.py:73
↓ 15 callers
Function
load_fsdp_model_to_gpu
(model: FSDP)
verl/utils/fsdp_utils.py:177
↓ 15 callers
Method
step
(self)
verl/utils/profiler/profile.py:94
↓ 14 callers
Function
hf_processor
Create a huggingface processor to process multimodal data. Args: name_or_path (str): The name of the processor. Returns: tra
verl/utils/tokenizer.py:66
↓ 14 callers
Method
init
(cls, project_name: str, experiment_name: str, backend: str, token2text: bool = False)
verl/utils/rollout_trace.py:58
↓ 14 callers
Method
init_model
Instantiate or load the model, optimizer, and learning rate scheduler. Should prepare all components necessary for training or evalu
verl/workers/engine/base.py:41
↓ 14 callers
Function
offload_megatron_model_to_cpu
In megatron, the model and optimizer storage are: - bf16 parameter data chunked in model parallel group - fp32 grad chunked in model para
verl/utils/megatron_utils.py:322
↓ 13 callers
Method
log
(self, data, step, backend=None)
verl/utils/tracking.py:136
↓ 13 callers
Method
update_content
(self, search_keyword: Optional[str] = None)
scripts/rollout_viewer.py:292
↓ 12 callers
Function
append_to_dict
Append values from new_data to lists in data. For each key in new_data, this function appends the corresponding value to a list stored under
verl/utils/py_functional.py:165
↓ 12 callers
Method
get_resource_pool
Get the resource pool of the worker_cls
verl/trainer/ppo/ray_trainer.py:112
↓ 12 callers
Function
get_ulysses_sequence_parallel_world_size
Get ulysses sequence parallel world size.
verl/utils/ulysses.py:46
↓ 12 callers
Method
named_parameters
(self)
verl/utils/memory_buffer.py:209
↓ 12 callers
Function
simple_timer
Context manager for basic timing without NVTX markers. This utility function measures the execution time of code within its context and accum
verl/utils/profiler/performance.py:155
↓ 11 callers
Function
load_megatron_model_to_gpu
(models, load_grad=True)
verl/utils/megatron_utils.py:358
↓ 11 callers
Function
local_mkdir_safe
_summary_ Thread-safe directory creation function that ensures the directory is created even if multiple processes attempt to create it simult
verl/utils/fs.py:264
↓ 11 callers
Method
register
(cls, name: str)
verl/utils/py_functional.py:254
↓ 11 callers
Method
save
(self)
verl/utils/profiler/profile.py:103
↓ 10 callers
Function
get_ulysses_sequence_parallel_group
Get ulysses sequence parallel process group.
verl/utils/ulysses.py:38
↓ 10 callers
Function
offload_fsdp_optimizer
(optimizer)
verl/utils/fsdp_utils.py:203
↓ 10 callers
Function
preprocess_packed_seqs
Preprocess packed sequences CP splits sequence into CP*2 chunks, and each GPU gets 2 chunks (GPU0 gets first and last chunks, GPU1 gets s
verl/models/mcore/util.py:23
↓ 10 callers
Function
rearrange_micro_batches
Split a batch into micro-batches by total token count, with optional DP sync and padding. Args: batch (TensorDict): must include "at
verl/utils/seqlen_balancing.py:250
↓ 10 callers
Method
select_idxs
Select specific indices from the DataProto. Args: idxs (torch.Tensor or numpy.ndarray or list): Indices to select
verl/protocol.py:563
↓ 9 callers
Method
_handle_apply_chat_template
( processing_class: PreTrainedTokenizer | PreTrainedTokenizerFast | ProcessorMixin, messages:
verl/workers/rollout/schemas.py:222
↓ 9 callers
Function
_megatron_calc_global_rank
Calculate global rank with support for CP/EP parallelism
verl/models/mcore/saver.py:30
↓ 9 callers
Function
aggressive_empty_cache
More aggressive GPU memory cleanup function, tries to release PyTorch reserved but unallocated memory. Args: force_sync: Whether to
verl/utils/memory_utils.py:24
↓ 9 callers
Function
get_nccl_backend
Return nccl backend type based on the device type. Returns: nccl backend type string.
verl/utils/device.py:76
↓ 9 callers
Method
sleep
Sleep engine to offload model weights and discard kv cache.
verl/workers/rollout/async_server.py:116
↓ 9 callers
Method
to
move the batch to device Args: device (torch.device, str): torch device Returns: DataProto: the current Data
verl/protocol.py:514
↓ 8 callers
Function
_broadcast_tensor
broadcast tensor from rank0 across mp_group
verl/models/mcore/loader.py:104
↓ 8 callers
Function
compute_position_id_with_mask
(mask)
verl/utils/model.py:219
↓ 8 callers
Function
compute_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/trainer/ppo/ray_trainer.py:196
↓ 8 callers
Method
dump
(self, outputs: DataProto)
verl/utils/rollout_skip.py:105
↓ 8 callers
Method
rank
Get the rank of this worker in the distributed setup.
verl/single_controller/base/worker.py:276
↓ 8 callers
Method
remove
(cls, name: str)
verl/utils/py_functional.py:265
↓ 7 callers
Function
_megatron_calc_global_rank
given TP,DP,PP rank to get the global rank.
verl/models/qwen2/megatron/checkpoint_utils/qwen2_saver.py:29
↓ 7 callers
Function
_megatron_calc_global_rank
given TP,DP,PP rank to get the global rank.
verl/models/llama/megatron/checkpoint_utils/llama_saver.py:29
↓ 7 callers
Function
apply_rotary_pos_emb
Applies Rotary Position Embedding to the query and key tensors. Args: q (`torch.Tensor`): The query tensor. k (`torch.Tensor`): T
verl/models/transformers/kimi_vl.py:43
↓ 7 callers
Method
async_generate
( self, *args, concurrent_reward_computation: bool = False, reward_manager: Op
verl/workers/rollout/sglang_rollout/sglang_rollout_custom.py:98
↓ 7 callers
Method
from_single_dict
Create a DataProto from a dict of tensors and non_tensors
verl/protocol.py:449
↓ 7 callers
Function
gather_heads_scatter_seq
A func to sync attention result with alltoall in sequence parallel gather head dimension and scatter seq dim: e.g. seq_dim: 1, head_dim:
verl/utils/ulysses.py:86
↓ 7 callers
Function
get_reverse_idx
Build the inverse of an index mapping. Args: idx_map (Sequence[int]): Sequence where idx_map[i] = j. Returns: List[int]
verl/utils/seqlen_balancing.py:322
↓ 7 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/utils/fs.py:34
↓ 7 callers
Function
load_extern_type
Load a external data type based on the file path and type name
verl/utils/import_utils.py:83
↓ 7 callers
Method
log
(self, data, step)
verl/utils/logger/aggregate_logger.py:49
↓ 7 callers
Function
masked_mean
Compute the mean of `values` over elements selected by `mask`. Args: values (Tensor): Input tensor. mask (Tensor): Boolean o
verl/utils/torch_functional.py:171
↓ 7 callers
Method
merge
(self, other)
verl/utils/seqlen_balancing.py:37
↓ 7 callers
Function
offload_megatron_optimizer
(optimizers)
verl/utils/megatron_utils.py:467
↓ 7 callers
Function
repeat_kv
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch, num_key_value_heads, seqlen, he
verl/models/transformers/kimi_vl.py:79
↓ 7 callers
Method
start
(self)
verl/utils/profiler/profile.py:89
↓ 7 callers
Function
ulysses_pad_and_slice_inputs
Pad and slice input_ids to be divisible by sp_size Pad position_ids to be divisible by sp_size. Note both input_ids_rmpad and position_i
verl/utils/ulysses.py:296
↓ 7 callers
Method
wake_up
(self)
verl/workers/sharding_manager/fsdp_sglang.py:126
↓ 6 callers
Function
_broadcast_tensor
broadcast tensor from rank0 across mp_group
verl/models/qwen2/megatron/checkpoint_utils/qwen2_loader_depracated.py:104
↓ 6 callers
Function
_broadcast_tensor
broadcast tensor across mp_group
verl/models/mcore/saver.py:141
↓ 6 callers
Function
_broadcast_tensor
broadcast tensor from rank0 across mp_group
verl/models/llama/megatron/checkpoint_utils/llama_loader_depracated.py:106
↓ 6 callers
Method
_dump_generations
Dump rollout/validation samples as JSONL.
verl/trainer/ppo/ray_trainer.py:576
↓ 6 callers
Function
_fetch_tensor
fetch tensor
verl/models/qwen2/megatron/checkpoint_utils/qwen2_loader.py:104
↓ 6 callers
Function
_fetch_tensor
fetch tensor
verl/models/llama/megatron/checkpoint_utils/llama_loader.py:106
↓ 6 callers
Function
_get_base_transformer_config
Create a base TransformerConfig with common parameters across different model architectures. TODO: (ycl) use dataclass or converter config?
verl/models/mcore/config_converter.py:32
next →
1–100 of 2,081, ranked by callers