SYMBOL INDEX (248 symbols across 26 files) FILE: build_soft_labels/gen_soft_label.py function parse_args (line 9) | def parse_args(): function calculate_srcc_plcc (line 30) | def calculate_srcc_plcc(pred, mos): function get_level (line 36) | def get_level(mos, min_mos, max_mos): function adjust_gaussian_bar (line 49) | def adjust_gaussian_bar(probs, score): function get_binary_probs (line 64) | def get_binary_probs(mos, min_mos=1.0, max_mos=5.0): function main (line 80) | def main(cfg): FILE: src/conversation.py class SeparatorStyle (line 6) | class SeparatorStyle(Enum): class Conversation (line 17) | class Conversation: method get_prompt (line 30) | def get_prompt(self): method append_message (line 119) | def append_message(self, role, message): method get_images (line 122) | def get_images(self, return_pil=False): method to_gradio_chatbot (line 172) | def to_gradio_chatbot(self): method copy (line 203) | def copy(self): method dict (line 214) | def dict(self): FILE: src/datasets/__init__.py function make_data_module (line 5) | def make_data_module(tokenizer, data_args): FILE: src/datasets/pair_dataset.py class PairDataset (line 19) | class PairDataset(Dataset): method __init__ (line 22) | def __init__( method __len__ (line 49) | def __len__(self): method lengths (line 53) | def lengths(self): method modality_lengths (line 65) | def modality_lengths(self): method next_rand (line 76) | def next_rand(self): method __getitem__ (line 79) | def __getitem__(self, i): method get_one_item (line 112) | def get_one_item(self, idx_dataset, idx_sample) -> Dict[str, torch.Ten... class DataCollatorForPairDataset (line 214) | class DataCollatorForPairDataset(object): method __call__ (line 219) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: method collate_one (line 229) | def collate_one(self, instances: Sequence[Dict]) -> Dict[str, torch.Te... function make_pair_data_module (line 263) | def make_pair_data_module( FILE: src/datasets/single_dataset.py class SingleDataset (line 18) | class SingleDataset(Dataset): method __init__ (line 21) | def __init__( method __len__ (line 39) | def __len__(self): method lengths (line 43) | def lengths(self): method modality_lengths (line 54) | def modality_lengths(self): method next_rand (line 64) | def next_rand(self): method __getitem__ (line 69) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class DataCollatorForSupervisedDataset (line 194) | class DataCollatorForSupervisedDataset(object): method __call__ (line 199) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: function make_single_data_module (line 231) | def make_single_data_module( FILE: src/datasets/utils.py function rank0_print (line 22) | def rank0_print(*args): class DataArguments (line 31) | class DataArguments: function _tokenize_fn (line 40) | def _tokenize_fn( function _mask_targets (line 67) | def _mask_targets(target, tokenized_lens, speakers): function _add_speaker_and_signal (line 78) | def _add_speaker_and_signal(header, source, get_conversation=True): function preprocess_multimodal (line 100) | def preprocess_multimodal(sources: Sequence[str], data_args: DataArgumen... function preprocess_v1 (line 122) | def preprocess_v1( function preprocess_plain (line 210) | def preprocess_plain( function preprocess (line 239) | def preprocess( function load_video (line 292) | def load_video(video_file): function expand2square (line 306) | def expand2square(pil_img, background_color): FILE: src/evaluate/cal_distribution_gap.py function parse_args (line 7) | def parse_args(): function kl_divergence (line 17) | def kl_divergence(mu_1, mu_2, sigma_1, sigma_2): function js_divergence (line 34) | def js_divergence(mu_1, mu_2, sigma_1, sigma_2): function wasserstein_distance (line 55) | def wasserstein_distance(mu_1, mu_2, sigma_1, sigma_2): function cal_score (line 71) | def cal_score(level_names, logits=None, probs=None, use_openset_probs=Fa... function cal_std (line 83) | def cal_std(score, probs): FILE: src/evaluate/cal_plcc_srcc.py function parse_args (line 9) | def parse_args(): function calculate_srcc (line 19) | def calculate_srcc(pred, mos): function calculate_plcc (line 24) | def calculate_plcc(pred, mos): function fit_curve (line 29) | def fit_curve(x, y, curve_type="logistic_4params"): function cal_score (line 65) | def cal_score(level_names, logits=None, probs=None, use_openset_probs=Fa... FILE: src/evaluate/eval_qbench_mcq.py function disable_torch_init (line 21) | def disable_torch_init(): function load_image (line 30) | def load_image(image_file): function main (line 39) | def main(args): FILE: src/evaluate/iqa_eval.py function disable_torch_init (line 18) | def disable_torch_init(): function load_image (line 28) | def load_image(image_file): function main (line 37) | def main(args): FILE: src/evaluate/scorer.py class Scorer (line 14) | class Scorer(nn.Module): method __init__ (line 15) | def __init__(self, pretrained="zhiyuanyou/DeQA-Score-Mix3", device="cu... method expand2square (line 28) | def expand2square(self, pil_img, background_color): method forward (line 41) | def forward(self, image: List[Image.Image]): FILE: src/mm_utils.py function load_image_from_base64 (line 11) | def load_image_from_base64(image): function expand2square (line 15) | def expand2square(pil_img, background_color): function process_images (line 29) | def process_images(images, image_processor, model_cfg=None): function tokenizer_image_token (line 53) | def tokenizer_image_token(prompt, tokenizer, image_token_index=IMAGE_TOK... function get_model_name_from_path (line 75) | def get_model_name_from_path(model_path): class KeywordsStoppingCriteria (line 86) | class KeywordsStoppingCriteria(StoppingCriteria): method __init__ (line 87) | def __init__(self, keywords, tokenizer, input_ids): method __call__ (line 101) | def __call__(self, output_ids: torch.LongTensor, scores: torch.FloatTe... FILE: src/model/builder.py function load_pretrained_model (line 31) | def load_pretrained_model( FILE: src/model/configuration_mplug_owl2.py class LlamaConfig (line 15) | class LlamaConfig(PretrainedConfig): method __init__ (line 99) | def __init__( method _rope_scaling_validation (line 154) | def _rope_scaling_validation(self): class MplugOwlVisionConfig (line 176) | class MplugOwlVisionConfig(PretrainedConfig): method __init__ (line 218) | def __init__( method from_pretrained (line 253) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... class MplugOwlVisualAbstractorConfig (line 269) | class MplugOwlVisualAbstractorConfig(PretrainedConfig): method __init__ (line 272) | def __init__( method from_pretrained (line 299) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... class MPLUGOwl2Config (line 321) | class MPLUGOwl2Config(LlamaConfig): method __init__ (line 323) | def __init__(self, visual_config=None, **kwargs): FILE: src/model/convert_mplug_owl2_weight_to_hf.py function compute_intermediate_size (line 65) | def compute_intermediate_size(n): function read_json (line 69) | def read_json(path): function write_json (line 74) | def write_json(text, path): function write_model (line 79) | def write_model(model_path, function write_tokenizer (line 346) | def write_tokenizer(tokenizer_path, input_tokenizer_path): function main (line 354) | def main(): FILE: src/model/modeling_attn_mask_utils.py class AttentionMaskConverter (line 19) | class AttentionMaskConverter: method __init__ (line 35) | def __init__(self, is_causal: bool, sliding_window: Optional[int] = No... method to_causal_4d (line 44) | def to_causal_4d( method to_4d (line 77) | def to_4d( method _make_causal_mask (line 120) | def _make_causal_mask( method _expand_mask (line 150) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Opti... function _prepare_4d_causal_attention_mask (line 164) | def _prepare_4d_causal_attention_mask( function _prepare_4d_attention_mask (line 204) | def _prepare_4d_attention_mask(mask: torch.Tensor, dtype: torch.dtype, t... function _create_4d_causal_attention_mask (line 220) | def _create_4d_causal_attention_mask( FILE: src/model/modeling_llama2.py function _get_unpad_data (line 22) | def _get_unpad_data(attention_mask): class MultiwayNetwork (line 40) | class MultiwayNetwork(nn.Module): method __init__ (line 42) | def __init__(self, module_provider, num_multiway=2): method forward (line 47) | def forward(self, hidden_states, multiway_indices): class LlamaAttention (line 67) | class LlamaAttention(nn.Module): method __init__ (line 70) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): method _init_rope (line 106) | def _init_rope(self): method _shape (line 133) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 136) | def forward( class LlamaFlashAttention2 (line 210) | class LlamaFlashAttention2(LlamaAttention): method __init__ (line 217) | def __init__(self, *args, **kwargs): method forward (line 225) | def forward( method _flash_attention_forward (line 316) | def _flash_attention_forward( method _upad_input (line 375) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class LlamaSdpaAttention (line 414) | class LlamaSdpaAttention(LlamaAttention): method forward (line 422) | def forward( class LlamaDecoderLayer (line 510) | class LlamaDecoderLayer(nn.Module): method __init__ (line 511) | def __init__(self, config: LlamaConfig, layer_idx): method forward (line 524) | def forward( function model_forward (line 581) | def model_forward( function causal_model_forward (line 726) | def causal_model_forward( function replace_llama_modality_adaptive (line 820) | def replace_llama_modality_adaptive(): FILE: src/model/modeling_mplug_owl2.py class MPLUGOwl2MetaModel (line 45) | class MPLUGOwl2MetaModel: method __init__ (line 46) | def __init__(self, config): method get_vision_tower (line 56) | def get_vision_tower(self): method get_visual_abstractor (line 62) | def get_visual_abstractor(self): class MPLUGOwl2MetaForCausalLM (line 69) | class MPLUGOwl2MetaForCausalLM(ABC): method get_model (line 71) | def get_model(self): method encode_images (line 74) | def encode_images(self, images): method prepare_inputs_labels_for_multimodal (line 83) | def prepare_inputs_labels_for_multimodal( class MPLUGOwl2LlamaModel (line 324) | class MPLUGOwl2LlamaModel(MPLUGOwl2MetaModel, LlamaModel): method __init__ (line 327) | def __init__(self, config: MPLUGOwl2Config): class MPLUGOwl2LlamaForCausalLM (line 331) | class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausal... method __init__ (line 334) | def __init__(self, config): method get_model (line 343) | def get_model(self): method forward (line 346) | def forward(self, input_type=None, **kwargs): method softkl_loss (line 380) | def softkl_loss(self, logits, labels, level_probs): method forward_single (line 406) | def forward_single( method get_score (line 514) | def get_score(self, item): method get_subitem (line 558) | def get_subitem(self, item, task_type): method forward_pair (line 585) | def forward_pair(self, item_A, item_B, **kwargs): method rating_loss (line 669) | def rating_loss( method binary_rating_loss (line 695) | def binary_rating_loss(self, pred_scores_A, gt_scores_A, pred_scores_B... method prepare_inputs_for_generation (line 709) | def prepare_inputs_for_generation( FILE: src/model/utils.py function extend_list (line 5) | def extend_list(data_list, n, min_n): function find_prefix (line 13) | def find_prefix(input_ids, prefix): function auto_upgrade (line 35) | def auto_upgrade(config): FILE: src/model/visual_encoder.py function get_abs_pos (line 14) | def get_abs_pos(abs_pos, tgt_size): function get_2d_sincos_pos_embed (line 33) | def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False): function get_2d_sincos_pos_embed_from_grid (line 51) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 62) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): class MplugOwlVisionEmbeddings (line 84) | class MplugOwlVisionEmbeddings(nn.Module): method __init__ (line 85) | def __init__(self, config): method forward (line 108) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class MplugOwlVisionAttention (line 121) | class MplugOwlVisionAttention(nn.Module): method __init__ (line 124) | def __init__(self, config): method _shape (line 141) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 144) | def forward( class QuickGELU (line 224) | class QuickGELU(nn.Module): method forward (line 225) | def forward(self, x: torch.Tensor): class MplugOwlMLP (line 229) | class MplugOwlMLP(nn.Module): method __init__ (line 230) | def __init__(self, config): method forward (line 237) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MplugOwlVisionEncoderLayer (line 244) | class MplugOwlVisionEncoderLayer(nn.Module): method __init__ (line 245) | def __init__(self, config): method forward (line 253) | def forward( class MplugOwlVisionEncoder (line 292) | class MplugOwlVisionEncoder(nn.Module): method __init__ (line 302) | def __init__(self, config): method forward (line 308) | def forward( class MplugOwlVisionModel (line 384) | class MplugOwlVisionModel(PreTrainedModel): method __init__ (line 388) | def __init__(self, config): method forward (line 400) | def forward( method get_input_embeddings (line 445) | def get_input_embeddings(self): class MplugOwlVisualAbstractorMLP (line 449) | class MplugOwlVisualAbstractorMLP(nn.Module): method __init__ (line 450) | def __init__(self, config): method forward (line 461) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MplugOwlVisualAbstractorMultiHeadAttention (line 468) | class MplugOwlVisualAbstractorMultiHeadAttention(nn.Module): method __init__ (line 469) | def __init__(self, config): method save_attn_gradients (line 507) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 510) | def get_attn_gradients(self): method save_attention_map (line 513) | def save_attention_map(self, attention_map): method get_attention_map (line 516) | def get_attention_map(self): method transpose_for_scores (line 519) | def transpose_for_scores(self, x): method forward (line 524) | def forward( class MplugOwlVisualAbstractorCrossOutput (line 586) | class MplugOwlVisualAbstractorCrossOutput(nn.Module): method __init__ (line 587) | def __init__(self, config): method forward (line 594) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MplugOwlVisualAbstractorAttention (line 600) | class MplugOwlVisualAbstractorAttention(nn.Module): method __init__ (line 601) | def __init__(self, config): method prune_heads (line 609) | def prune_heads(self, heads): method forward (line 627) | def forward( class MplugOwlVisualAbstractorLayer (line 657) | class MplugOwlVisualAbstractorLayer(nn.Module): method __init__ (line 658) | def __init__(self, config, layer_idx): method forward (line 668) | def forward( class MplugOwlVisualAbstractorEncoder (line 693) | class MplugOwlVisualAbstractorEncoder(nn.Module): method __init__ (line 694) | def __init__(self, config): method forward (line 702) | def forward( class MplugOwlVisualAbstractorModel (line 757) | class MplugOwlVisualAbstractorModel(PreTrainedModel): method __init__ (line 759) | def __init__(self, config, language_hidden_size): method _prune_heads (line 770) | def _prune_heads(self, heads_to_prune): method get_extended_attention_mask (line 778) | def get_extended_attention_mask( method forward (line 822) | def forward( FILE: src/train/mplug_owl2_trainer.py function maybe_zero_3 (line 12) | def maybe_zero_3(param, ignore_status=False, name=None): function get_mm_adapter_state_maybe_zero_3 (line 26) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function split_to_even_chunks (line 32) | def split_to_even_chunks(indices, lengths, num_chunks): function get_modality_length_grouped_indices (line 54) | def get_modality_length_grouped_indices(lengths, batch_size, world_size,... function get_length_grouped_indices (line 82) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 93) | class LengthGroupedSampler(Sampler): method __init__ (line 99) | def __init__( method __len__ (line 116) | def __len__(self): method __iter__ (line 119) | def __iter__(self): class MPLUGOwl2Trainer (line 127) | class MPLUGOwl2Trainer(Trainer): method _get_train_sampler (line 129) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method create_optimizer (line 144) | def create_optimizer(self): method _save_checkpoint (line 227) | def _save_checkpoint(self, model, trial, metrics=None): method _save (line 230) | def _save(self, output_dir: Optional[str] = None, state_dict=None): FILE: src/train/train_mem.py function rank0_print (line 38) | def rank0_print(*args): class ModelArguments (line 44) | class ModelArguments: class DataArguments (line 51) | class DataArguments: class TrainingArguments (line 63) | class TrainingArguments(transformers.TrainingArguments): function maybe_zero_3 (line 149) | def maybe_zero_3(param, ignore_status=False, name=None): function get_peft_state_maybe_zero_3 (line 167) | def get_peft_state_maybe_zero_3(named_params, bias): function get_peft_state_non_lora_maybe_zero_3 (line 192) | def get_peft_state_non_lora_maybe_zero_3(named_params, require_grad_only... function get_mm_adapter_state_maybe_zero_3 (line 202) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function find_all_lora_names (line 214) | def find_all_lora_names(model): function safe_save_model_for_hf_trainer (line 228) | def safe_save_model_for_hf_trainer( function smart_tokenizer_and_embedding_resize (line 248) | def smart_tokenizer_and_embedding_resize( function train (line 275) | def train(): FILE: src/utils.py function build_logger (line 17) | def build_logger(logger_name, logger_filename): class StreamToLogger (line 60) | class StreamToLogger(object): method __init__ (line 64) | def __init__(self, logger, log_level=logging.INFO): method __getattr__ (line 70) | def __getattr__(self, attr): method write (line 73) | def write(self, buf): method flush (line 87) | def flush(self): function disable_torch_init (line 93) | def disable_torch_init(): function violates_moderation (line 102) | def violates_moderation(text): function pretty_print_semaphore (line 123) | def pretty_print_semaphore(semaphore): FILE: tests/datasets/test_pair_dataset.py class DataArguments (line 13) | class DataArguments: FILE: tests/model/test_find_prefix.py function find_prefix (line 5) | def find_prefix(input_ids, prefix): FILE: tests/model/test_grad.py class MyModel (line 5) | class MyModel(nn.Module): method __init__ (line 6) | def __init__(self, dim_in, closeset): method forward (line 12) | def forward(self, x_A, x_B, gt): method get_score (line 20) | def get_score(self, logits): method rating_loss (line 34) | def rating_loss(self, pred_scores_A, pred_scores_B, gt):