实用工具 ============ 最后更新时间:05/19/2025(API 文档字符串由自动生成)。 本节记录了 VERL 库中的实用函数和类。 Python 函数式实用工具 ------------------------------ .. automodule:: verl.utils.py_functional :members: append_to_dict 文件系统实用工具 ------------------------ .. automodule:: verl.utils.fs :members: copy_to_local 跟踪实用工具 --------------------- .. automodule:: verl.utils.tracking :members: Tracking 指标实用工具 --------------------- .. automodule:: verl.utils.metric :members: reduce_metrics 检查点管理 ------------------------ .. automodule:: verl.utils.checkpoint.checkpoint_manager :members: find_latest_ckpt_path .. automodule:: verl.utils.checkpoint.fsdp_checkpoint_manager :members: FSDPCheckpointManager 数据集实用工具 --------------------- .. automodule:: verl.utils.dataset.rl_dataset :members: RLHFDataset, collate_fn Torch 函数式实用工具 ----------------------------- .. automodule:: verl.utils.torch_functional :members: get_constant_schedule_with_warmup, masked_whiten, masked_mean, logprobs_from_logits 序列长度平衡 ---------------------------- .. automodule:: verl.utils.seqlen_balancing :members: get_reverse_idx, rearrange_micro_batches Ulysses 实用工具 -------------------- .. automodule:: verl.utils.ulysses :members: gather_outputs_and_unpad, ulysses_pad_and_slice_inputs FSDP 实用工具 ------------------ .. automodule:: verl.utils.fsdp_utils :members: get_fsdp_wrap_policy, get_init_weight_context_manager, init_fn, load_fsdp_model_to_gpu, load_fsdp_optimizer, offload_fsdp_model_to_cpu, offload_fsdp_optimizer, 调试实用工具 ------------------- .. automodule:: verl.utils.profiler :members: log_gpu_memory_usage, GPUMemoryLogger (注:以上标题和描述翻译为中文以提高易懂性。例如,“Functional Utilities”指函数式编程相关的工具函数,“File System Utilities”指文件系统操作的辅助工具,“Checkpoint Management”指检查点(模型保存点)的管理模块。)