SYMBOL INDEX (1686 symbols across 245 files) FILE: Diff-Transformer/Diff-Transformer-V2/multihead_flashdiffv2.py function diff_func (line 9) | def diff_func(attn1: torch.Tensor, attn2: torch.Tensor, lambda_val: torc... class MultiheadFlashDiffV2 (line 13) | class MultiheadFlashDiffV2(nn.Module): method __init__ (line 17) | def __init__( method forward (line 39) | def forward( FILE: Diff-Transformer/kernel/rotary.py function rotary_kernel (line 21) | def rotary_kernel( function apply_rotary (line 144) | def apply_rotary( class ApplyRotaryEmb (line 242) | class ApplyRotaryEmb(torch.autograd.Function): method forward (line 244) | def forward( method backward (line 278) | def backward(ctx, do): function apply_rotary_emb (line 302) | def apply_rotary_emb( FILE: Diff-Transformer/multihead_attention.py function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor: class MultiheadAttention (line 27) | class MultiheadAttention(nn.Module): method __init__ (line 28) | def __init__( method forward (line 51) | def forward( FILE: Diff-Transformer/multihead_diffattn.py function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor: function lambda_init_fn (line 26) | def lambda_init_fn(depth): class MultiheadDiffAttn (line 30) | class MultiheadDiffAttn(nn.Module): method __init__ (line 31) | def __init__( method forward (line 69) | def forward( FILE: Diff-Transformer/multihead_flashdiff_1.py function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor: function lambda_init_fn (line 26) | def lambda_init_fn(depth): class MultiheadFlashDiff1 (line 30) | class MultiheadFlashDiff1(nn.Module): method __init__ (line 36) | def __init__( method forward (line 74) | def forward( FILE: Diff-Transformer/multihead_flashdiff_2.py function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor: function lambda_init_fn (line 26) | def lambda_init_fn(depth): class MultiheadFlashDiff2 (line 30) | class MultiheadFlashDiff2(nn.Module): method __init__ (line 35) | def __init__( method forward (line 73) | def forward( FILE: Diff-Transformer/rms_norm.py class RMSNorm (line 4) | class RMSNorm(nn.Module): method __init__ (line 5) | def __init__(self, dim: int, eps: float = 1e-6, elementwise_affine=Tru... method _norm (line 15) | def _norm(self, x): method forward (line 18) | def forward(self, x): method extra_repr (line 24) | def extra_repr(self) -> str: FILE: LatentLM/evaluate_fid.py function parse_args (line 21) | def parse_args(): function suppress_output (line 101) | def suppress_output(rank): function main (line 107) | def main(args): FILE: LatentLM/evaluate_fid_fidelity.py function parse_args (line 11) | def parse_args(): class ImageDataset (line 69) | class ImageDataset(torch.utils.data.Dataset): method __init__ (line 70) | def __init__(self, images): method __len__ (line 73) | def __len__(self): method __getitem__ (line 76) | def __getitem__(self, idx): class RefImageDataset (line 79) | class RefImageDataset(torch.utils.data.Dataset): method __init__ (line 80) | def __init__(self, dataset): method __len__ (line 83) | def __len__(self): method __getitem__ (line 86) | def __getitem__(self, idx): function main (line 93) | def main(args): FILE: LatentLM/inference_speed.py function parse_args (line 16) | def parse_args(): function suppress_output (line 102) | def suppress_output(rank): function main (line 108) | def main(args): FILE: LatentLM/metrics/IS.py function inception_softmax (line 16) | def inception_softmax(inception_model, images): function calculate_kl_div (line 24) | def calculate_kl_div(ps, splits: int): function compute_inception_score_from_dataset (line 40) | def compute_inception_score_from_dataset(dataset, function compute_inception_score_from_files (line 70) | def compute_inception_score_from_files(path, function compute_inception_score_from_tensor (line 86) | def compute_inception_score_from_tensor(tensor, FILE: LatentLM/metrics/fid.py class InceptionWrapper (line 19) | class InceptionWrapper(InceptionV3): method forward (line 21) | def forward(self, inp): method get_logits (line 31) | def get_logits(self, inp): function get_inception_model (line 37) | def get_inception_model(dims=2048): function mean_covar_torch (line 43) | def mean_covar_torch(xs): function mean_covar_numpy (line 51) | def mean_covar_numpy(xs): function frechet_distance (line 57) | def frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6): function compute_statistics_dataset (line 115) | def compute_statistics_dataset(dataset, function create_dataset_from_files (line 191) | def create_dataset_from_files(path, verbose=False): function compute_activations_from_dataset (line 222) | def compute_activations_from_dataset(dataset, function compute_statistics_from_files (line 247) | def compute_statistics_from_files(path, function compute_statistics_from_tensor (line 265) | def compute_statistics_from_tensor(tensor, function compute_rfid (line 283) | def compute_rfid(dataset, function compute_fid (line 299) | def compute_fid(fake_path, function compute_fid_without_store (line 331) | def compute_fid_without_store(tensor, ref_stat_path, batch_size=64, devi... FILE: LatentLM/metrics/inception.py class InceptionV3 (line 15) | class InceptionV3(nn.Module): method __init__ (line 30) | def __init__(self, method forward (line 133) | def forward(self, inp, return_logits=False): function _inception_v3 (line 176) | def _inception_v3(*args, **kwargs): function fid_inception_v3 (line 187) | def fid_inception_v3(): class FIDInceptionA (line 214) | class FIDInceptionA(torchvision.models.inception.InceptionA): method __init__ (line 216) | def __init__(self, in_channels, pool_features): method forward (line 219) | def forward(self, x): class FIDInceptionC (line 239) | class FIDInceptionC(torchvision.models.inception.InceptionC): method __init__ (line 241) | def __init__(self, in_channels, channels_7x7): method forward (line 244) | def forward(self, x): class FIDInceptionE_1 (line 267) | class FIDInceptionE_1(torchvision.models.inception.InceptionE): method __init__ (line 269) | def __init__(self, in_channels): method forward (line 272) | def forward(self, x): class FIDInceptionE_2 (line 300) | class FIDInceptionE_2(torchvision.models.inception.InceptionE): method __init__ (line 302) | def __init__(self, in_channels): method forward (line 305) | def forward(self, x): FILE: LatentLM/models/DiT.py function modulate (line 21) | def modulate(x, shift, scale): class TimestepEmbedder (line 29) | class TimestepEmbedder(nn.Module): method __init__ (line 33) | def __init__(self, hidden_size, frequency_embedding_size=256): method timestep_embedding (line 43) | def timestep_embedding(t, dim, max_period=10000): method forward (line 63) | def forward(self, t): class LabelEmbedder (line 69) | class LabelEmbedder(nn.Module): method __init__ (line 73) | def __init__(self, num_classes, hidden_size, dropout_prob): method token_drop (line 80) | def token_drop(self, labels, force_drop_ids=None): method forward (line 91) | def forward(self, labels, train, force_drop_ids=None): class SwiGLU (line 99) | class SwiGLU(nn.Module): method __init__ (line 100) | def __init__( method forward (line 113) | def forward(self, x): class Attention (line 126) | class Attention(nn.Module): method __init__ (line 127) | def __init__(self, dim, num_heads=8, num_kv_heads=8, qkv_bias=False, a... method forward (line 142) | def forward(self, x): class DiTBlock (line 157) | class DiTBlock(nn.Module): method __init__ (line 161) | def __init__(self, hidden_size, num_heads, num_kv_heads, mlp_ratio=4.0... method forward (line 173) | def forward(self, x, c): class FinalLayer (line 180) | class FinalLayer(nn.Module): method __init__ (line 184) | def __init__(self, hidden_size, output_size): method forward (line 193) | def forward(self, x, c): class DiT (line 200) | class DiT(nn.Module): method __init__ (line 204) | def __init__( method device (line 243) | def device(self): method dtype (line 247) | def dtype(self): method initialize_weights (line 250) | def initialize_weights(self): method unpatchify (line 282) | def unpatchify(self, x): method forward (line 297) | def forward(self, x_noise, t, y, **kwargs): method sample_with_cfg (line 315) | def sample_with_cfg(self, y, cfg_scale, sample_func): method forward_with_cfg (line 322) | def forward_with_cfg(self, x, t, y, cfg_scale): function get_2d_sincos_pos_embed (line 341) | def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False, extra... function get_1d_sincos_pos_embed (line 358) | def get_1d_sincos_pos_embed(embed_dim, seq_len, cls_token=False, extra_t... function get_2d_sincos_pos_embed_from_grid (line 370) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 381) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): function DiT_13B (line 406) | def DiT_13B(**kwargs): function DiT_7B (line 409) | def DiT_7B(**kwargs): function DiT_3B (line 412) | def DiT_3B(**kwargs): function DiT_XL (line 415) | def DiT_XL(**kwargs): function DiT_Large (line 418) | def DiT_Large(**kwargs): function DiT_Medium (line 421) | def DiT_Medium(**kwargs): function DiT_Base (line 424) | def DiT_Base(**kwargs): FILE: LatentLM/models/EMA.py class EMAModel (line 7) | class EMAModel: method __init__ (line 12) | def __init__( method get_decay (line 60) | def get_decay(self, optimization_step: int) -> float: method step (line 80) | def step(self, parameters: Iterable[torch.nn.Parameter]): method to (line 95) | def to(self, device=None, dtype=None) -> None: method state_dict (line 107) | def state_dict(self) -> dict: method load_state_dict (line 123) | def load_state_dict(self, state_dict: dict) -> None: FILE: LatentLM/models/RMSNorm.py class RMSNorm (line 4) | class RMSNorm(nn.Module): method __init__ (line 5) | def __init__(self, dim: int, eps: float = 1e-6, elementwise_affine=True): method _norm (line 15) | def _norm(self, x): method forward (line 18) | def forward(self, x): method extra_repr (line 24) | def extra_repr(self) -> str: FILE: LatentLM/models/Transformer.py function repeat_kv (line 27) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor: class Attention (line 38) | class Attention(nn.Module): method __init__ (line 39) | def __init__(self, dim, num_heads=8, num_kv_heads=8, qkv_bias=False, a... method forward (line 54) | def forward(self, x, start_pos, rel_pos, incremental_state=None): class Block (line 82) | class Block(nn.Module): method __init__ (line 83) | def __init__(self, hidden_size, num_heads, num_kv_heads, mlp_ratio=4.0... method forward (line 91) | def forward(self, x, start_pos, rel_pos, incremental_state=None): class MLPBlock (line 96) | class MLPBlock(nn.Module): method __init__ (line 97) | def __init__(self, hidden_size, mlp_ratio=4.0, drop=0.0, **block_kwar... method forward (line 107) | def forward(self, x, c): class ConditionLayer (line 112) | class ConditionLayer(nn.Module): method __init__ (line 113) | def __init__(self, hidden_size): method forward (line 118) | def forward(self, x): class Transformer (line 123) | class Transformer(nn.Module): method __init__ (line 124) | def __init__( method initialize_weights (line 172) | def initialize_weights(self): method device (line 197) | def device(self): method dtype (line 201) | def dtype(self): method unpatchify (line 204) | def unpatchify(self, x): method build_rel_pos (line 219) | def build_rel_pos(self, x, start_pos = 0): method forward (line 231) | def forward(self, x_noise, t, x_start, y, batch_mul=1): method forward_parallel (line 243) | def forward_parallel(self, x, y): method forward_recurrent (line 254) | def forward_recurrent(self, x, start_pos = 0, incremental_state = None): method forward_diffusion (line 269) | def forward_diffusion(self, x, t, condition): method sample_with_cfg (line 283) | def sample_with_cfg(self, prev_token, cfg_scale, sample_func): method forward_with_cfg (line 305) | def forward_with_cfg(self, x, t, condition, cfg_scale): function Transformer_13B (line 322) | def Transformer_13B(**kwargs): function Transformer_7B (line 325) | def Transformer_7B(**kwargs): function Transformer_3B (line 328) | def Transformer_3B(**kwargs): function Transformer_XL (line 331) | def Transformer_XL(**kwargs): function Transformer_Large (line 334) | def Transformer_Large(**kwargs): function Transformer_Medium (line 337) | def Transformer_Medium(**kwargs): function Transformer_Base (line 340) | def Transformer_Base(**kwargs): function Transformer_H (line 343) | def Transformer_H(**kwargs): function Transformer_L (line 346) | def Transformer_L(**kwargs): function Transformer_B (line 349) | def Transformer_B(**kwargs): FILE: LatentLM/models/kernel/rotary.py function rotary_kernel (line 21) | def rotary_kernel( function apply_rotary (line 144) | def apply_rotary( class ApplyRotaryEmb (line 242) | class ApplyRotaryEmb(torch.autograd.Function): method forward (line 244) | def forward( method backward (line 278) | def backward(ctx, do): function apply_rotary_emb (line 302) | def apply_rotary_emb( function rotate_every_two (line 334) | def rotate_every_two(x): function apply_rotary_pos_emb (line 340) | def apply_rotary_pos_emb(x, cos, sin, interleaved=False): FILE: LatentLM/models/kernel/swiglu.py class SwiGLUFunction (line 20) | class SwiGLUFunction(torch.autograd.Function): method forward (line 23) | def forward(ctx, x, y): method backward (line 28) | def backward(ctx, dout): FILE: LatentLM/sample_hf.py function parse_args (line 17) | def parse_args(): function main (line 92) | def main(args): FILE: LatentLM/sample_many.py function parse_args (line 25) | def parse_args(): function main (line 102) | def main(args): FILE: LatentLM/schedule/ddpm.py class DDPMSchedulerOutput (line 31) | class DDPMSchedulerOutput(BaseOutput): function betas_for_alpha_bar (line 48) | def betas_for_alpha_bar( function rescale_zero_terminal_snr (line 107) | def rescale_zero_terminal_snr(betas): class DDPMScheduler (line 143) | class DDPMScheduler(SchedulerMixin, ConfigMixin): method __init__ (line 195) | def __init__( method scale_model_input (line 252) | def scale_model_input(self, sample: torch.Tensor, timestep: Optional[i... method set_timesteps (line 269) | def set_timesteps( method _get_variance (line 344) | def _get_variance(self, t, predicted_variance=None, variance_type=None): method _threshold_sample (line 384) | def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor: method step (line 417) | def step( method add_noise (line 517) | def add_noise( method get_velocity (line 543) | def get_velocity(self, sample: torch.Tensor, noise: torch.Tensor, time... method __len__ (line 562) | def __len__(self): method previous_timestep (line 565) | def previous_timestep(self, timestep): FILE: LatentLM/schedule/dpm_solver.py class DPMSolverMultistepScheduler (line 31) | class DPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin): method __init__ (line 112) | def __init__( method step_index (line 207) | def step_index(self): method begin_index (line 214) | def begin_index(self): method set_begin_index (line 220) | def set_begin_index(self, begin_index: int = 0): method set_timesteps (line 230) | def set_timesteps( method _threshold_sample (line 335) | def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor: method _sigma_to_t (line 369) | def _sigma_to_t(self, sigma, log_sigmas): method _sigma_to_alpha_sigma_t (line 392) | def _sigma_to_alpha_sigma_t(self, sigma): method _convert_to_karras (line 399) | def _convert_to_karras(self, in_sigmas: torch.Tensor, num_inference_st... method _convert_to_lu (line 424) | def _convert_to_lu(self, in_lambdas: torch.Tensor, num_inference_steps... method convert_model_output (line 437) | def convert_model_output( method dpm_solver_first_order_update (line 536) | def dpm_solver_first_order_update( method multistep_dpm_solver_second_order_update (line 605) | def multistep_dpm_solver_second_order_update( method multistep_dpm_solver_third_order_update (line 728) | def multistep_dpm_solver_third_order_update( method index_for_timestep (line 813) | def index_for_timestep(self, timestep, schedule_timesteps=None): method _init_step_index (line 832) | def _init_step_index(self, timestep): method step (line 844) | def step( method add_noise (line 933) | def add_noise( method get_velocity (line 953) | def get_velocity(self, original_samples: torch.Tensor, noise: torch.Te... method __len__ (line 968) | def __len__(self): FILE: LatentLM/tokenizer_models/modeling_beit3_vision.py class BEiT3Vision (line 14) | class BEiT3Vision(nn.Module): method __init__ (line 15) | def __init__(self, args, **kwargs): method forward (line 38) | def forward( function beit3_base_vision (line 60) | def beit3_base_vision(image_size): FILE: LatentLM/tokenizer_models/modeling_common.py function trunc_normal_ (line 12) | def trunc_normal_(tensor, mean=0., std=1.): class EncoderDecoderArchForImageReconstrction (line 16) | class EncoderDecoderArchForImageReconstrction(nn.Module): method __init__ (line 20) | def __init__( method init_weights (line 38) | def init_weights(self): method _init_weights (line 46) | def _init_weights(self, m): method build_encoder (line 56) | def build_encoder(config): method build_decoder (line 66) | def build_decoder(config): method encode (line 70) | def encode(self, img): method decode (line 74) | def decode(self, quantize, **decoder_kwargs): function get_model_default_params (line 79) | def get_model_default_params( function get_basic_config (line 91) | def get_basic_config( FILE: LatentLM/tokenizer_models/modeling_sigma_vae.py class DecodeHeadBLC (line 9) | class DecodeHeadBLC(nn.Module): method __init__ (line 10) | def __init__(self, decoder_output_dim, patch_size, output_channels, pa... method forward (line 21) | def forward(self, x): class GaussianDistribution (line 38) | class GaussianDistribution(object): method __init__ (line 39) | def __init__(self, parameters, std): method sample (line 44) | def sample(self, sampling_std=None): method kl (line 59) | def kl(self): method mode (line 63) | def mode(self): class EncodeHeadBLC (line 67) | class EncodeHeadBLC(nn.Module): method __init__ (line 68) | def __init__(self, output_dim, latent_size, patches_shape, std): method forward (line 75) | def forward(self, x): class SigmaVAE (line 85) | class SigmaVAE(EncoderDecoderArchForImageReconstrction): method __init__ (line 87) | def __init__( function sigma_vae (line 124) | def sigma_vae(latent_size, std, **kwargs): FILE: LatentLM/tokenizer_models/modeling_utils.py function trunc_normal_ (line 9) | def trunc_normal_(tensor, mean=0., std=1.): class Attention (line 13) | class Attention(nn.Module): method __init__ (line 14) | def __init__( method forward (line 38) | def forward(self, x, is_causal=False, attn_mask=None): class Block (line 59) | class Block(nn.Module): method __init__ (line 61) | def __init__( method forward (line 86) | def forward(self, x, attn_mask=None, is_causal=False): class VisionTransformer (line 91) | class VisionTransformer(nn.Module): method __init__ (line 94) | def __init__( method fix_init_weight (line 132) | def fix_init_weight(self): method _init_weights (line 140) | def _init_weights(self, m): method forward_features (line 149) | def forward_features(self, x, return_patch_tokens=False, **kwargs): method forward (line 169) | def forward(self, x, **kwargs): FILE: LatentLM/tokenizer_models/vae.py function nonlinearity (line 8) | def nonlinearity(x): function Normalize (line 13) | def Normalize(in_channels, num_groups=32): class Upsample (line 19) | class Upsample(nn.Module): method __init__ (line 20) | def __init__(self, in_channels, with_conv): method forward (line 28) | def forward(self, x): class Downsample (line 35) | class Downsample(nn.Module): method __init__ (line 36) | def __init__(self, in_channels, with_conv): method forward (line 45) | def forward(self, x): class ResnetBlock (line 55) | class ResnetBlock(nn.Module): method __init__ (line 56) | def __init__( method forward (line 92) | def forward(self, x, temb): class AttnBlock (line 115) | class AttnBlock(nn.Module): method __init__ (line 116) | def __init__(self, in_channels): method forward (line 134) | def forward(self, x): class Encoder (line 161) | class Encoder(nn.Module): method __init__ (line 162) | def __init__( method forward (line 245) | def forward(self, x): class Decoder (line 275) | class Decoder(nn.Module): method __init__ (line 276) | def __init__( method forward (line 365) | def forward(self, z): class DiagonalGaussianDistribution (line 399) | class DiagonalGaussianDistribution(object): method __init__ (line 400) | def __init__(self, parameters, deterministic=False): method sample (line 412) | def sample(self): method kl (line 418) | def kl(self, other=None): method nll (line 437) | def nll(self, sample, dims=[1, 2, 3]): method mode (line 446) | def mode(self): class AutoencoderKL (line 450) | class AutoencoderKL(nn.Module): method __init__ (line 451) | def __init__(self, embed_dim, ch_mult, use_variational=True, ckpt_path... method init_from_ckpt (line 463) | def init_from_ckpt(self, path): method encode (line 473) | def encode(self, x): method decode (line 481) | def decode(self, z): method forward (line 486) | def forward(self, inputs, disable=True, train=True, optimizer_idx=0): FILE: LatentLM/train_hf.py function parse_args (line 34) | def parse_args(): function main (line 106) | def main(args): FILE: LatentLM/utils.py function update_ema (line 18) | def update_ema(ema_model, model, decay=0.9999): function requires_grad (line 30) | def requires_grad(model, flag=True): function cleanup (line 38) | def cleanup(): function create_logger (line 45) | def create_logger(logging_dir): function center_crop_arr (line 62) | def center_crop_arr(pil_image, image_size): function download_pretrained_vae (line 82) | def download_pretrained_vae(overwrite=False): function safe_blob_write (line 93) | def safe_blob_write(fn, text): function safe_blob_dump (line 102) | def safe_blob_dump(fn, result): function load_vae (line 111) | def load_vae(vae_model_path, image_size): FILE: PFPO/data/apps.py class APPsReader (line 12) | class APPsReader: method __init__ (line 13) | def __init__(self, split: str = "train", train_sub_split: str = ""): method __call__ (line 18) | def __call__(self, file_path): class APPsWithFunctionName (line 51) | class APPsWithFunctionName: method __init__ (line 52) | def __init__(self, split: str = "train", train_sub_split: str = "", us... method __call__ (line 58) | def __call__(self, file_path): class APPsFlatTestCasesReader (line 98) | class APPsFlatTestCasesReader(APPsWithFunctionName): method __call__ (line 99) | def __call__(self, file_path): class PseudoInputsWithFunctionName (line 112) | class PseudoInputsWithFunctionName: method __init__ (line 113) | def __init__(self, use_starter_code: bool = False, train_sub_split: st... method __call__ (line 118) | def __call__(self, file_path): class PseudoInputsWithFunctionNameFixStarterCode (line 156) | class PseudoInputsWithFunctionNameFixStarterCode: method __init__ (line 157) | def __init__(self, use_starter_code: bool = False, train_sub_split: st... method __call__ (line 162) | def __call__(self, file_path): FILE: PFPO/data/code_contest.py class CodeContestReader (line 8) | class CodeContestReader: method __call__ (line 9) | def __call__(self, file_path): class CodeContestFlatReader (line 43) | class CodeContestFlatReader: method __call__ (line 44) | def __call__(self, file_path): FILE: PFPO/data/combine_dataset.py class ResponseAlignDataset (line 19) | class ResponseAlignDataset(Dataset): method __init__ (line 20) | def __init__(self, method __len__ (line 91) | def __len__(self): method api_getitem (line 96) | def api_getitem(self, index): method service_getitem (line 113) | def service_getitem(self, index): method __getitem__ (line 119) | def __getitem__(self, idx): class PromptResponseDataset (line 139) | class PromptResponseDataset(Dataset): method __init__ (line 140) | def __init__(self, method __len__ (line 197) | def __len__(self): method api_getitem (line 202) | def api_getitem(self, index): method service_getitem (line 205) | def service_getitem(self, index): method __getitem__ (line 208) | def __getitem__(self, idx): class MultiMappingDataset (line 231) | class MultiMappingDataset(Dataset): method __init__ (line 232) | def __init__(self, method __len__ (line 289) | def __len__(self): method api_getitem (line 294) | def api_getitem(self, index): method service_getitem (line 297) | def service_getitem(self, index): method __getitem__ (line 300) | def __getitem__(self, idx): class MultiMappingDatasetGrouping (line 329) | class MultiMappingDatasetGrouping(MultiMappingDataset): method __init__ (line 330) | def __init__(self, class ReplayDataset (line 375) | class ReplayDataset(Dataset): method __init__ (line 376) | def __init__(self, file_path: str, tokenizer: PreTrainedTokenizer, new... method __len__ (line 385) | def __len__(self): method __getitem__ (line 388) | def __getitem__(self, index): FILE: PFPO/data/deepseek_math_utils/answer_extraction.py function _fix_fracs (line 6) | def _fix_fracs(string): function _fix_a_slash_b (line 38) | def _fix_a_slash_b(string): function _fix_sqrt (line 55) | def _fix_sqrt(string): function _fix_tan (line 61) | def _fix_tan(string): function strip_string (line 67) | def strip_string(string): function extract_boxed_answers (line 180) | def extract_boxed_answers(text): function extract_program_output (line 198) | def extract_program_output(pred_str): function extract_answer (line 212) | def extract_answer(pred_str, exhaust=False): function extract_math_answer (line 251) | def extract_math_answer(question, reasoning, task): function extract_math_few_shot_cot_answer (line 263) | def extract_math_few_shot_cot_answer(question, reasoning, task): function extract_last_single_answer (line 269) | def extract_last_single_answer(question, reasoning, task): function extract_gsm_few_shot_cot_answer (line 273) | def extract_gsm_few_shot_cot_answer(question, reasoning, task): function extract_agieval_gaokao_mathcloze_few_shot_cot_test (line 283) | def extract_agieval_gaokao_mathcloze_few_shot_cot_test(question, reasoni... function extract_agieval_gaokao_mathqa_few_shot_cot_test (line 295) | def extract_agieval_gaokao_mathqa_few_shot_cot_test(question, reasoning,... function extract_sat_few_shot_answer (line 306) | def extract_sat_few_shot_answer(question, reasoning, task): function extract_ocwcourses_few_shot_answer (line 315) | def extract_ocwcourses_few_shot_answer(question, reasoning, task): function extract_mmlu_stem (line 327) | def extract_mmlu_stem(question, reasoning, task): function extract_minif2f_isabelle (line 333) | def extract_minif2f_isabelle(question, reasoning, task): function extract_cmath_few_shot_test (line 339) | def extract_cmath_few_shot_test(question, reasoning, task): FILE: PFPO/data/deepseek_math_utils/eval_script.py function is_correct (line 7) | def is_correct(item, pred_key='prediction', prec=1e-3): function eval_math (line 48) | def eval_math(item, pred_key='prediction', prec=1e-3): function eval_last_single_answer (line 75) | def eval_last_single_answer(item, pred_key='prediction', prec=1e-3): function eval_agieval_gaokao_math_cloze (line 81) | def eval_agieval_gaokao_math_cloze(item, pred_key='prediction', prec=1e-3): function eval_agieval_gaokao_mathqa (line 117) | def eval_agieval_gaokao_mathqa(item, pred_key='prediction', prec=1e-3): function eval_math_sat (line 131) | def eval_math_sat(item, pred_key='prediction', prec=1e-3): function eval_mmlu_stem (line 137) | def eval_mmlu_stem(item, pred_key='prediction', prec=1e-3): function eval_ocwcourses (line 141) | def eval_ocwcourses(item, pred_key='prediction', prec=1e-3): function eval_minif2f_isabelle (line 180) | def eval_minif2f_isabelle(item, pred_key='prediction', prec=1e-3): FILE: PFPO/data/deepseek_math_utils/eval_utils.py function extract_program (line 15) | def extract_program(result: str, last_only=True): function parse_ground_truth (line 35) | def parse_ground_truth(example: Dict[str, Any], data_name): function parse_question (line 76) | def parse_question(example, data_name): function run_execute (line 100) | def run_execute(executor, result, prompt_type, execute=False): function parse_digits (line 117) | def parse_digits(num): function is_digit (line 134) | def is_digit(num): function normalize_prediction (line 139) | def normalize_prediction(prediction): function math_equal (line 183) | def math_equal(prediction: Union[bool, float, str], function math_equal_process (line 283) | def math_equal_process(param): function symbolic_equal (line 287) | def symbolic_equal(a, b): function symbolic_equal_process (line 313) | def symbolic_equal_process(a, b, output_queue): function call_with_timeout (line 318) | def call_with_timeout(func, *args, timeout=1, **kwargs): FILE: PFPO/data/deepseek_math_utils/ocwcourses_eval_utils.py class timeout (line 12) | class timeout: method __init__ (line 13) | def __init__(self, seconds=1, error_message="Timeout"): method handle_timeout (line 17) | def handle_timeout(self, signum, frame): method __enter__ (line 20) | def __enter__(self): method __exit__ (line 24) | def __exit__(self, type, value, traceback): function normalize_numeric (line 28) | def normalize_numeric(s): function numeric_equality (line 72) | def numeric_equality(n1, n2, threshold=0.01): function normalize_symbolic_equation (line 81) | def normalize_symbolic_equation(s): class SymbolicMathMixin (line 104) | class SymbolicMathMixin: method normalize_tex (line 166) | def normalize_tex(self, final_answer: str) -> str: method parse_tex (line 204) | def parse_tex(self, text: str, time_limit: int = 5) -> sympy.Basic: method is_exp_equiv (line 222) | def is_exp_equiv(self, x1: sympy.Basic, x2: sympy.Basic, time_limit=5)... method is_tex_equiv (line 251) | def is_tex_equiv(self, x1: str, x2: str, time_limit=5) -> bool: FILE: PFPO/data/general_collator.py class DPOCollator (line 21) | class DPOCollator: method __init__ (line 22) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int... method __call__ (line 27) | def __call__(self, batch): class DPODataSFTCollator (line 75) | class DPODataSFTCollator: method __init__ (line 80) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int): method __call__ (line 84) | def __call__(self, batch): class DPOCollatorWithExtraInputs (line 120) | class DPOCollatorWithExtraInputs: method __init__ (line 121) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int... method __call__ (line 127) | def __call__(self, batch): class Trajectory2ValueCollator (line 181) | class Trajectory2ValueCollator: method __init__ (line 182) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int): method __call__ (line 186) | def __call__(self, batch): class StepEndingsCollator (line 223) | class StepEndingsCollator: method __init__ (line 224) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int): method __call__ (line 228) | def __call__(self, batch): function iterative_mask (line 274) | def iterative_mask(text_segment_list: List[List[str]], masks: List[int],... class SFTFoldAttnMaskCollator (line 306) | class SFTFoldAttnMaskCollator: method __init__ (line 307) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int... method __call__ (line 313) | def __call__(self, batch): class TextPromptCollator (line 353) | class TextPromptCollator: method __init__ (line 354) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int... method __call__ (line 363) | def __call__(self, batch): FILE: PFPO/data/human_eval.py class HumanEvalReader (line 12) | class HumanEvalReader: method __call__ (line 13) | def __call__(self, file_path: str = "openai_humaneval"): class MBPPReader (line 20) | class MBPPReader: method __init__ (line 21) | def __init__(self, sanitized: bool = True): method __call__ (line 24) | def __call__(self, file_path: str = "mbpp"): class MBPPReaderFixed (line 36) | class MBPPReaderFixed: method __init__ (line 37) | def __init__(self, sanitized: bool = True): method __call__ (line 40) | def __call__(self, file_path: str = "mbpp"): FILE: PFPO/data/input_aligner.py function _format_option_list (line 18) | def _format_option_list(option_list: List[str], _rank2option: List[str])... function option_id2str_aligner (line 25) | def option_id2str_aligner(): function key_based_filter_aligner (line 36) | def key_based_filter_aligner(key, value): function dpo_confidence_ratio_filter (line 48) | def dpo_confidence_ratio_filter(lower_bound: float, upper_bound: float, ... function filter_aligner (line 60) | def filter_aligner(filter_func: Callable): function json_field2str (line 67) | def json_field2str(key, val: str = None, indent: int = 4): function starts_with_filter (line 79) | def starts_with_filter(key, value): function not_none_filter (line 86) | def not_none_filter(key): function rename_field_aligner (line 93) | def rename_field_aligner(kv_pair: Dict): function field_extract_aligner (line 104) | def field_extract_aligner(input_index_field: str, extract_index_field: s... function flat_aligner (line 147) | def flat_aligner(input_index_field: str, extract_field: Union[str, List[... function option_flatten_aligner (line 191) | def option_flatten_aligner(): function empty_aligner (line 200) | def empty_aligner(data: List[Dict]): function add_id_aligner (line 204) | def add_id_aligner(id_field: str = "id"): function concat_aligner (line 213) | def concat_aligner(aligners: List[Callable]): function dpo_pair_aligner_cleaned (line 222) | def dpo_pair_aligner_cleaned(response_field: str = "response", function dpo_pair_aligner (line 280) | def dpo_pair_aligner(pos_field: Union[str, ListConfig], neg_field: Union... function eval_multiple_choice (line 320) | def eval_multiple_choice(item): function prompt_fill_aligner (line 341) | def prompt_fill_aligner(prompt_file: str, mapping: Dict[str, str], promp... function value2pair_aligner (line 356) | def value2pair_aligner(field: str, pos_field: str, neg_field: str, value... function return_threshold_mapping (line 377) | def return_threshold_mapping(value_threshold: float): function return_binary_mapping (line 386) | def return_binary_mapping(): function value_mapping_aligner (line 395) | def value_mapping_aligner(value_field: str, value_mapping_func: Callable... function dpo_pair2value_aligner (line 407) | def dpo_pair2value_aligner(pos_field: str, neg_field: str, seq_field: st... function value2pair_mapping_aligner (line 434) | def value2pair_mapping_aligner(field: str, pos_field: str, neg_field: st... function dpo_random_choice_aligner (line 455) | def dpo_random_choice_aligner(anchor_field: str, paired_field: str): function dpo_flat_random_choice_aligner (line 473) | def dpo_flat_random_choice_aligner(paired_field: str): function dpo_paired_random_choice_aligner (line 487) | def dpo_paired_random_choice_aligner(anchor_field: str, paired_field, so... function sample_steps (line 537) | def sample_steps(response: str): function _sort_worker (line 543) | def _sort_worker(item, _pos_field: str, _neg_field: str, _top_k: int = 5): function dpo_bi_random_choice_aligner (line 553) | def dpo_bi_random_choice_aligner(pos_field: str, neg_field: str, sort_ac... FILE: PFPO/data/input_utils.py function read_text (line 7) | def read_text(file_path: str): function json_read_fn (line 11) | def json_read_fn(file_path: str): function hf_datasets_load_fn (line 15) | def hf_datasets_load_fn(**kwargs): function jsonl_read_fn (line 22) | def jsonl_read_fn(): function compose_message (line 29) | def compose_message(system_prompt: str = ""): function recompose_template (line 41) | def recompose_template(units: Dict[str, str], compositions: Dict[str, st... function compose_template (line 48) | def compose_template(units: Dict[str, str], composition: str) -> str: FILE: PFPO/data/math.py function is_number (line 19) | def is_number(s): function extract_answer_number (line 34) | def extract_answer_number(completion, separator: str = "The answer is: "): function gsk8k_answer_cleaner (line 63) | def gsk8k_answer_cleaner(separator: str = "The answer is: "): function number_answer_extractor (line 73) | def number_answer_extractor(separator: str = "The answer is: ", completi... function gsm8k_gold_answer_extractor (line 86) | def gsm8k_gold_answer_extractor(response_field: str = "response"): function remove_boxed (line 99) | def remove_boxed(s): function math_gold_answer_extractor (line 109) | def math_gold_answer_extractor(response_field: str = "output", kv_mappin... function math_boxed_answer_cleaner (line 123) | def math_boxed_answer_cleaner(): function math_boxed_answer_cleaner_proxy (line 130) | def math_boxed_answer_cleaner_proxy(): function math_gold_answer_extractor_deepseek (line 137) | def math_gold_answer_extractor_deepseek(query_field: str = "instruction"... function gsm8k_gold_answer_extractor_deepseek (line 151) | def gsm8k_gold_answer_extractor_deepseek(query_field: str = "instruction... function process_results (line 166) | def process_results(doc, completion, answer): function math_answer_cleaner (line 187) | def math_answer_cleaner(separator: str = "The answer is: "): function meta_math_gold_answer_extractor (line 213) | def meta_math_gold_answer_extractor(response_field: str = "response"): function decompose_rap (line 233) | def decompose_rap(prompt: str, response: str, max_seq_length: int, token... function decompose_cot (line 259) | def decompose_cot(prompt: str, response: str, max_seq_length: int, token... function decompose_deepseek_math_cot_v2 (line 276) | def decompose_deepseek_math_cot_v2(prompt: str, response: str, max_seq_l... class RAPResponseStepRewardCollator (line 312) | class RAPResponseStepRewardCollator: method __init__ (line 318) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int... method __call__ (line 323) | def __call__(self, batch): FILE: PFPO/data/math_reader.py class MetaMathReaderHF (line 6) | class MetaMathReaderHF: method __init__ (line 7) | def __init__(self, category: str): method __call__ (line 10) | def __call__(self, file_path: str = "meta-math/MetaMathQA"): class MetaMathReader (line 25) | class MetaMathReader: method __init__ (line 26) | def __init__(self, category: str = "math"): method __call__ (line 29) | def __call__(self, file_path: str = "meta-math/MetaMathQA"): FILE: PFPO/data/math_util.py function last_boxed_only (line 6) | def last_boxed_only(sample): function last_boxed_only_string (line 14) | def last_boxed_only_string(string): function only_until_first_boxed_from_tokens (line 42) | def only_until_first_boxed_from_tokens(string, tokens): function clean_numbers (line 58) | def clean_numbers(sample): function _clean_numbers (line 68) | def _clean_numbers(string): function fix_fracs (line 101) | def fix_fracs(string): function fix_a_slash_b (line 133) | def fix_a_slash_b(string): function remove_right_units (line 148) | def remove_right_units(string): function fix_sqrt (line 158) | def fix_sqrt(string): function strip_string (line 173) | def strip_string(string): function is_equiv (line 238) | def is_equiv(str1, str2, verbose=False): class NotEqual (line 256) | class NotEqual: method __eq__ (line 257) | def __eq__(self, other): FILE: PFPO/data/mathscale/util.py function fix_fracs (line 8) | def fix_fracs(string): function fix_a_slash_b (line 40) | def fix_a_slash_b(string): function remove_right_units (line 55) | def remove_right_units(string): function fix_sqrt (line 65) | def fix_sqrt(string): function is_number (line 80) | def is_number(s): function unbox_and_extract (line 96) | def unbox_and_extract(text): function convert_to_latex_fraction (line 115) | def convert_to_latex_fraction(text: str) -> str: function strip_string (line 131) | def strip_string(string): function is_single_inline_math (line 204) | def is_single_inline_math(expression: str) -> bool: function mathscale_is_equiv (line 214) | def mathscale_is_equiv(prediction_ans, reference_ans, verbose=False): function mathscale_is_equiv_proxy (line 250) | def mathscale_is_equiv_proxy(prediction_ans, reference_ans, verbose=False): function is_correct (line 254) | def is_correct(completion, answer, verbose=False): function mathscale_extract_answer (line 315) | def mathscale_extract_answer(): function mathscale_extract_answer_fn_v2_list (line 370) | def mathscale_extract_answer_fn_v2_list(separator: str = "The answer is:... function mathscale_extract_answer_v2 (line 387) | def mathscale_extract_answer_v2(completion: str): function mathscale_extract_answer_v3 (line 444) | def mathscale_extract_answer_v3(completion: str): function mathscale_extract_answer_fn_v3 (line 506) | def mathscale_extract_answer_fn_v3(completion_field: str = "response"): function mathscale_extract_answer_fn_v4 (line 519) | def mathscale_extract_answer_fn_v4(completion_field: str = "response"): function extract_pure_prompt_aligner (line 532) | def extract_pure_prompt_aligner(): FILE: PFPO/data/numina_math.py class NuminaMathReader (line 10) | class NuminaMathReader: method __init__ (line 11) | def __init__(self, id_field: str = "id", split: str = "train"): method __call__ (line 15) | def __call__(self, file_path): FILE: PFPO/data/openai_api_caller.py class GPTAPIInterface (line 13) | class GPTAPIInterface: method __init__ (line 14) | def __init__(self, model: str, max_tokens: int, api_time_interval: int... method __call__ (line 29) | def __call__(self, text: str): class GPTTurbo (line 33) | class GPTTurbo(GPTAPIInterface): method __init__ (line 34) | def __init__(self, method __call__ (line 53) | def __call__(self, text: Union[str, List[str]]): class AzureGPTEndpoint (line 109) | class AzureGPTEndpoint: method __init__ (line 110) | def __init__(self, method __call__ (line 146) | def __call__(self, text: Union[str, List[str]]): FILE: PFPO/data/qwen25math/data_loader.py function load_data (line 9) | def load_data(data_name, split, data_dir="./data"): FILE: PFPO/data/qwen25math/evaluate.py function evaluate (line 14) | def evaluate(data_name, prompt_type, samples: list=None, file_path: str=... function parse_args (line 96) | def parse_args(): FILE: PFPO/data/qwen25math/examples.py function get_examples (line 4) | def get_examples(): FILE: PFPO/data/qwen25math/grader.py function choice_answer_clean (line 25) | def choice_answer_clean(pred: str): function parse_digits (line 39) | def parse_digits(num): function is_digit (line 55) | def is_digit(num): function str_to_pmatrix (line 60) | def str_to_pmatrix(input_str): function math_equal (line 73) | def math_equal( function math_equal_process (line 262) | def math_equal_process(param): function numeric_equal (line 266) | def numeric_equal(prediction: float, reference: float): function symbolic_equal (line 276) | def symbolic_equal(a, b): function symbolic_equal_process (line 332) | def symbolic_equal_process(a, b, output_queue): function call_with_timeout (line 337) | def call_with_timeout(func, *args, timeout=1, **kwargs): function _test_math_equal (line 351) | def _test_math_equal(): FILE: PFPO/data/qwen25math/math_eval.py function parse_args (line 21) | def parse_args(): function prepare_data (line 61) | def prepare_data(data_name, args): function setup (line 108) | def setup(args): function is_multi_choice (line 151) | def is_multi_choice(answer): function main (line 158) | def main(llm, tokenizer, data_name, args): FILE: PFPO/data/qwen25math/math_utils.py function compare_numerical_ans (line 29) | def compare_numerical_ans(ans_p, ans_l): function my_parse_latex (line 46) | def my_parse_latex(expr_str): function is_number (line 55) | def is_number(element: str) -> bool: function percentage_to_fraction (line 63) | def percentage_to_fraction(text): function clean_expr_str (line 74) | def clean_expr_str(expr_str): function parse_latex_answer (line 116) | def parse_latex_answer(sample): function my_equals (line 129) | def my_equals(ans_p, ans_l): function is_expr_equal (line 133) | def is_expr_equal(ans_p, ans_l, is_strict=False): function extract_answer_number (line 201) | def extract_answer_number(sentence: str) -> float: function compare_ans (line 210) | def compare_ans(ans_p_str, ans_l_str, is_strict=False): function vote (line 236) | def vote(answers): function contains_number (line 241) | def contains_number(s): function rough_compare_ans (line 245) | def rough_compare_ans(generation, answer): FILE: PFPO/data/qwen25math/model_utils.py class KeywordsStoppingCriteria (line 9) | class KeywordsStoppingCriteria(StoppingCriteria): method __init__ (line 10) | def __init__(self, keywords_str, tokenizer): method __call__ (line 15) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class KeyWordsCriteriaTrunc (line 34) | class KeyWordsCriteriaTrunc(StoppingCriteria): method __init__ (line 35) | def __init__(self, stop_id_sequences, prompt_length): method __call__ (line 40) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... class KeyWordsCriteria (line 60) | class KeyWordsCriteria(StoppingCriteria): method __init__ (line 61) | def __init__(self, stop_id_sequences): method __call__ (line 65) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... function generate_completions (line 78) | def generate_completions(model, tokenizer, prompts, batch_size=1, stop_i... function load_hf_lm_and_tokenizer (line 140) | def load_hf_lm_and_tokenizer( function _test_generate_completions (line 203) | def _test_generate_completions(): FILE: PFPO/data/qwen25math/parser.py function _fix_fracs (line 11) | def _fix_fracs(string): function _fix_a_slash_b (line 43) | def _fix_a_slash_b(string): function _fix_sqrt (line 60) | def _fix_sqrt(string): function convert_word_number (line 65) | def convert_word_number(text: str) -> str: function strip_string (line 212) | def strip_string(string, skip_unit=False): function extract_multi_choice_answer (line 353) | def extract_multi_choice_answer(pred_str): function choice_answer_clean (line 367) | def choice_answer_clean(pred: str): function find_box (line 411) | def find_box(pred_str: str): function clean_units (line 434) | def clean_units(pred_str: str): function extract_theoremqa_answer (line 459) | def extract_theoremqa_answer(pred: str, answer_flag: bool = True): function extract_answer (line 499) | def extract_answer(pred_str, data_name, use_last_number=True): function parse_ground_truth (line 575) | def parse_ground_truth(example: Dict[str, Any], data_name): function parse_question (line 654) | def parse_question(example, data_name): function run_execute (line 722) | def run_execute(executor, result, prompt_type, data_name, execute=False): function _test_extract_answer (line 740) | def _test_extract_answer(): FILE: PFPO/data/qwen25math/python_executor.py class GenericRuntime (line 20) | class GenericRuntime: method __init__ (line 24) | def __init__(self): method exec_code (line 31) | def exec_code(self, code_piece: str) -> None: method eval_code (line 48) | def eval_code(self, expr: str) -> Any: method inject (line 51) | def inject(self, var_dict: Dict[str, Any]) -> None: method answer (line 56) | def answer(self): class DateRuntime (line 59) | class DateRuntime(GenericRuntime): class CustomDict (line 67) | class CustomDict(dict): method __iter__ (line 68) | def __iter__(self): class ColorObjectRuntime (line 71) | class ColorObjectRuntime(GenericRuntime): class PythonExecutor (line 75) | class PythonExecutor: method __init__ (line 76) | def __init__( method process_generation_to_code (line 91) | def process_generation_to_code(self, gens: str): method execute (line 95) | def execute( method apply (line 140) | def apply(self, code): method truncate (line 144) | def truncate(s, max_length=400): method batch_apply (line 150) | def batch_apply(self, batch_code): function _test (line 202) | def _test(): FILE: PFPO/data/qwen25math/trajectory.py function text_to_trajectory (line 13) | def text_to_trajectory(traj_str: str) -> None: function trajectory_to_text (line 51) | def trajectory_to_text(trajectory: list) -> str: function is_execution_success (line 63) | def is_execution_success(output): function extract_program (line 69) | def extract_program(text:str=None, trajectory:list=None, last_only=False... function extract_program_output (line 109) | def extract_program_output(pred_str, last_only=True): function _test_str_to_trajectory (line 120) | def _test_str_to_trajectory(): FILE: PFPO/data/qwen25math/utils.py function set_seed (line 13) | def set_seed(seed: int = 42) -> None: function load_jsonl (line 20) | def load_jsonl(file: Union[str, Path]) -> Iterable[Any]: function save_jsonl (line 30) | def save_jsonl(samples, save_path): function lower_keys (line 41) | def lower_keys(example): function load_prompt (line 55) | def load_prompt(data_name, prompt_type, num_shots): function construct_prompt (line 168) | def construct_prompt(example, data_name, args): function show_sample (line 251) | def show_sample(sample, print_all_preds=False): FILE: PFPO/data/vllm.py function post_http_request (line 11) | def post_http_request(api_url: str, function get_streaming_response (line 40) | def get_streaming_response(response: requests.Response) -> Iterable[List... function get_response (line 50) | def get_response(response: requests.Response) -> Tuple[str, str]: class VLLMRequestGenerator (line 56) | class VLLMRequestGenerator: method __init__ (line 57) | def __init__(self, api_url: str, n: int = 1, max_tokens: int = 1024, u... method __call__ (line 70) | def __call__(self, prompt: str) -> str: FILE: PFPO/eval/codex_humaneval/data.py function read_problems (line 10) | def read_problems(evalset_file: str = HUMAN_EVAL) -> Dict[str, Dict]: function stream_jsonl (line 14) | def stream_jsonl(filename: str) -> Iterable[Dict]: function write_jsonl (line 31) | def write_jsonl(filename: str, data: Iterable[Dict], append: bool = False): FILE: PFPO/eval/codex_humaneval/evaluation.py function estimate_pass_at_k (line 13) | def estimate_pass_at_k( function evaluate_functional_correctness (line 39) | def evaluate_functional_correctness( FILE: PFPO/eval/codex_humaneval/execution.py function check_correctness (line 13) | def check_correctness(problem: Dict, completion: str, timeout: float, co... function time_limit (line 90) | def time_limit(seconds: float): function swallow_io (line 103) | def swallow_io(): function create_tempdir (line 112) | def create_tempdir(): class TimeoutException (line 118) | class TimeoutException(Exception): class WriteOnlyStringIO (line 122) | class WriteOnlyStringIO(io.StringIO): method read (line 125) | def read(self, *args, **kwargs): method readline (line 128) | def readline(self, *args, **kwargs): method readlines (line 131) | def readlines(self, *args, **kwargs): method readable (line 134) | def readable(self, *args, **kwargs): class redirect_stdin (line 139) | class redirect_stdin(contextlib._RedirectStream): # type: ignore function chdir (line 144) | def chdir(root): function reliability_guard (line 158) | def reliability_guard(maximum_memory_bytes: Optional[int] = None): FILE: PFPO/eval/codex_humaneval/run_eval.py function main (line 17) | def main(args): FILE: PFPO/eval/dispatch_openai_requests.py function dispatch_openai_chat_requests (line 12) | async def dispatch_openai_chat_requests( function dispatch_openai_prompt_requests (line 37) | async def dispatch_openai_prompt_requests( FILE: PFPO/eval/mbpp_eval/execute.py function check_correctness (line 28) | def check_correctness(check_program, timeout, task_id, completion_id): function unsafe_execute (line 56) | def unsafe_execute(check_program, result, timeout): function time_limit (line 90) | def time_limit(seconds): function swallow_io (line 103) | def swallow_io(): function create_tempdir (line 112) | def create_tempdir(): class TimeoutException (line 118) | class TimeoutException(Exception): class WriteOnlyStringIO (line 122) | class WriteOnlyStringIO(io.StringIO): method read (line 125) | def read(self, *args, **kwargs): method readline (line 128) | def readline(self, *args, **kwargs): method readlines (line 131) | def readlines(self, *args, **kwargs): method readable (line 134) | def readable(self, *args, **kwargs): class redirect_stdin (line 139) | class redirect_stdin(contextlib._RedirectStream): # type: ignore function chdir (line 144) | def chdir(root): function reliability_guard (line 158) | def reliability_guard(maximum_memory_bytes=None): FILE: PFPO/eval/mbpp_eval/run_eval.py function get_fewshot (line 11) | def get_fewshot(): function remove_extra_symbols (line 62) | def remove_extra_symbols(code): function extract_code (line 79) | def extract_code(raw_completions): function main (line 110) | def main(): FILE: PFPO/eval/mbpp_eval/utils.py function compute_code_eval (line 127) | def compute_code_eval(predictions, references, k=[1, 10, 100], num_worke... function estimate_pass_at_k (line 172) | def estimate_pass_at_k(num_samples, num_correct, k): FILE: PFPO/eval/utils.py class KeyWordsCriteria (line 12) | class KeyWordsCriteria(StoppingCriteria): method __init__ (line 13) | def __init__(self, stop_id_sequences): method __call__ (line 17) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen... function generate_completions (line 30) | def generate_completions(model, tokenizer, prompts, batch_size=1, stop_i... function get_next_word_predictions (line 99) | def get_next_word_predictions(model, tokenizer, prompts, candidate_token... function score_completions (line 139) | def score_completions(model, tokenizer, scoring_examples, batch_size=1, ... function load_hf_lm_and_tokenizer (line 213) | def load_hf_lm_and_tokenizer( function query_openai_chat_model (line 272) | def query_openai_chat_model(engine, instances, output_path=None, batch_s... function query_openai_model (line 339) | def query_openai_model(engine, instances, output_path=None, batch_size=1... function dynamic_import_function (line 406) | def dynamic_import_function(function_path): function get_multichoice_predictions (line 417) | def get_multichoice_predictions(model, tokenizer, prompts, prompt_starts... FILE: PFPO/general_util/average_meter.py class AverageMeter (line 7) | class AverageMeter(object): method __init__ (line 10) | def __init__(self): method reset (line 16) | def reset(self): method update (line 22) | def update(self, val, n=1): method save (line 36) | def save(self): method load (line 44) | def load(self, value: dict): method gather (line 52) | def gather(self, device): class LogMetric (line 68) | class LogMetric(object): method __init__ (line 73) | def __init__(self, *metric_names): method update (line 79) | def update(self, metric_name, val, n=1): method reset (line 83) | def reset(self, metric_name=None): method get_log (line 91) | def get_log(self): FILE: PFPO/general_util/dist_utils.py function vanilla_torch_dist (line 19) | def vanilla_torch_dist(cfg: DictConfig, backend="nccl"): function setup_slurm_distributed (line 35) | def setup_slurm_distributed(cfg: DictConfig, backend="nccl", port=None): function print_rank_0 (line 89) | def print_rank_0(msg, rank=0): function print_all_ranks (line 94) | def print_all_ranks(tag, value, rank): function get_pipeline_parallel_world_size (line 102) | def get_pipeline_parallel_world_size() -> int: function get_pipeline_parallel_rank (line 107) | def get_pipeline_parallel_rank() -> int: function prepare_distributed_sampler (line 112) | def prepare_distributed_sampler(dataset: torch.utils.data.Dataset, rando... FILE: PFPO/general_util/evaluator.py function evaluate (line 21) | def evaluate(cfg: DictConfig, model: torch.nn.Module, tokenizer: PreTrai... function build_dataloader (line 140) | def build_dataloader(dataset, cfg): function retriever_inference_fn (line 159) | def retriever_inference_fn(cfg: DictConfig, model: torch.nn.Module, toke... class DefaultForwardFn (line 279) | class DefaultForwardFn: method __init__ (line 280) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:... method __call__ (line 285) | def __call__(self, batch): class DiscriminatorForwardFn (line 290) | class DiscriminatorForwardFn: method __init__ (line 291) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:... method __call__ (line 296) | def __call__(self, batch): class AutoRegressiveDiscriminatorForwardFn (line 304) | class AutoRegressiveDiscriminatorForwardFn: method __init__ (line 305) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:... method __call__ (line 310) | def __call__(self, batch): class GeneratorForwardFn (line 318) | class GeneratorForwardFn: method __init__ (line 319) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:... method __call__ (line 328) | def __call__(self, batch): class GeneratorCLSForwardFn (line 358) | class GeneratorCLSForwardFn(GeneratorForwardFn): method __call__ (line 359) | def __call__(self, batch): FILE: PFPO/general_util/fs_tp_utils.py function broadcast_data (line 7) | def broadcast_data(keys, data, datatype): FILE: PFPO/general_util/fsdp_utils.py function default_initialize (line 13) | def default_initialize(model: torch.nn.Module, function vae_specific_initialize (line 42) | def vae_specific_initialize(model: torch.nn.Module, function recursive_initialize (line 79) | def recursive_initialize(model: torch.nn.Module, function default_initialize_v2 (line 113) | def default_initialize_v2(model: torch.nn.Module, FILE: PFPO/general_util/lightseq_utils.py class LSHFTransformerEncoderLayer (line 12) | class LSHFTransformerEncoderLayer(LSTransformerEncoderLayer): method __init__ (line 13) | def __init__(self, *args, **kwargs): method forward (line 16) | def forward(self, hidden_states, encoder_padding_mask, *args, **kwargs): function gen_bert_config (line 23) | def gen_bert_config(cfg: DictConfig, config): function get_hf_bert_enc_layer_params (line 41) | def get_hf_bert_enc_layer_params(layer): function inject_ls_enc_layer (line 66) | def inject_ls_enc_layer(model, cfg, config): function inject_ls_roberta_enc_layer (line 75) | def inject_ls_roberta_enc_layer(model, cfg, config): FILE: PFPO/general_util/logger.py function get_child_logger (line 9) | def get_child_logger(child_name): function setting_logger (line 18) | def setting_logger(log_file: str, local_rank: int = -1): FILE: PFPO/general_util/mixin.py class LogMixin (line 12) | class LogMixin: method init_metric (line 15) | def init_metric(self, *metric_names): method get_eval_log (line 18) | def get_eval_log(self, reset=False, ddp=False, device='cpu'): class MetricMixin (line 37) | class MetricMixin: method __init__ (line 39) | def __init__(self, metrics: List[Tuple[str, str, str, str]]): class PredictionMixin (line 50) | class PredictionMixin: method reset_predict_tensors (line 53) | def reset_predict_tensors(self): method concat_predict_tensors (line 56) | def concat_predict_tensors(self, **tensors: torch.Tensor): method get_predict_tensors (line 60) | def get_predict_tensors(self): FILE: PFPO/general_util/mpu_proxy.py function get_model_parallel_group (line 10) | def get_model_parallel_group(): function get_model_parallel_rank (line 14) | def get_model_parallel_rank(): function get_model_parallel_world_size (line 18) | def get_model_parallel_world_size(): function get_data_parallel_group (line 22) | def get_data_parallel_group(): function get_data_parallel_rank (line 26) | def get_data_parallel_rank(): function get_data_parallel_world_size (line 30) | def get_data_parallel_world_size(): function prepare_distributed_sampler (line 34) | def prepare_distributed_sampler(dataset: torch.utils.data.Dataset, rando... FILE: PFPO/general_util/tensorboard_helper.py class SummaryWriterHelper (line 11) | class SummaryWriterHelper: method __init__ (line 12) | def __init__(self, method __call__ (line 29) | def __call__(self, step: int, last_batch: Union[Dict, Tuple] = None, l... class WandbWriter (line 48) | class WandbWriter: method __init__ (line 49) | def __init__(self, method update (line 65) | def update(self, last_batch: Union[Dict, Tuple] = None, last_outputs: ... method __call__ (line 93) | def __call__(self, clear: bool = True) -> Dict[str, Any]: FILE: PFPO/general_util/tokenization_utils.py function tokenizer_get_name (line 13) | def tokenizer_get_name(_tokenizer: PreTrainedTokenizer): function expand_special_tokenizer (line 20) | def expand_special_tokenizer(tokenizer: PreTrainedTokenizer): function init_tokenizer (line 64) | def init_tokenizer(tokenizer_path: str, **kwargs) -> PreTrainedTokenizer: function is_seq2seq_tokenizer (line 70) | def is_seq2seq_tokenizer(tokenizer: PreTrainedTokenizer): FILE: PFPO/general_util/torch_fsdp_utils.py function torch_fsdp_initialize_default (line 20) | def torch_fsdp_initialize_default(model, function torch_fsdp_init_decoder_freeze (line 52) | def torch_fsdp_init_decoder_freeze(model, function torch_fsdp_init_quantizer_ignore (line 84) | def torch_fsdp_init_quantizer_ignore(model, function torch_fsdp_size_auto_wrap (line 117) | def torch_fsdp_size_auto_wrap(model, function torch_fsdp_peft_auto_wrap (line 150) | def torch_fsdp_peft_auto_wrap(model, function torch_fsdp_transformer_init (line 175) | def torch_fsdp_transformer_init(model, FILE: PFPO/general_util/training_utils.py function set_seed (line 22) | def set_seed(args): function set_seed_int (line 30) | def set_seed_int(seed): function get_rank (line 36) | def get_rank(): function to_list (line 43) | def to_list(tensor): function unwrap_model (line 47) | def unwrap_model(model: torch.nn.Module) -> torch.nn.Module: function get_zero_stage (line 60) | def get_zero_stage(cfg: DictConfig): function return_torch_dtype (line 66) | def return_torch_dtype(dtype: str): function batch_to_device (line 79) | def batch_to_device(batch: Dict[str, torch.Tensor], device): function initialize_dataset (line 94) | def initialize_dataset(cfg: DictConfig, file_path: str, tokenizer: PreTr... function load_and_cache_examples (line 104) | def load_and_cache_examples(cfg, tokenizer: PreTrainedTokenizer, _split=... function organize_multiple_dataset (line 141) | def organize_multiple_dataset(cfg, tokenizer: PreTrainedTokenizer, _spli... function if_cancel_sync (line 190) | def if_cancel_sync(cfg: DictConfig, step: int): function initialize_optimizer (line 197) | def initialize_optimizer(cfg: DictConfig, grouped_parameters: List[Dict]... function get_optimizer_grouped_parameters (line 270) | def get_optimizer_grouped_parameters( function initialize_lr_scheduler (line 317) | def initialize_lr_scheduler(cfg: DictConfig, optimizer, num_warmup_steps... function note_best_checkpoint (line 345) | def note_best_checkpoint(cfg: DictConfig, results: Dict[str, float], sub... function get_last_checkpoint (line 360) | def get_last_checkpoint(folder): FILE: PFPO/general_util/transformer_engine.py function convert_model (line 23) | def convert_model(model, to_transformer_engine=True, _convert_linear=Tru... function has_transformer_engine_layers (line 74) | def has_transformer_engine_layers(model): FILE: PFPO/models/dpo_utils.py function sft_loss_on_logits (line 18) | def sft_loss_on_logits(logits: torch.FloatTensor, labels: torch.LongTens... function llama_dpo_batch_forward (line 48) | def llama_dpo_batch_forward(model: Union[LlamaForCausalLM, GemmaForCausa... function llama_batch_forward (line 77) | def llama_batch_forward(model: Union[LlamaForCausalLM, GemmaForCausalLM,... function tdpo_get_batch_logps (line 89) | def tdpo_get_batch_logps(logits: torch.FloatTensor, reference_logits: to... function llama_last_token_cls_batch_forward (line 137) | def llama_last_token_cls_batch_forward(model: Union[LlamaModel, GemmaFor... function llama_token_batch_forward (line 158) | def llama_token_batch_forward(model: Union[LlamaModel, GemmaModel], line... function llama_last_token_forward_value (line 182) | def llama_last_token_forward_value(model: Union[LlamaModel, GemmaForCaus... FILE: PFPO/models/ds_utils.py function init_ds_training_engine (line 8) | def init_ds_training_engine(model: PreTrainedModel, ds_cfg: DictConfig, ... function init_ds_eval_engine (line 28) | def init_ds_eval_engine(model: PreTrainedModel, ds_cfg: DictConfig): FILE: PFPO/models/fs_tp_mixin.py class PretrainedModelParallelPreSplitMixin (line 11) | class PretrainedModelParallelPreSplitMixin(PreTrainedModelPeftMixin): method from_pretrained (line 13) | def from_pretrained( method save_pretrained (line 25) | def save_pretrained( method from_pretrained_with_ref_model (line 37) | def from_pretrained_with_ref_model(cls, pretrained_model_name_or_path:... FILE: PFPO/models/llama.py function return_single_device_map (line 32) | def return_single_device_map(): class LlamaForCausalLMDPO (line 36) | class LlamaForCausalLMDPO(PreTrainedModelPeftMixin, HfLlamaForCausalLM): method __init__ (line 37) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 52) | def dpo_loss( method forward (line 98) | def forward( method save_pretrained (line 144) | def save_pretrained( class LlamaForCausalLMKTO (line 168) | class LlamaForCausalLMKTO(PreTrainedModelPeftMixin, HfLlamaForCausalLM): method __init__ (line 169) | def __init__(self, config, beta: float = 0.1, desirable_weight: float ... method kto_loss (line 179) | def kto_loss( method forward (line 190) | def forward( method save_pretrained (line 229) | def save_pretrained( class LlamaForCausalLMSimPO (line 253) | class LlamaForCausalLMSimPO(PreTrainedModelPeftMixin, HfLlamaForCausalLM): method __init__ (line 254) | def __init__(self, config, gamma: float, beta: float = 0.1, label_smoo... method simpo_loss (line 270) | def simpo_loss( method forward (line 306) | def forward( method save_pretrained (line 344) | def save_pretrained( class LlamaForCausalLMTDPO (line 368) | class LlamaForCausalLMTDPO(PreTrainedModelPeftMixin, HfLlamaForCausalLM): method __init__ (line 369) | def __init__(self, config, beta: float, alpha: float = 0.5, sft_loss: ... method tdpo_loss (line 382) | def tdpo_loss(self, chosen_logps_margin: torch.FloatTensor, method forward (line 422) | def forward( method save_pretrained (line 469) | def save_pretrained( class LlamaRewardModel (line 493) | class LlamaRewardModel(PreTrainedModelPeftMixin, LlamaPreTrainedModel): method __init__ (line 494) | def __init__(self, config: LlamaConfig, use_token_avg: bool = False): method pair_wise_loss (line 504) | def pair_wise_loss(self, method forward (line 510) | def forward( class LlamaRewardModelForEval (line 543) | class LlamaRewardModelForEval(LlamaRewardModel): method forward (line 544) | def forward( class LlamaModelForSequenceClassification (line 565) | class LlamaModelForSequenceClassification(PreTrainedModelPeftMixin, Llam... method __init__ (line 566) | def __init__(self, config: LlamaConfig): method forward (line 574) | def forward( class LlamaModelForSequenceClassificationForEval (line 597) | class LlamaModelForSequenceClassificationForEval(LlamaModelForSequenceCl... method __init__ (line 598) | def __init__(self, config: LlamaConfig, return_full_logits: bool = True): method forward (line 608) | def forward( class LlamaModelForSequenceClassificationForRL (line 625) | class LlamaModelForSequenceClassificationForRL(LlamaModelForSequenceClas... method __init__ (line 626) | def __init__(self, config: LlamaConfig, reduce_func: Callable): method forward (line 631) | def forward( class LlamaForCausalLM (line 651) | class LlamaForCausalLM(PreTrainedModelPeftMixin, HfLlamaForCausalLM): method forward (line 652) | def forward(self, FILE: PFPO/models/llama_megatron_tp.py class ColumnParallelLinear (line 43) | class ColumnParallelLinear(ColumnParallelLinearMP): method forward (line 44) | def forward(self, input_: torch.Tensor, weight: Optional[torch.Tensor]... class RowParallelLinear (line 48) | class RowParallelLinear(RowParallelLinearMP): method forward (line 49) | def forward(self, input_): function init_megatron_mp_config (line 53) | def init_megatron_mp_config(*args, **kwargs): function attention_tp_init (line 64) | def attention_tp_init(self: LlamaAttention, config: LlamaConfig): class LlamaAttentionParallel (line 107) | class LlamaAttentionParallel(LlamaAttention): method __init__ (line 108) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): class LlamaFlashAttention2Parallel (line 114) | class LlamaFlashAttention2Parallel(LlamaFlashAttention2): method __init__ (line 115) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): class LlamaSdpaAttentionParallel (line 123) | class LlamaSdpaAttentionParallel(LlamaSdpaAttention): method __init__ (line 131) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): class LlamaMLPParallel (line 137) | class LlamaMLPParallel(LlamaMLP): method __init__ (line 138) | def __init__(self, config: LlamaConfig): class LlamaModelParallel (line 175) | class LlamaModelParallel(LlamaModel): method __init__ (line 176) | def __init__(self, config: LlamaConfig): class LlamaForCausalLM (line 207) | class LlamaForCausalLM(PretrainedModelParallelPreSplitMixin, HfLlamaForC... method __init__ (line 208) | def __init__(self, config: LlamaConfig): method forward (line 233) | def forward(self, class LlamaModelForSequenceClassification (line 299) | class LlamaModelForSequenceClassification(PretrainedModelParallelPreSpli... method __init__ (line 300) | def __init__(self, config: LlamaConfig): method forward (line 308) | def forward( class LlamaModelForSequenceClassificationForRL (line 326) | class LlamaModelForSequenceClassificationForRL(PretrainedModelParallelPr... method __init__ (line 327) | def __init__(self, config: LlamaConfig, reduce_func: Callable): method forward (line 334) | def forward( class LlamaForCausalLMDPO (line 354) | class LlamaForCausalLMDPO(LlamaForCausalLM): method __init__ (line 355) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 370) | def dpo_loss( method forward (line 416) | def forward( method save_pretrained (line 462) | def save_pretrained( FILE: PFPO/models/llama_tp.py function attention_tp_init (line 35) | def attention_tp_init(self: LlamaAttention, config: LlamaConfig): class LlamaAttentionParallel (line 73) | class LlamaAttentionParallel(LlamaAttention): method __init__ (line 74) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): class LlamaFlashAttention2Parallel (line 80) | class LlamaFlashAttention2Parallel(LlamaFlashAttention2): method __init__ (line 81) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): class LlamaSdpaAttentionParallel (line 89) | class LlamaSdpaAttentionParallel(LlamaSdpaAttention): method __init__ (line 97) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): class LlamaMLPParallel (line 103) | class LlamaMLPParallel(LlamaMLP): method __init__ (line 104) | def __init__(self, config: LlamaConfig): class LlamaModelParallel (line 137) | class LlamaModelParallel(LlamaModel): method __init__ (line 138) | def __init__(self, config: LlamaConfig): class LlamaForCausalLM (line 167) | class LlamaForCausalLM(PretrainedModelParallelPreSplitMixin, HfLlamaForC... method __init__ (line 168) | def __init__(self, config: LlamaConfig): method forward (line 175) | def forward(self, class LlamaModelForSequenceClassification (line 240) | class LlamaModelForSequenceClassification(PretrainedModelParallelPreSpli... method __init__ (line 241) | def __init__(self, config: LlamaConfig): method forward (line 249) | def forward( class LlamaModelForSequenceClassificationForRL (line 267) | class LlamaModelForSequenceClassificationForRL(PretrainedModelParallelPr... method __init__ (line 268) | def __init__(self, config: LlamaConfig, reduce_func: Callable): method forward (line 275) | def forward( class LlamaForCausalLMDPO (line 295) | class LlamaForCausalLMDPO(LlamaForCausalLM): method __init__ (line 296) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 311) | def dpo_loss( method forward (line 357) | def forward( method save_pretrained (line 403) | def save_pretrained( FILE: PFPO/models/megatron_tp_mixin.py class PretrainedModelParallelPreSplitMixin (line 12) | class PretrainedModelParallelPreSplitMixin(PreTrainedModelPeftMixin): method from_pretrained (line 14) | def from_pretrained( method save_pretrained (line 26) | def save_pretrained( method from_pretrained_with_ref_model (line 38) | def from_pretrained_with_ref_model(cls, pretrained_model_name_or_path:... method state_dict (line 48) | def state_dict(self, *args, **kwargs): FILE: PFPO/models/mistral.py class MistralForCausalLMDPO (line 30) | class MistralForCausalLMDPO(PreTrainedModelPeftMixin, HfMistralForCausal... method __init__ (line 31) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 46) | def dpo_loss( method forward (line 92) | def forward( method save_pretrained (line 138) | def save_pretrained( class MistralForCausalLMTDPO (line 162) | class MistralForCausalLMTDPO(PreTrainedModelPeftMixin, HfMistralForCausa... method __init__ (line 163) | def __init__(self, config, beta: float, alpha: float = 0.5, sft_loss: ... method tdpo_loss (line 175) | def tdpo_loss(self, chosen_logps_margin: torch.FloatTensor, method forward (line 215) | def forward( method save_pretrained (line 262) | def save_pretrained( class MistralForCausalLM (line 286) | class MistralForCausalLM(PreTrainedModelPeftMixin, HfMistralForCausalLM): method forward (line 287) | def forward( class MistralForSequenceClassification (line 351) | class MistralForSequenceClassification(PreTrainedModelPeftMixin, Mistral... method __init__ (line 352) | def __init__(self, config: MistralConfig): method forward (line 360) | def forward( class MistralForSequenceClassificationForEval (line 383) | class MistralForSequenceClassificationForEval(MistralForSequenceClassifi... method __init__ (line 384) | def __init__(self, config: MistralConfig, return_full_logits: bool = T... method forward (line 394) | def forward( FILE: PFPO/models/mistral_tp.py function attention_tp_init (line 36) | def attention_tp_init(self: MistralAttention, config: MistralConfig): class MistralAttentionTensorParallel (line 71) | class MistralAttentionTensorParallel(MistralAttention): method __init__ (line 72) | def __init__(self, config: MistralConfig, layer_idx: Optional[int] = N... class MistralFlashAttentionTensorParallel (line 78) | class MistralFlashAttentionTensorParallel(MistralFlashAttention2): method __init__ (line 79) | def __init__(self, config: MistralConfig, layer_idx: Optional[int] = N... class MistralSdpaAttentionTensorParallel (line 87) | class MistralSdpaAttentionTensorParallel(MistralSdpaAttention): method __init__ (line 88) | def __init__(self, config: MistralConfig, layer_idx: Optional[int] = N... class MistralMLPTensorParallel (line 94) | class MistralMLPTensorParallel(MistralMLP): method __init__ (line 95) | def __init__(self, config: MistralConfig): class MistralModelTensorParallel (line 127) | class MistralModelTensorParallel(MistralModel): method __init__ (line 128) | def __init__(self, config: MistralConfig): class MistralForCausalLM (line 147) | class MistralForCausalLM(PretrainedModelParallelPreSplitMixin, HfMistral... method __init__ (line 148) | def __init__(self, config: MistralConfig): method forward (line 157) | def forward( class MistralForCausalLMDPO (line 220) | class MistralForCausalLMDPO(MistralForCausalLM): method __init__ (line 221) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 236) | def dpo_loss( method forward (line 282) | def forward( method save_pretrained (line 328) | def save_pretrained( class MistralForCausalLMTDPO (line 356) | class MistralForCausalLMTDPO(MistralForCausalLM): method __init__ (line 357) | def __init__(self, config, beta: float, alpha: float = 0.5, sft_loss: ... method tdpo_loss (line 369) | def tdpo_loss(self, chosen_logps_margin: torch.FloatTensor, method forward (line 409) | def forward( method save_pretrained (line 456) | def save_pretrained( FILE: PFPO/models/mixin.py function return_single_device_map (line 15) | def return_single_device_map(): function return_reference_model (line 19) | def return_reference_model(): function set_reference_model (line 23) | def set_reference_model(model: PreTrainedModel): class PreTrainedModelPeftMixin (line 28) | class PreTrainedModelPeftMixin(PreTrainedModel): method from_pretrained (line 32) | def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union... method from_pretrained_with_ref_model (line 42) | def from_pretrained_with_ref_model(cls, pretrained_model_name_or_path:... method deepspeed_set_ref_engine_lazy (line 58) | def deepspeed_set_ref_engine_lazy(ref_model): FILE: PFPO/models/qwen2.py class Qwen2ForCausalLM (line 23) | class Qwen2ForCausalLM(PreTrainedModelPeftMixin, HfQwen2ForCausalLM): method forward (line 25) | def forward( class Qwen2RewardModel (line 89) | class Qwen2RewardModel(PreTrainedModelPeftMixin, HfQwen2ForCausalLM): method __init__ (line 90) | def __init__(self, config: Qwen2Config): method pair_wise_loss (line 99) | def pair_wise_loss(chosen_rewards: torch.FloatTensor, method forward (line 104) | def forward( class Qwen2ForSequenceClassification (line 134) | class Qwen2ForSequenceClassification(PreTrainedModelPeftMixin, HfQwen2Fo... method __init__ (line 135) | def __init__(self, config: Qwen2Config): method forward (line 143) | def forward( class Qwen2ForCausalLMDPO (line 168) | class Qwen2ForCausalLMDPO(PreTrainedModelPeftMixin, HfQwen2ForCausalLM): method __init__ (line 169) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 187) | def dpo_loss( method forward (line 233) | def forward( method save_pretrained (line 297) | def save_pretrained( FILE: PFPO/models/qwen2_megatron_tp.py class ColumnParallelLinear (line 43) | class ColumnParallelLinear(ColumnParallelLinearMP): method forward (line 44) | def forward(self, input_: torch.Tensor, weight: Optional[torch.Tensor]... class RowParallelLinear (line 48) | class RowParallelLinear(RowParallelLinearMP): method forward (line 49) | def forward(self, input_): function init_megatron_mp_config (line 53) | def init_megatron_mp_config(*args, **kwargs): function attention_tp_init (line 64) | def attention_tp_init(self: Qwen2Attention, config: Qwen2Config): class Qwen2AttentionParallel (line 107) | class Qwen2AttentionParallel(Qwen2Attention): method __init__ (line 108) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): class Qwen2FlashAttention2Parallel (line 114) | class Qwen2FlashAttention2Parallel(Qwen2FlashAttention2): method __init__ (line 115) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): class Qwen2SdpaAttentionParallel (line 123) | class Qwen2SdpaAttentionParallel(Qwen2SdpaAttention): method __init__ (line 131) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): class Qwen2MLPParallel (line 137) | class Qwen2MLPParallel(Qwen2MLP): method __init__ (line 138) | def __init__(self, config: Qwen2Config): class Qwen2ModelParallel (line 175) | class Qwen2ModelParallel(Qwen2Model): method __init__ (line 176) | def __init__(self, config: Qwen2Config): class Qwen2ForCausalLM (line 207) | class Qwen2ForCausalLM(PretrainedModelParallelPreSplitMixin, HfQwen2ForC... method __init__ (line 208) | def __init__(self, config: Qwen2Config): method forward (line 217) | def forward(self, class Qwen2ModelForSequenceClassification (line 283) | class Qwen2ModelForSequenceClassification(PretrainedModelParallelPreSpli... method __init__ (line 284) | def __init__(self, config: Qwen2Config): method forward (line 292) | def forward( class Qwen2ModelForSequenceClassificationForRL (line 310) | class Qwen2ModelForSequenceClassificationForRL(PretrainedModelParallelPr... method __init__ (line 311) | def __init__(self, config: Qwen2Config, reduce_func: Callable): method forward (line 318) | def forward( class Qwen2ForCausalLMDPO (line 338) | class Qwen2ForCausalLMDPO(Qwen2ForCausalLM): method __init__ (line 339) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 354) | def dpo_loss( method forward (line 400) | def forward( method save_pretrained (line 446) | def save_pretrained( FILE: PFPO/models/qwen2_tp.py function attention_tp_init (line 35) | def attention_tp_init(self: Qwen2Attention, config: Qwen2Config): class Qwen2AttentionParallel (line 71) | class Qwen2AttentionParallel(Qwen2Attention): method __init__ (line 72) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): class Qwen2FlashAttention2Parallel (line 78) | class Qwen2FlashAttention2Parallel(Qwen2FlashAttention2): method __init__ (line 79) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): class Qwen2SdpaAttentionParallel (line 87) | class Qwen2SdpaAttentionParallel(Qwen2SdpaAttention): method __init__ (line 95) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): class Qwen2MLPParallel (line 101) | class Qwen2MLPParallel(Qwen2MLP): method __init__ (line 102) | def __init__(self, config: Qwen2Config): class Qwen2ModelParallel (line 135) | class Qwen2ModelParallel(Qwen2Model): method __init__ (line 136) | def __init__(self, config: Qwen2Config): class Qwen2ForCausalLM (line 165) | class Qwen2ForCausalLM(PretrainedModelParallelPreSplitMixin, HfQwen2ForC... method __init__ (line 166) | def __init__(self, config: Qwen2Config): method forward (line 173) | def forward(self, class Qwen2ModelForSequenceClassification (line 239) | class Qwen2ModelForSequenceClassification(PretrainedModelParallelPreSpli... method __init__ (line 240) | def __init__(self, config: Qwen2Config): method forward (line 248) | def forward( class Qwen2ModelForSequenceClassificationForRL (line 266) | class Qwen2ModelForSequenceClassificationForRL(PretrainedModelParallelPr... method __init__ (line 267) | def __init__(self, config: Qwen2Config, reduce_func: Callable): method forward (line 274) | def forward( class Qwen2ForCausalLMDPO (line 294) | class Qwen2ForCausalLMDPO(Qwen2ForCausalLM): method __init__ (line 295) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =... method dpo_loss (line 311) | def dpo_loss( method forward (line 357) | def forward( method save_pretrained (line 410) | def save_pretrained( FILE: PFPO/models/utils.py function find_all_linear_names (line 35) | def find_all_linear_names(model, bits: int, add_lm_head: bool = False): function initialize_peft_model (line 50) | def initialize_peft_model(model: PreTrainedModel, lora_config: DictConfi... function enable_gradient_checkpointing (line 93) | def enable_gradient_checkpointing(model: PreTrainedModel): class DPOModelOutput (line 100) | class DPOModelOutput(ModelOutput): class RewardModelOutput (line 113) | class RewardModelOutput(ModelOutput): function return_single_device_map (line 119) | def return_single_device_map(): function reward_logit2prob (line 123) | def reward_logit2prob(reduction_ids): function reward_logit (line 140) | def reward_logit(reduction_ids): function squeeze_reduce_return_fn (line 156) | def squeeze_reduce_return_fn(): FILE: PFPO/openai_api_caller_v1.py function default_collate_fn (line 39) | def default_collate_fn(batch): function run_inference (line 42) | def run_inference(cfg: DictConfig, model: torch.nn.Module, dataset): function main (line 87) | def main(cfg: DictConfig): FILE: PFPO/post_inference.py function evaluate (line 39) | def evaluate(cfg: DictConfig, model, prefix="", _split="dev"): function main (line 84) | def main(cfg: DictConfig): FILE: PFPO/post_processors/code/clean.py function standard_cleaner (line 4) | def standard_cleaner(completion: str): function standard_cleaner_default (line 14) | def standard_cleaner_default(completion: str): function tag_cleaner (line 24) | def tag_cleaner(completion: str): function get (line 42) | def get(name: str): FILE: PFPO/post_processors/code/code.py function _mp_init_ (line 21) | def _mp_init_(_eval_func: Callable): function _eval_worker (line 26) | def _eval_worker(_input): class APPsEvaluator (line 47) | class APPsEvaluator: method __init__ (line 48) | def __init__(self, ): method __call__ (line 51) | def __call__(self, predictions, num_workers: int = 16): class CodeExtractor (line 153) | class CodeExtractor: method __init__ (line 154) | def __init__(self, output_file: str, answer_clean: Callable, resume: b... method __call__ (line 189) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method batch_call (line 236) | def batch_call(self, meta_data: List[Dict[str, Any]], batch_model_outp... method eval_single_response (line 241) | def eval_single_response(self, response: str, test_cases): method get_results (line 248) | def get_results(self): FILE: PFPO/post_processors/code/evaluator.py function return_apps_evaluator (line 12) | def return_apps_evaluator(timeout: int = 10, debug: bool = False): class HumanEvaluator (line 16) | class HumanEvaluator: method __init__ (line 17) | def __init__(self, ): method __call__ (line 20) | def __call__(self, predictions, num_workers: int = 16): class MBPPEvaluator (line 100) | class MBPPEvaluator: method __init__ (line 101) | def __init__(self, ): method __call__ (line 104) | def __call__(self, predictions, num_workers: int = 16): FILE: PFPO/post_processors/dist_mixin.py class DistGatherMixin (line 7) | class DistGatherMixin: method gather (line 8) | def gather(self): method gather_object (line 12) | def gather_object(objects: List[Any]): class SFTLossOnlyPostProcessor (line 24) | class SFTLossOnlyPostProcessor(DistGatherMixin): method __init__ (line 25) | def __init__(self): method __call__ (line 29) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 39) | def get_results(self, output_dir: str): FILE: PFPO/post_processors/dpo.py class DPOEvalPostProcessor (line 16) | class DPOEvalPostProcessor(DistGatherMixin): method __init__ (line 17) | def __init__(self): method __call__ (line 24) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 66) | def get_results(self, output_dir: str): class DPORewardPostProcessor (line 91) | class DPORewardPostProcessor(DistGatherMixin): method __init__ (line 92) | def __init__(self): method __call__ (line 97) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 139) | def get_results(self, output_dir: str): class ResponseClsPostProcessor (line 161) | class ResponseClsPostProcessor(DistGatherMixin): method __init__ (line 162) | def __init__(self): method __call__ (line 166) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 200) | def get_results(self, output_dir: str): function process_response (line 225) | def process_response(response: str): function process_response_v2 (line 231) | def process_response_v2(response: str): class ResponseProcessRewardPostProcessor (line 297) | class ResponseProcessRewardPostProcessor(DistGatherMixin): method __init__ (line 298) | def __init__(self, reduction: str = "product", prob_labels: str = "(2,... method logit2prob (line 308) | def logit2prob(self, logits): method __call__ (line 313) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 360) | def get_results(self, output_dir: str): class ResponseProcessRewardPostProcessorV2 (line 385) | class ResponseProcessRewardPostProcessorV2(DistGatherMixin): method __init__ (line 386) | def __init__(self, reduction: str = "product", prob_labels: str = "(2,... method logit2prob (line 396) | def logit2prob(self, logits): method __call__ (line 401) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 452) | def get_results(self, output_dir: str): class DPORewardSinglePostProcessor (line 480) | class DPORewardSinglePostProcessor(DistGatherMixin): method __init__ (line 481) | def __init__(self): method __call__ (line 485) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 515) | def get_results(self, output_dir: str): FILE: PFPO/post_processors/openai_api_callback.py class PlaceholderClean (line 19) | class PlaceholderClean: method __call__ (line 20) | def __call__(self, pred: str): class MCQAAnswerClean (line 24) | class MCQAAnswerClean: method __init__ (line 25) | def __init__(self, prompt: str = "zero-shot"): method __call__ (line 28) | def __call__(self, pred: str): class SeparatorClean (line 41) | class SeparatorClean: method __init__ (line 42) | def __init__(self, separator: str = "Finish", separate_idx: int = 1, r... method __call__ (line 47) | def __call__(self, pred: str): class ReActSeparatorClean (line 64) | class ReActSeparatorClean: # FIXED@2024-01-03: Add hard constraint. method __init__ (line 65) | def __init__(self, separator: str = "Context:", separate_idx: int = 0,... method __call__ (line 70) | def __call__(self, pred: str): class BinaryAnswerClean (line 88) | class BinaryAnswerClean: method __init__ (line 89) | def __init__(self, prompt: str = "zero-shot"): method __call__ (line 92) | def __call__(self, pred: str): class TagCleaner (line 104) | class TagCleaner: method __call__ (line 105) | def __call__(self, pred: str): class OpenAICallBack (line 115) | class OpenAICallBack: method __init__ (line 116) | def __init__(self, output_file: str, answer_clean: Union[MCQAAnswerCle... method __call__ (line 149) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method batch_call (line 190) | def batch_call(self, meta_data: List[Dict[str, Any]], batch_model_outp... method eval_single_item (line 196) | def eval_single_item(pred, label): method get_results (line 211) | def get_results(self): class SaveOnlyCallBack (line 274) | class SaveOnlyCallBack(OpenAICallBack): method __call__ (line 275) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 310) | def get_results(self): function majority_voting_predict (line 319) | def majority_voting_predict(preds): class OpenAIMATHCallBack (line 343) | class OpenAIMATHCallBack(OpenAICallBack): method __init__ (line 348) | def __init__(self, *args, eval_fn: str = "meta_math", **kwargs): method get_results (line 352) | def get_results(self): class DeepSeekMathCallBack (line 416) | class DeepSeekMathCallBack(OpenAICallBack): method __init__ (line 427) | def __init__(self, *args, eval_fn: str = "gsm8k", **kwargs): method __call__ (line 435) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 475) | def get_results(self): class MathScaleCallBack (line 575) | class MathScaleCallBack(OpenAICallBack): method __call__ (line 577) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 645) | def get_results(self): function fix_trailing_comma (line 687) | def fix_trailing_comma(json_string): function extract_json_content_rep (line 693) | def extract_json_content_rep(input_str): function extract_json_content (line 709) | def extract_json_content(input_str): class JsonObjEvalCallBack (line 727) | class JsonObjEvalCallBack(OpenAICallBack): method json_parse_and_eval (line 729) | def json_parse_and_eval(response: str, label: dict): method __call__ (line 748) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 802) | def get_results(self): FILE: PFPO/post_processors/pattern/tags.py function think_tag_cleaner (line 4) | def think_tag_cleaner(completion: str): function solution_tag_cleaner (line 18) | def solution_tag_cleaner(completion: str): function output_tag_cleaner (line 31) | def output_tag_cleaner(completion: str): function get (line 51) | def get(name: str): FILE: PFPO/post_processors/qwen25_math_callback.py function _annotate (line 20) | def _annotate(param): class Qwen25MathCallBack (line 24) | class Qwen25MathCallBack(OpenAICallBack): method __init__ (line 25) | def __init__(self, *args, num_workers: int = 16, **kwargs): method __call__ (line 29) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic... method get_results (line 79) | def get_results(self): FILE: PFPO/scripts/apps/analyze/freq2image.py function draw_double_histogram (line 10) | def draw_double_histogram(correct_data, incorrect_data, file_path): function draw_histogram (line 27) | def draw_histogram(data, labels, file_path): function draw_line_plot (line 52) | def draw_line_plot(correct_data, incorrect_data, file_path): function main (line 81) | def main(): FILE: PFPO/scripts/apps/analyze/get_output_frequency.py function worker (line 15) | def worker(x): function load_files (line 131) | def load_files(file_path): function merge_key (line 149) | def merge_key(item, value): function merge_seed_sampled_data (line 158) | def merge_seed_sampled_data(data): function main (line 189) | def main(): FILE: PFPO/scripts/apps/construct_prefer_pair.py function main (line 11) | def main(): FILE: PFPO/scripts/apps/construct_prefer_pair_rm.py function main (line 11) | def main(): FILE: PFPO/scripts/apps/construct_prefer_pair_soft.py function main (line 16) | def main(): FILE: PFPO/scripts/apps/eval_gpt4_outputs.py function main (line 14) | def main(): FILE: PFPO/scripts/apps/execute_gold_sol_on_test_case.py function extract_solution_between_tags (line 21) | def extract_solution_between_tags(text): function extract_test_cases (line 32) | def extract_test_cases(text): function _worker (line 45) | def _worker(item): function main (line 63) | def main(): FILE: PFPO/scripts/apps/extract_pseudo_outputs_as_label.py function main (line 9) | def main(): FILE: PFPO/scripts/apps/get_output_frequency.py function main (line 11) | def main(): FILE: PFPO/scripts/apps/gpt4o_to_normal_pred_format.py function main (line 13) | def main(): FILE: PFPO/scripts/apps/merge_dp_predictions.py function main (line 12) | def main(): FILE: PFPO/scripts/apps/pp_critique_difficulty.py function main (line 15) | def main(): FILE: PFPO/scripts/apps/pp_eval_gpt4.py function main (line 13) | def main(): FILE: PFPO/scripts/apps/pp_eval_gpt4_general_combine.py function main (line 13) | def main(): FILE: PFPO/scripts/apps/pp_solution_gen_inputs.py function main (line 36) | def main(): FILE: PFPO/scripts/apps/pp_test_case.py function extract_content_between_tags (line 20) | def extract_content_between_tags(text): function extract_test_cases (line 31) | def extract_test_cases(text): function main (line 44) | def main(): FILE: PFPO/scripts/apps/pp_test_case_gen_inputs.py function main (line 34) | def main(): FILE: PFPO/scripts/apps/pp_test_case_gen_inputs_v2.0.py function main (line 11) | def main(): FILE: PFPO/scripts/apps/pp_test_case_gen_outputs.py function extract_test_cases (line 63) | def extract_test_cases(text): function main (line 76) | def main(): FILE: PFPO/scripts/apps/pp_test_case_gen_public_outputs.py function main (line 86) | def main(): FILE: PFPO/scripts/apps/pp_test_case_gen_public_outputs_few_shot.py function main (line 14) | def main(): FILE: PFPO/scripts/apps/pp_test_case_gen_public_outputs_few_shot_verify.py function extract_content_between_tags (line 17) | def extract_content_between_tags(text): function main (line 29) | def main(): FILE: PFPO/scripts/apps/pp_worsen_inputs.py function main (line 19) | def main(): FILE: PFPO/scripts/apps/prm/construct_process_rm_sample.py function counting_partial_response_value (line 23) | def counting_partial_response_value(res): function parse_value (line 27) | def parse_value(v, binary: bool): function _process_trajectories_worker (line 33) | def _process_trajectories_worker(item, top_k: int, binary: bool): function _annotate (line 56) | def _annotate(file): function multiprocessing_loading (line 60) | def multiprocessing_loading(files, num_workers: int = 8): function main (line 73) | def main(): FILE: PFPO/scripts/apps/prm/construct_process_rm_sample_fix.py function counting_partial_response_value (line 23) | def counting_partial_response_value(full_res): function annotate (line 36) | def annotate(file, exclude: str = ""): function multiprocessing_loading (line 44) | def multiprocessing_loading(files, exclude: str = "", num_workers: int =... function main (line 59) | def main(): FILE: PFPO/scripts/apps/prm/sample_steps.py function sample_step (line 14) | def sample_step(response: str, code: str, upper_step_ratio: float, sampl... function load_files (line 46) | def load_files(file_path): function merge_key (line 65) | def merge_key(item, value): function merge_seed_sampled_data (line 74) | def merge_seed_sampled_data(data): function main (line 98) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/clean_oss_mistral_data.py function load_file (line 8) | def load_file(file_path): function extract_json (line 25) | def extract_json(completion: str): function load_test_cases (line 42) | def load_test_cases(item): function load_func_head (line 67) | def load_func_head(item) -> str: function main (line 84) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/clean_xcode_4o_test_inputs_data.py function load_file (line 8) | def load_file(file_path): function load_test_cases (line 25) | def load_test_cases(item): function main (line 63) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/collect_pseudo_outputs.py function worker (line 20) | def worker(item, pseudo_test_case_field): function main (line 91) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/combine_gpt_raw_requests.py function main (line 15) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/combine_pseudo_test_inputs.py function extract_test_case_inputs (line 13) | def extract_test_case_inputs(item): function main (line 50) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs.py function worker (line 26) | def worker(item, min_success_test_num: int = 1): function main (line 104) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs_mp.py function worker (line 24) | def worker(item, min_success_test_num: int = 1, top_p: float = 0.0): function load_files (line 128) | def load_files(file_path): function merge_key (line 147) | def merge_key(item, value): function merge_seed_sampled_data (line 156) | def merge_seed_sampled_data(data): function main (line 208) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs_mp_compress.py function worker (line 26) | def worker(item, min_success_test_num: int = 1, top_p: float = 0.0): function load_files (line 113) | def load_files(file_path): function merge_key (line 132) | def merge_key(item, value): function merge_seed_sampled_data (line 141) | def merge_seed_sampled_data(data): function main (line 193) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs_takes_extra.py function worker (line 22) | def worker(_input, min_success_test_num: int = 1, top_p: float = 0.0): function load_files (line 129) | def load_files(file_path): function merge_key (line 148) | def merge_key(item, value): function merge_seed_sampled_data (line 157) | def merge_seed_sampled_data(data): function main (line 219) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_prefix_fail_extract_pseudo_label.py function _worker (line 19) | def _worker(item): function main (line 86) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_run_extract_pseudo_label.py function _worker (line 19) | def _worker(item): function main (line 56) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/pp_inputs_pick_problem_evol.py function main (line 5) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/pp_inputs_pick_problem_oss.py function main (line 5) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/prefix_fail_extract_pseudo_label.py function _worker (line 22) | def _worker(item): function main (line 59) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/prefix_fail_extract_pseudo_label_align_ts_num.py function _worker (line 23) | def _worker(item): function main (line 60) | def main(): FILE: PFPO/scripts/apps/pseudo_test_cases/xcode_pp_test_case_gen.py function main (line 30) | def main(): FILE: PFPO/scripts/apps/re_verify_solutions.py function main (line 5) | def main(): FILE: PFPO/scripts/apps/rerank_code_rm.py function main (line 11) | def main(): FILE: PFPO/scripts/apps/solution_fail_extract.py function extract_solution_between_tags (line 21) | def extract_solution_between_tags(text): function extract_test_cases (line 32) | def extract_test_cases(text): function _worker (line 45) | def _worker(item): function main (line 98) | def main(): FILE: PFPO/scripts/apps/solution_fail_extract_critique.py function _worker (line 21) | def _worker(item): function main (line 75) | def main(): FILE: PFPO/scripts/apps/solution_fail_extract_pseudo_label.py function _worker (line 23) | def _worker(item): function main (line 60) | def main(): FILE: PFPO/scripts/apps/solution_run_outputs.py function extract_solution_between_tags (line 21) | def extract_solution_between_tags(text): function extract_test_cases (line 32) | def extract_test_cases(text): function _worker (line 45) | def _worker(item): function main (line 103) | def main(): FILE: PFPO/scripts/apps/solution_run_outputs_local.py function _worker (line 25) | def _worker(item, test_case_field: str): function has_surrogate_characters (line 89) | def has_surrogate_characters(text): function load_files (line 93) | def load_files(file_path): function merge_key (line 112) | def merge_key(item, value): function merge_seed_sampled_data (line 121) | def merge_seed_sampled_data(data, id_field: str = "id"): function main (line 144) | def main(): FILE: PFPO/scripts/apps/solution_run_pseudo_outputs_local.py function extract_test_case_inputs (line 21) | def extract_test_case_inputs(item): function _worker (line 68) | def _worker(item): function main (line 124) | def main(): FILE: PFPO/scripts/apps/utils_execute.py class CODE_TYPE (line 34) | class CODE_TYPE(Enum): class TimeoutException (line 40) | class TimeoutException(Exception): function timeout_handler (line 44) | def timeout_handler(signum, frame): class Capturing (line 57) | class Capturing(list): method __enter__ (line 58) | def __enter__(self): method __exit__ (line 65) | def __exit__(self, *args): function parse_args (line 71) | def parse_args(): function check_correctness (line 88) | def check_correctness(in_outs: Dict, generation, timeout, debug, return_... function run_inference_process (line 130) | def run_inference_process(in_outs: Dict, generation, timeout, debug, ret... function run_test (line 182) | def run_test(in_outs: Dict = None, test: str = None, debug: bool = False... function run_inference (line 579) | def run_inference(in_outs: Dict = None, test: str = None, debug: bool = ... function custom_compare_ (line 995) | def custom_compare_(output, ground_truth): function stripped_string_compare (line 1010) | def stripped_string_compare(s1, s2): function call_method (line 1016) | def call_method(method, inputs): function reliability_guard (line 1042) | def reliability_guard(maximum_memory_bytes=None): function main (line 1123) | def main(): FILE: PFPO/scripts/apps/worsen_gpt4_combine.py function main (line 18) | def main(): FILE: PFPO/scripts/collect_mbpp_test_cases_outputs_sc_v1.0.py function process_completion (line 10) | def process_completion(completion: str): function main (line 33) | def main(): FILE: PFPO/scripts/eval_mbpp_judgement.py function mbpp_prediction_eval_judge (line 9) | def mbpp_prediction_eval_judge(prediction): function mbpp_judge (line 25) | def mbpp_judge(file_path, prompt2passed): function main (line 48) | def main(): FILE: PFPO/scripts/eval_mbpp_judgement_v2.py function mbpp_prediction_eval_judge (line 9) | def mbpp_prediction_eval_judge(prediction): function mbpp_judge (line 25) | def mbpp_judge(file_path): function main (line 49) | def main(): FILE: PFPO/scripts/execute_mbpp_intermediate_res.py function capture_print_output (line 68) | def capture_print_output(code): function _process_item (line 92) | def _process_item(item): function main (line 124) | def main(): FILE: PFPO/scripts/execute_mbpp_intermediate_res_mp.py function check_correctness (line 28) | def check_correctness(check_program, timeout, task_id, completion_id): function capture_print_output (line 61) | def capture_print_output(code): function unsafe_execute (line 87) | def unsafe_execute(check_program, result, timeout): function time_limit (line 121) | def time_limit(seconds): function swallow_io (line 134) | def swallow_io(): function create_tempdir (line 143) | def create_tempdir(): class TimeoutException (line 149) | class TimeoutException(Exception): class WriteOnlyStringIO (line 153) | class WriteOnlyStringIO(io.StringIO): method read (line 156) | def read(self, *args, **kwargs): method readline (line 159) | def readline(self, *args, **kwargs): method readlines (line 162) | def readlines(self, *args, **kwargs): method readable (line 165) | def readable(self, *args, **kwargs): class redirect_stdin (line 170) | class redirect_stdin(contextlib._RedirectStream): # type: ignore function chdir (line 175) | def chdir(root): function reliability_guard (line 189) | def reliability_guard(maximum_memory_bytes=None): FILE: PFPO/scripts/math/analyze_sc.py function majority_voting_predict (line 10) | def majority_voting_predict(preds): function plot_histogram (line 34) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ... function main (line 44) | def main(): FILE: PFPO/scripts/math/deepseek_math_sample_steps.py function sample_step (line 10) | def sample_step(response: str, upper_step_ratio: float, sample_ratio: fl... function get_pred_set (line 37) | def get_pred_set(preds): function main (line 50) | def main(): FILE: PFPO/scripts/math/estimate_state_value.py function main (line 25) | def main(): FILE: PFPO/scripts/math/merge_dp_multi_solution.py function main (line 14) | def main(): FILE: PFPO/scripts/math/merge_dp_predictions.py function pred2str (line 15) | def pred2str(pred): function main (line 25) | def main(): FILE: PFPO/scripts/math/merge_incomplete_predictions.py function pred2str (line 15) | def pred2str(pred): function load_data (line 25) | def load_data(file_path): function main (line 37) | def main(): FILE: PFPO/scripts/math/merge_rm_dp_multi_solution.py function main (line 7) | def main(): FILE: PFPO/scripts/math/rerank_w_orm.py function load_rewards (line 18) | def load_rewards(reward_file): function _init (line 30) | def _init(id2reward): function _worker (line 35) | def _worker(item, sc_top_k=None): function main (line 84) | def main(): FILE: PFPO/scripts/math/rerank_w_prm.py function load_rewards (line 17) | def load_rewards(reward_file, re_index): function reward_reduction (line 33) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =... function weighted_majority_voting_predict (line 53) | def weighted_majority_voting_predict(preds, weights): function _init (line 62) | def _init(id2reward): function _worker (line 67) | def _worker(item, reduction, norm, sc_top_k=None): function main (line 148) | def main(): FILE: PFPO/scripts/math/rerank_w_prm_combine.py function load_rewards (line 10) | def load_rewards(reward_file): function reward_reduction (line 22) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =... function merge_rewards (line 42) | def merge_rewards(group_logits, weights, reduction: str = "min", norm: b... function main (line 102) | def main(): FILE: PFPO/scripts/math_scale/analyze/compute_acc_by_id.py function majority_voting_frequency (line 18) | def majority_voting_frequency(preds): function merge_key (line 36) | def merge_key(item, value): function merge_seed_sampled_data (line 45) | def merge_seed_sampled_data(data): function main (line 69) | def main(): FILE: PFPO/scripts/math_scale/analyze/draw_sc.py function draw_line_plot (line 9) | def draw_line_plot(data, file_path, baseline, baseline_label): function main (line 40) | def main(): FILE: PFPO/scripts/math_scale/analyze/extract_hard_questions.py function majority_voting_frequency (line 18) | def majority_voting_frequency(preds): function merge_key (line 36) | def merge_key(item, value): function merge_seed_sampled_data (line 45) | def merge_seed_sampled_data(data): function main (line 69) | def main(): FILE: PFPO/scripts/math_scale/analyze/freq2image.py function plot_bar_chart (line 8) | def plot_bar_chart(data, file_path): function draw_line_plot (line 41) | def draw_line_plot(data, file_path): function main (line 63) | def main(): FILE: PFPO/scripts/math_scale/analyze/get_output_frequency.py function majority_voting_frequency (line 17) | def majority_voting_frequency(preds): function worker (line 35) | def worker(item, n: int): function merge_key (line 46) | def merge_key(item, value): function merge_seed_sampled_data (line 55) | def merge_seed_sampled_data(data): function main (line 79) | def main(): FILE: PFPO/scripts/math_scale/concat_data.py function main (line 9) | def main(): FILE: PFPO/scripts/math_scale/construct_prefer_pair.py function merge_key (line 13) | def merge_key(item, value): function merge_seed_sampled_data (line 22) | def merge_seed_sampled_data(data): function main (line 46) | def main(): FILE: PFPO/scripts/math_scale/construct_prefer_pair_sc.py function evaluate_by_sc (line 14) | def evaluate_by_sc(item, external_sc: str = None): function majority_voting_frequency (line 34) | def majority_voting_frequency(preds): function get_pred_frequency (line 52) | def get_pred_frequency(preds, target_pred): function merge_key (line 68) | def merge_key(item, value): function merge_seed_sampled_data (line 77) | def merge_seed_sampled_data(data): function load_data (line 101) | def load_data(file_path): function main (line 125) | def main(): FILE: PFPO/scripts/math_scale/construct_process_rm_sample_gd.py function counting_partial_response_value (line 16) | def counting_partial_response_value(preds, label): function parse_value (line 26) | def parse_value(v, binary: bool): function _process_response_worker (line 32) | def _process_response_worker(item): function _process_trajectories_worker (line 52) | def _process_trajectories_worker(item, binary: bool): function merge_key (line 74) | def merge_key(item, value): function merge_seed_sampled_data (line 83) | def merge_seed_sampled_data(data, id_field="id"): function main (line 107) | def main(): FILE: PFPO/scripts/math_scale/construct_process_rm_sample_sc.py function majority_voting_frequency (line 16) | def majority_voting_frequency(preds): function extract_sc_mul_labels (line 34) | def extract_sc_mul_labels(response_data, id_field: str): function counting_partial_response_value (line 54) | def counting_partial_response_value(preds, label): function parse_value (line 64) | def parse_value(v, binary: bool): function _process_response_init (line 70) | def _process_response_init(id2sc_preds): function _process_response_worker (line 75) | def _process_response_worker(item, top_p: float = 0.0): function _process_trajectories_worker (line 97) | def _process_trajectories_worker(item, binary: bool): function merge_key (line 119) | def merge_key(item, value): function merge_seed_sampled_data (line 128) | def merge_seed_sampled_data(data, id_field="id"): function main (line 152) | def main(): FILE: PFPO/scripts/math_scale/exclude_unused_data.py function main (line 6) | def main(): FILE: PFPO/scripts/math_scale/extract_content_from_orig_format.py function main (line 6) | def main(): FILE: PFPO/scripts/math_scale/extract_mathscale_v2_box_answer.py function main (line 12) | def main(): FILE: PFPO/scripts/math_scale/extract_numina_math_box_answer.py function main (line 12) | def main(): FILE: PFPO/scripts/math_scale/fix_answer_extract_and_verify.py function main (line 19) | def main(): FILE: PFPO/scripts/math_scale/fix_answer_extract_and_verify_v2.py function main (line 19) | def main(): FILE: PFPO/scripts/math_scale/math_scale_offline_gpt_eval.py function majority_voting_predict (line 14) | def majority_voting_predict(preds): function main (line 38) | def main(): FILE: PFPO/scripts/math_scale/merge_dp_seed_predictions.py function majority_voting_frequency (line 18) | def majority_voting_frequency(preds): function merge_key (line 36) | def merge_key(item, value): function merge_seed_sampled_data (line 45) | def merge_seed_sampled_data(data): function main (line 69) | def main(): FILE: PFPO/scripts/math_scale/pp_gpt_inputs.py function main (line 6) | def main(): FILE: PFPO/scripts/math_scale/process_4o.py function remove_suffix (line 8) | def remove_suffix(solution: str): function main (line 12) | def main(): FILE: PFPO/scripts/math_scale/process_raw_4o.py function extract_qa (line 8) | def extract_qa(completion: str, remove_suffix: bool = False): function remove_suffix (line 26) | def remove_suffix(solution: str): function main (line 30) | def main(): FILE: PFPO/scripts/math_scale/process_raw_4o_labeling.py function main (line 9) | def main(): FILE: PFPO/scripts/math_scale/qwen25math_style_eval.py function extract_content_from_tag (line 20) | def extract_content_from_tag(pred: str): function majority_voting_predict (line 30) | def majority_voting_predict(preds): function _annotate (line 58) | def _annotate(param): function preprocess_item (line 62) | def preprocess_item(item, args): function main (line 110) | def main(): FILE: PFPO/scripts/math_scale/qwen25math_style_eval_math.py function extract_content_from_tag (line 18) | def extract_content_from_tag(pred: str): function majority_voting_predict (line 28) | def majority_voting_predict(preds): function _annotate (line 52) | def _annotate(param): function main (line 56) | def main(): FILE: PFPO/scripts/math_scale/qwen25math_style_eval_v2.0.py function extract_content_from_tag (line 20) | def extract_content_from_tag(pred: str): function majority_voting_predict (line 30) | def majority_voting_predict(preds): function _annotate (line 58) | def _annotate(param): function preprocess_item (line 62) | def preprocess_item(item, args): function main (line 110) | def main(): FILE: PFPO/scripts/math_scale/qwen25math_style_preprocess_pred_label.py function extract_content_from_tag (line 20) | def extract_content_from_tag(pred: str): function majority_voting_predict (line 30) | def majority_voting_predict(preds): function _annotate (line 58) | def _annotate(param): function preprocess_item (line 62) | def preprocess_item(item, args): function main (line 110) | def main(): FILE: PFPO/scripts/math_scale/rerank_w_prm_math.py function load_rewards (line 17) | def load_rewards(reward_file, re_index): function softmax (line 33) | def softmax(x): function reward_reduction (line 38) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =... function weighted_majority_voting_predict (line 59) | def weighted_majority_voting_predict(preds, weights): function _init (line 68) | def _init(id2reward): function _worker (line 73) | def _worker(item, reduction, norm, sc_top_k=None): function merge_key (line 155) | def merge_key(item, value): function merge_seed_sampled_data (line 164) | def merge_seed_sampled_data(data): function main (line 188) | def main(): FILE: PFPO/scripts/math_scale/rerank_w_prm_math_scale_save.py function load_rewards (line 21) | def load_rewards(reward_file, re_index): function softmax (line 42) | def softmax(x): function reward_reduction (line 47) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =... function weighted_majority_voting_predict (line 68) | def weighted_majority_voting_predict(preds, weights): function _init (line 77) | def _init(id2reward): function _worker (line 82) | def _worker(item, reduction, norm, sc_type: str, include_incorrect: bool... function main (line 156) | def main(): FILE: PFPO/scripts/math_scale/rerank_w_prm_math_scale_save_pair.py function load_rewards (line 21) | def load_rewards(reward_file, re_index): function softmax (line 42) | def softmax(x): function reward_reduction (line 47) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =... function weighted_majority_voting_predict (line 68) | def weighted_majority_voting_predict(preds, weights): function _init (line 77) | def _init(id2reward): function _worker (line 82) | def _worker(item, reduction, norm, sc_type: str, include_incorrect: bool... function main (line 166) | def main(): FILE: PFPO/scripts/math_scale/rerank_w_prm_math_scale_save_pair_margin.py function load_rewards (line 21) | def load_rewards(reward_file, re_index): function softmax (line 42) | def softmax(x): function reward_reduction (line 47) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =... function weighted_majority_voting_predict (line 66) | def weighted_majority_voting_predict(preds, weights): function _init (line 75) | def _init(id2reward): function _worker (line 80) | def _worker(item, reduction, norm, sc_type: str, include_incorrect: bool... function main (line 171) | def main(): FILE: PFPO/scripts/math_scale/split_data.py function main (line 5) | def main(): FILE: PFPO/scripts/mbpp/eval_human_eval_gpt_outputs.py function main (line 15) | def main(): FILE: PFPO/scripts/mbpp/eval_mbpp_gpt_outputs.py function main (line 15) | def main(): FILE: PFPO/scripts/mbpp/pp_eval_gpt4_human_eval.py function main (line 13) | def main(): FILE: PFPO/scripts/mbpp/pp_eval_gpt4_mbpp.py function main (line 13) | def main(): FILE: PFPO/scripts/mbpp/prepare_mbpp_test_cases_inputs_v1.0.py function main (line 40) | def main(): FILE: PFPO/scripts/mbpp/process_mbpp_test_cases_inputs.py function extract_test_case_inputs (line 12) | def extract_test_case_inputs(text): function main (line 23) | def main(): FILE: PFPO/scripts/mbpp/run_test_case_v1.0.py function set_memory_limit (line 20) | def set_memory_limit(memory_limit_mb): function unsafe_execute (line 25) | def unsafe_execute(check_program, result, timeout): function capture_print_output (line 84) | def capture_print_output(code, timeout=2): function test_single_case (line 104) | def test_single_case(program, test_case): function _worker (line 113) | def _worker(_input): function main (line 119) | def main(): FILE: PFPO/scripts/model_converts/llama_hf_mp_split.py function permute (line 14) | def permute(w, n_heads, dim1, dim2): function split_weights (line 21) | def split_weights(state_dict: OrderedDict, tp_size: int): function merge_weights (line 44) | def merge_weights(state_dicts: list, merge_avg: bool = False): function write_model (line 68) | def write_model(input_base_path, tp_size: int): function merge_model (line 96) | def merge_model(input_base_path, tp_size: int, merge_avg: bool = False): function main (line 140) | def main(): FILE: PFPO/scripts/model_converts/pad_model_embedding.py function main (line 13) | def main(): FILE: PFPO/scripts/prepare_code_contests_decompose.py function main (line 44) | def main(): FILE: PFPO/scripts/prepare_code_contests_decompose_verification.py function completion_parsing (line 47) | def completion_parsing(completion: str): function main (line 61) | def main(): FILE: PFPO/scripts/prepare_code_contests_decompose_verification_v2.0.py function completion_parsing (line 47) | def completion_parsing(completion: str): function main (line 61) | def main(): FILE: PFPO/scripts/prepare_code_contests_judgement.py function main (line 28) | def main(): FILE: PFPO/scripts/prepare_mbpp_desc2code_inputs_v1.0.py function load_descriptions (line 81) | def load_descriptions(desc_file): function main (line 99) | def main(): FILE: PFPO/scripts/prepare_mbpp_inputs_v1.0.py function main (line 50) | def main(): FILE: PFPO/scripts/prepare_mbpp_intermediate_print_v1.0.py function main (line 69) | def main(): FILE: PFPO/scripts/prepare_mbpp_predict_judgement.py function main (line 20) | def main(): FILE: PFPO/scripts/prepare_mbpp_test_cases_inputs_v1.0.py function main (line 74) | def main(): FILE: PFPO/scripts/prepare_mbpp_test_cases_outputs_v1.0.py function extract_test_case_inputs (line 81) | def extract_test_case_inputs(item): function main (line 91) | def main(): FILE: PFPO/scripts/prepare_mbpp_test_cases_outputs_v1.1.py function extract_test_case_inputs (line 78) | def extract_test_case_inputs(item): function main (line 88) | def main(): FILE: PFPO/scripts/verify_mbpp_test_cases.py function capture_print_output (line 9) | def capture_print_output(code): function _extract_test_case (line 35) | def _extract_test_case(item): function extract_test_cases (line 57) | def extract_test_cases(file_path): function _extract_function_names (line 74) | def _extract_function_names(code): function clean_orig_test_cases_and_extract_func_name (line 84) | def clean_orig_test_cases_and_extract_func_name(program): function filter_passed_programs (line 109) | def filter_passed_programs(prediction_file): function verify_program (line 128) | def verify_program(program, test_cases): function main (line 144) | def main(): FILE: PFPO/service_api_caller_v1.py function default_collate_fn (line 38) | def default_collate_fn(batch): function run_inference (line 42) | def run_inference(cfg: DictConfig, dataset): function main (line 82) | def main(cfg: DictConfig): FILE: PFPO/trainer_base_ds_mul_fs_tp.py function get_zero_stage (line 56) | def get_zero_stage(cfg: DictConfig): function worker_init_fn (line 62) | def worker_init_fn(worker_id): function save_model (line 68) | def save_model(model: Union[deepspeed.DeepSpeedEngine, deepspeed.Pipelin... function forward_step (line 114) | def forward_step(model, inputs: Dict[str, torch.Tensor]): function train (line 126) | def train(cfg, model, tokenizer, continue_from_global_step=0): function main (line 334) | def main(cfg: DictConfig): FILE: PFPO/trainer_ds_megatron_mul.py function get_zero_stage (line 55) | def get_zero_stage(cfg: DictConfig): function worker_init_fn (line 61) | def worker_init_fn(worker_id): function save_model (line 67) | def save_model(model: Union[deepspeed.DeepSpeedEngine, deepspeed.Pipelin... function forward_step (line 113) | def forward_step(model, inputs: Dict[str, torch.Tensor]): function train (line 125) | def train(cfg, model, tokenizer, continue_from_global_step=0): function main (line 315) | def main(cfg: DictConfig): FILE: PFPO/visualize/length_distribution.py function plot_histogram (line 15) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ... function main (line 25) | def main(): FILE: PFPO/visualize/reward_histogram.py function plot_histogram (line 9) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ... function main (line 19) | def main(): FILE: PFPO/visualize/test_response_length.py function _init_ (line 13) | def _init_(tokenizer): function plot_histogram (line 18) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ... function merge_key (line 30) | def merge_key(item, value): function merge_seed_sampled_data (line 39) | def merge_seed_sampled_data(data, key_field="response"): function worker (line 56) | def worker(item): function main (line 65) | def main(): FILE: PFPO/vllm_inference.py function evaluate (line 44) | def evaluate(cfg: DictConfig, model: vllm.LLM, prefix="", _split="dev"): function main (line 132) | def main(cfg: DictConfig): FILE: PFPO/vllm_inference_dp.py function evaluate (line 45) | def evaluate(cfg: DictConfig, model: vllm.LLM, prefix="", _split="dev"): function main_worker (line 132) | def main_worker(cfg: DictConfig): function main_worker_wrap (line 194) | def main_worker_wrap(_input): function main (line 205) | def main(cfg: DictConfig): FILE: ReSA/llm/arch/context_manager.py function block_attn_decoding_kernel (line 15) | def block_attn_decoding_kernel( function block_attn_decoding (line 47) | def block_attn_decoding(q, k_min, k_max, num_blocks, local_block_num): function get_topk_indices (line 64) | def get_topk_indices(block_attn_score, block_index_mask, max_num_selecte... function get_num_blocks (line 71) | def get_num_blocks(cache_seqlens, block_size, sparse_ratio, min_block_num): class KVManager (line 77) | class KVManager: method __init__ (line 78) | def __init__(self, num_heads, block_size, sparse_ratio, local_block_nu... method init_centeroids (line 89) | def init_centeroids(self, key, cache_seqlens): method update_centeroids (line 109) | def update_centeroids(self, key, cache_seqlens): method clear_centeroids (line 115) | def clear_centeroids(self): method get_kv_cache_indices (line 120) | def get_kv_cache_indices(self, query, cache_seqlens): method get_kv_cache_indices_fast (line 139) | def get_kv_cache_indices_fast(self, query, cache_seqlens): FILE: ReSA/llm/arch/model.py class ModelArgs (line 21) | class ModelArgs: class RMSNorm (line 46) | class RMSNorm(nn.Module): method __init__ (line 47) | def __init__(self, dim: int, eps: float = 1e-5): method forward (line 52) | def forward(self, x): function precompute_freqs_cis (line 56) | def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0): class Attention (line 62) | class Attention(nn.Module): method __init__ (line 63) | def __init__(self, index: int, args: ModelArgs): method forward (line 75) | def forward( class FeedForwardNetwork (line 122) | class FeedForwardNetwork(nn.Module): method __init__ (line 123) | def __init__( method forward (line 134) | def forward(self, x): class Block (line 138) | class Block(nn.Module): method __init__ (line 140) | def __init__(self, index: int, args: ModelArgs): method forward (line 148) | def forward( class Model (line 161) | class Model(nn.Module): method __init__ (line 162) | def __init__(self, args: ModelArgs): method _precompute_freqs_cis (line 179) | def _precompute_freqs_cis(self, max_seqlen): method forward (line 184) | def forward( function create_kv_cache (line 213) | def create_kv_cache(args: ModelArgs, batch_size: int, dtype: torch.dtype... FILE: ReSA/llm/config.py function parse_eval_args (line 3) | def parse_eval_args(): FILE: ReSA/llm/data/tokenizer.py class Tokenizer (line 7) | class Tokenizer: method __init__ (line 8) | def __init__(self, tokenizer_path: str): method n_words (line 12) | def n_words(self) -> int: method bos_id (line 16) | def bos_id(self) -> int: method eos_id (line 20) | def eos_id(self) -> int: method pad_id (line 24) | def pad_id(self) -> int: method unk_id (line 28) | def unk_id(self) -> int: method encode (line 31) | def encode(self, s: str, bos: bool = True, eos: bool = False): method encode_batch (line 39) | def encode_batch(self, s: List[str], bos: bool = True, eos: bool = Fal... method decode (line 42) | def decode(self, t: List[int]) -> str: method decode_batch (line 46) | def decode_batch(self, t: List[List[int]]) -> List[str]: FILE: ReSA/llm/eval.py function sample_top_p (line 21) | def sample_top_p(probs, p): class EvalWrapper (line 31) | class EvalWrapper(eval_wrapper): method __init__ (line 32) | def __init__( method eot_token_id (line 49) | def eot_token_id(self): method eos_token_id (line 53) | def eos_token_id(self): method pad_token_id (line 57) | def pad_token_id(self): method max_length (line 61) | def max_length(self): method max_gen_toks (line 65) | def max_gen_toks(self): method batch_size (line 69) | def batch_size(self): method device (line 73) | def device(self): method model (line 77) | def model(self): method tok_encode (line 80) | def tok_encode(self, string: str, **kwargs): method tok_decode (line 84) | def tok_decode(self, tokens, **kwargs): method tok_batch_encode (line 90) | def tok_batch_encode(self, strings, left_truncate_len=None, **kwargs): method _model_call (line 99) | def _model_call(self, inps): method _model_generate (line 103) | def _model_generate(self, context, max_length, kv_cache=None, **genera... function _adjust_config (line 162) | def _adjust_config(task_dict): function eval_end_task (line 181) | def eval_end_task( function eval_downstream_task (line 208) | def eval_downstream_task( function load_qwen2_model (line 235) | def load_qwen2_model(state_dict): function load_model (line 246) | def load_model(args): function evaluate_one_checkpoint (line 293) | def evaluate_one_checkpoint(args): FILE: ReSA/llm/eval_math.py class MathArgs (line 13) | class MathArgs: function get_rank (line 21) | def get_rank(): function first_print (line 25) | def first_print(*args): function load_data (line 30) | def load_data(data_name, split, data_dir): function prepare_data (line 44) | def prepare_data(data_name, args, limit): function model_generation (line 60) | def model_generation(model, prompts, max_length, math_args): function evaluate (line 83) | def evaluate(args, model, limit): function eval_math_save_part (line 126) | def eval_math_save_part(model, data_name, examples, math_args, max_length): FILE: ReSA/llm/kernel/flash_attention_with_kv_cache.py function is_hip (line 7) | def is_hip(): function num_splits_heuristic (line 11) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo... function _fwd_kernel_with_kv_cache (line 72) | def _fwd_kernel_with_kv_cache( function combine (line 174) | def combine( function flash_attention_with_kv_cache (line 205) | def flash_attention_with_kv_cache( function ref_program_fa (line 281) | def ref_program_fa(query, key, value, cache_seqlens): function debug (line 290) | def debug(name,expect, actual, atol=1e-3, rtol=1e-3): FILE: ReSA/llm/kernel/flash_sparse_decoding.py function is_hip (line 7) | def is_hip(): function num_splits_heuristic (line 11) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo... function _fwd_kernel_decoding (line 72) | def _fwd_kernel_decoding( function combine (line 164) | def combine( function flash_block_sparse_decoding (line 190) | def flash_block_sparse_decoding( function main (line 267) | def main(): FILE: ReSA/llm/kernel/rotary.py function rotate_half (line 14) | def rotate_half(x, interleaved=False): function apply_rotary_emb_torch (line 23) | def apply_rotary_emb_torch(x, cos, sin, interleaved=False, inplace=False): function rotary_kernel (line 38) | def rotary_kernel( function apply_rotary (line 159) | def apply_rotary( class ApplyRotaryEmb (line 255) | class ApplyRotaryEmb(torch.autograd.Function): method forward (line 257) | def forward( method backward (line 290) | def backward(ctx, do): function apply_rotary_emb_triton (line 314) | def apply_rotary_emb_triton( FILE: ReSA/llm/kernel/tilelang_attention_with_kv_cache.py function num_splits_heuristic (line 13) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo... function flashattn (line 66) | def flashattn(heads, heads_kv, dim, dim_v): class AttentionWithKVCache (line 240) | class AttentionWithKVCache(torch.nn.Module): method __init__ (line 241) | def __init__(self, heads, heads_kv, dim, dim_v, seqlen_q): method forward (line 273) | def forward(self, query, key, value, cache_seqlens): function ref_program_fa (line 303) | def ref_program_fa(query, key, value, cache_seqlens): function debug (line 312) | def debug(name,expect, actual, atol=1e-3, rtol=1e-3): FILE: ReSA/llm/kernel/tilelang_sparse_decoding.py function num_splits_heuristic (line 14) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo... function flashattn (line 67) | def flashattn(heads, heads_kv, dim, dim_v): class SparseFlashAttn (line 245) | class SparseFlashAttn(torch.nn.Module): method __init__ (line 246) | def __init__(self, heads, heads_kv, dim, dim_v, block_size): method forward (line 277) | def forward(self, query, key, value, block_indices, cache_seqlens): function sparse_gqa_decode_varlen_indice (line 320) | def sparse_gqa_decode_varlen_indice(query, key, value, block_indices, ca... function ref_program_torch (line 369) | def ref_program_torch(query, key, value, block_indices, cache_seqlens, ... function ref_program_fa (line 412) | def ref_program_fa(query, key, value, block_indices, cache_seqlens, max... function debug (line 423) | def debug(name,expect, actual, atol=1e-3, rtol=1e-3): FILE: ReSA/llm/utils/math_utils.py function get_examples (line 38) | def get_examples(): function is_multi_choice (line 415) | def is_multi_choice(answer): function load_jsonl (line 422) | def load_jsonl(file: Union[str, Path]) -> Iterable[Any]: function save_jsonl (line 432) | def save_jsonl(samples, save_path): function load_prompt (line 446) | def load_prompt(data_name, prompt_type, num_shots): function construct_prompt (line 486) | def construct_prompt(example, data_name, args): function _fix_fracs (line 536) | def _fix_fracs(string): function _fix_a_slash_b (line 568) | def _fix_a_slash_b(string): function _fix_sqrt (line 585) | def _fix_sqrt(string): function convert_word_number (line 590) | def convert_word_number(text: str) -> str: function strip_string (line 737) | def strip_string(string, skip_unit=False): function extract_multi_choice_answer (line 878) | def extract_multi_choice_answer(pred_str): function choice_answer_clean (line 892) | def choice_answer_clean(pred: str): function find_box (line 936) | def find_box(pred_str: str): function clean_units (line 959) | def clean_units(pred_str: str): function extract_theoremqa_answer (line 984) | def extract_theoremqa_answer(pred: str, answer_flag: bool = True): function extract_answer (line 1024) | def extract_answer(pred_str, data_name, use_last_number=True): function parse_ground_truth (line 1100) | def parse_ground_truth(example: Dict[str, Any], data_name): function parse_question (line 1179) | def parse_question(example, data_name): function run_execute (line 1247) | def run_execute(executor, result, prompt_type, data_name, execute=False): function text_to_trajectory (line 1286) | def text_to_trajectory(traj_str: str) -> None: function trajectory_to_text (line 1324) | def trajectory_to_text(trajectory: list) -> str: function is_execution_success (line 1336) | def is_execution_success(output): function extract_program (line 1342) | def extract_program(text:str=None, trajectory:list=None, last_only=False... function extract_program_output (line 1382) | def extract_program_output(pred_str, last_only=True): function choice_answer_clean (line 1403) | def choice_answer_clean(pred: str): function parse_digits (line 1417) | def parse_digits(num): function is_digit (line 1433) | def is_digit(num): function str_to_pmatrix (line 1438) | def str_to_pmatrix(input_str): function math_equal (line 1450) | def math_equal( function math_equal_process (line 1639) | def math_equal_process(param): function numeric_equal (line 1643) | def numeric_equal(prediction: float, reference: float): function symbolic_equal (line 1653) | def symbolic_equal(a, b): function symbolic_equal_process (line 1709) | def symbolic_equal_process(a, b, output_queue): function call_with_timeout (line 1714) | def call_with_timeout(func, *args, timeout=1, **kwargs): function evaluate (line 1739) | def evaluate(data_name, prompt_type, samples: list=None, file_path: str=... class GenericRuntime (line 1831) | class GenericRuntime: method __init__ (line 1835) | def __init__(self): method exec_code (line 1842) | def exec_code(self, code_piece: str) -> None: method eval_code (line 1859) | def eval_code(self, expr: str) -> Any: method inject (line 1862) | def inject(self, var_dict: Dict[str, Any]) -> None: method answer (line 1867) | def answer(self): class DateRuntime (line 1870) | class DateRuntime(GenericRuntime): class CustomDict (line 1878) | class CustomDict(dict): method __iter__ (line 1879) | def __iter__(self): class ColorObjectRuntime (line 1882) | class ColorObjectRuntime(GenericRuntime): class PythonExecutor (line 1886) | class PythonExecutor: method __init__ (line 1887) | def __init__( method process_generation_to_code (line 1902) | def process_generation_to_code(self, gens: str): method execute (line 1906) | def execute( method apply (line 1951) | def apply(self, code): method truncate (line 1955) | def truncate(s, max_length=400): method batch_apply (line 1961) | def batch_apply(self, batch_code):