SYMBOL INDEX (2771 symbols across 274 files) FILE: classification/config.py function _update_config_from_file (line 226) | def _update_config_from_file(config, cfg_file): function update_config (line 240) | def update_config(config, args): function get_config (line 292) | def get_config(args): FILE: classification/dataset/build.py function _pil_interp (line 22) | def _pil_interp(method): class TTA (line 35) | class TTA(torch.nn.Module): method __init__ (line 37) | def __init__(self, size, scales=[1.0, 1.05, 1.1]): method forward (line 42) | def forward(self, img): method __repr__ (line 54) | def __repr__(self) -> str: function build_loader (line 58) | def build_loader(config): function build_loader2 (line 148) | def build_loader2(config): function build_dataset (line 199) | def build_dataset(split, config): function build_transform_for_linear_probe (line 266) | def build_transform_for_linear_probe(is_train, config): function build_transform (line 287) | def build_transform(is_train, config): FILE: classification/dataset/cached_image_folder.py function has_file_allowed_extension (line 32) | def has_file_allowed_extension(filename, extensions): function find_classes (line 44) | def find_classes(dir): function make_dataset (line 53) | def make_dataset(dir, class_to_idx, extensions): function make_dataset_with_ann (line 70) | def make_dataset_with_ann(ann_file, img_prefix, extensions): class DatasetFolder (line 85) | class DatasetFolder(data.Dataset): method __init__ (line 107) | def __init__(self, method init_cache (line 146) | def init_cache(self): method __getitem__ (line 170) | def __getitem__(self, index): method __len__ (line 186) | def __len__(self): method __repr__ (line 189) | def __repr__(self): function pil_loader (line 209) | def pil_loader(path): function accimage_loader (line 224) | def accimage_loader(path): function default_img_loader (line 233) | def default_img_loader(path): class CachedImageFolder (line 241) | class CachedImageFolder(DatasetFolder): method __init__ (line 261) | def __init__(self, method __getitem__ (line 280) | def __getitem__(self, index): class ImageCephDataset (line 299) | class ImageCephDataset(data.Dataset): method __init__ (line 301) | def __init__(self, method __getitem__ (line 324) | def __getitem__(self, index): method __len__ (line 335) | def __len__(self): method filename (line 338) | def filename(self, index, basename=False, absolute=False): method filenames (line 341) | def filenames(self, basename=False, absolute=False): class Parser (line 345) | class Parser: method __init__ (line 347) | def __init__(self): method _filename (line 351) | def _filename(self, index, basename=False, absolute=False): method filename (line 354) | def filename(self, index, basename=False, absolute=False): method filenames (line 357) | def filenames(self, basename=False, absolute=False): class ParserCephImage (line 364) | class ParserCephImage(Parser): method __init__ (line 366) | def __init__(self, method load_onto_memory (line 412) | def load_onto_memory(self): method load_onto_memory_v2 (line 427) | def load_onto_memory_v2(self): method __getitem__ (line 456) | def __getitem__(self, index): method __len__ (line 492) | def __len__(self): method _filename (line 495) | def _filename(self, index, basename=False, absolute=False): function get_temporal_info (line 502) | def get_temporal_info(date, miss_hour=False): function get_spatial_info (line 534) | def get_spatial_info(latitude, longitude): FILE: classification/dataset/imagenet_real.py class RealLabelsImagenet (line 20) | class RealLabelsImagenet: method __init__ (line 22) | def __init__(self, filenames, real_json='real.json', topk=(1, 5)): method add_result (line 33) | def add_result(self, output): method get_accuracy (line 46) | def get_accuracy(self, k=None): FILE: classification/dataset/imagenetv2.py class ImageNetV2Dataset (line 26) | class ImageNetV2Dataset(Dataset): method __init__ (line 27) | def __init__(self, variant='matched-frequency', transform=None, locati... method __len__ (line 52) | def __len__(self): method __getitem__ (line 55) | def __getitem__(self, i): FILE: classification/dataset/samplers.py class SubsetRandomSampler (line 16) | class SubsetRandomSampler(torch.utils.data.Sampler): method __init__ (line 24) | def __init__(self, indices): method __iter__ (line 28) | def __iter__(self): method __len__ (line 31) | def __len__(self): method set_epoch (line 34) | def set_epoch(self, epoch): class NodeDistributedSampler (line 38) | class NodeDistributedSampler(Sampler): method __init__ (line 53) | def __init__(self, method __iter__ (line 85) | def __iter__(self): method __len__ (line 112) | def __len__(self): method set_epoch (line 115) | def set_epoch(self, epoch): FILE: classification/dataset/zipreader.py function is_zip_path (line 17) | def is_zip_path(img_or_path): class ZipReader (line 22) | class ZipReader(object): method __init__ (line 26) | def __init__(self): method get_zipfile (line 30) | def get_zipfile(path): method split_zip_style_path (line 38) | def split_zip_style_path(path): method list_folder (line 48) | def list_folder(path): method list_files (line 66) | def list_files(path, extension=None): method read (line 85) | def read(path): method imread (line 92) | def imread(path): FILE: classification/ddp_hooks.py function _allreduce_fut (line 12) | def _allreduce_fut(process_group: dist.ProcessGroup, function allreduce_hook (line 25) | def allreduce_hook( function fp16_compress_hook (line 43) | def fp16_compress_hook( function bf16_compress_hook (line 77) | def bf16_compress_hook( function fp16_compress_wrapper (line 111) | def fp16_compress_wrapper( function bf16_compress_wrapper (line 147) | def bf16_compress_wrapper( FILE: classification/gflops.py function sa_flops (line 60) | def sa_flops(h, w, dim): function get_flops (line 64) | def get_flops(model, input_shape): FILE: classification/logger.py function create_logger (line 16) | def create_logger(output_dir, dist_rank=0, name=''): FILE: classification/lr_scheduler.py function build_scheduler (line 13) | def build_scheduler(config, optimizer, n_iter_per_epoch): class LinearLRScheduler (line 53) | class LinearLRScheduler(Scheduler): method __init__ (line 55) | def __init__( method _get_lr (line 89) | def _get_lr(self, t): method get_epoch_values (line 101) | def get_epoch_values(self, epoch: int): method get_update_values (line 107) | def get_update_values(self, num_updates: int): FILE: classification/main.py function obsolete_torch_version (line 51) | def obsolete_torch_version(torch_version, version_threshold): function parse_option (line 55) | def parse_option(): function throughput (line 146) | def throughput(data_loader, model, logger): function main (line 167) | def main(config): function train_one_epoch (line 403) | def train_one_epoch(config, function validate_real (line 539) | def validate_real(config, data_loader, model, real_labels, amp_autocast=... function validate (line 605) | def validate(config, data_loader, model, epoch=None, amp_autocast=suppre... FILE: classification/models/build.py function build_model (line 11) | def build_model(config): FILE: classification/models/clip_vit.py function _freeze_params (line 15) | def _freeze_params(module): class CrossAttention (line 20) | class CrossAttention(nn.Module): method __init__ (line 21) | def __init__( method forward (line 52) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 85) | class AttentiveBlock(nn.Module): method __init__ (line 87) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 100) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 109) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 111) | def forward(self, x): class CLIPViT (line 119) | class CLIPViT(nn.Module): method __init__ (line 121) | def __init__(self, patch_size=14, img_size=336, pretrain_size=336, emb... method dtype (line 159) | def dtype(self): method forward_features (line 162) | def forward_features(self, x): method forward (line 168) | def forward(self, x): method lr_decay_keywords (line 181) | def lr_decay_keywords(self, decay_ratio=0.95): FILE: classification/models/flash_attention.py class FlashAttention (line 14) | class FlashAttention(nn.Module): method __init__ (line 25) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 30) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: classification/models/intern_vit_6b.py function _freeze_params (line 23) | def _freeze_params(module): class CrossAttention (line 28) | class CrossAttention(nn.Module): method __init__ (line 29) | def __init__( method forward (line 60) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 93) | class AttentiveBlock(nn.Module): method __init__ (line 95) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 108) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 117) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 119) | def forward(self, x): class RMSNorm (line 127) | class RMSNorm(nn.Module): method __init__ (line 128) | def __init__(self, hidden_size, eps=1e-6): method forward (line 133) | def forward(self, hidden_states): class LayerScale (line 155) | class LayerScale(nn.Module): method __init__ (line 156) | def __init__(self, dim, init_values=1e-5, inplace=False, force_fp32=Fa... method forward (line 163) | def forward(self, x): class Attention (line 173) | class Attention(nn.Module): method __init__ (line 174) | def __init__(self, dim, num_heads=8, qkv_bias=False, attn_drop=0., pro... method _naive_attn (line 196) | def _naive_attn(self, x): method _flash_attn (line 215) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 232) | def forward(self, x): class Mlp (line 237) | class Mlp(nn.Module): method __init__ (line 241) | def __init__(self, in_features, hidden_features=None, out_features=Non... method forward (line 255) | def forward(self, x): class Block (line 264) | class Block(nn.Module): method __init__ (line 266) | def __init__( method forward (line 290) | def forward(self, x): class PatchEmbed (line 303) | class PatchEmbed(nn.Module): method __init__ (line 307) | def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=... method forward (line 321) | def forward(self, x, **kwargs): class InternViT6B (line 330) | class InternViT6B(nn.Module): method __init__ (line 332) | def __init__(self, in_chans=3, patch_size=14, img_size=224, pretrain_s... method init_weights (line 408) | def init_weights(self, pretrained=None): method dtype (line 438) | def dtype(self): method forward_features (line 441) | def forward_features(self, x): method forward (line 452) | def forward(self, x): method lr_decay_keywords (line 467) | def lr_decay_keywords(self, decay_ratio=0.95): FILE: classification/optimizer.py function build_optimizer (line 11) | def build_optimizer(config, model): function check_keywords_in_name (line 90) | def check_keywords_in_name(name, keywords=()): function check_keywords_in_dict (line 98) | def check_keywords_in_dict(name, keywords_dict): function set_weight_decay_and_lr (line 105) | def set_weight_decay_and_lr( FILE: classification/utils.py function load_ema_checkpoint (line 23) | def load_ema_checkpoint(config, model_ema, logger): function load_checkpoint (line 59) | def load_checkpoint(config, model, optimizer, lr_scheduler, scaler, logg... function load_pretrained (line 103) | def load_pretrained(config, model, logger): function convert_22k_head_to_1k (line 243) | def convert_22k_head_to_1k(model, logger): function save_checkpoint (line 263) | def save_checkpoint(config, function get_grad_norm (line 316) | def get_grad_norm(parameters, norm_type=2): function auto_resume_helper (line 329) | def auto_resume_helper(output_dir): function reduce_tensor (line 344) | def reduce_tensor(tensor): class NativeScalerWithGradNormCount (line 352) | class NativeScalerWithGradNormCount: method __init__ (line 355) | def __init__(self): method __call__ (line 358) | def __call__(self, method state_dict (line 380) | def state_dict(self): method load_state_dict (line 383) | def load_state_dict(self, state_dict): class MyAverageMeter (line 387) | class MyAverageMeter(object): method __init__ (line 390) | def __init__(self, max_len=-1): method update (line 398) | def update(self, val): FILE: clip_benchmark/clip_benchmark/cli.py function get_parser_args (line 23) | def get_parser_args(): function main (line 90) | def main(): function main_build (line 98) | def main_build(base): function main_eval (line 119) | def main_eval(base): function _as_list (line 172) | def _as_list(l): function run (line 178) | def run(args): FILE: clip_benchmark/clip_benchmark/datasets/birdsnap.py class Birdsnap (line 14) | class Birdsnap(torch.utils.data.Dataset): method __init__ (line 29) | def __init__(self, root, split='train', transform=None, target_transfo... method _check_integrity_of_metadata (line 44) | def _check_integrity_of_metadata(self, chunk_size=8192): method check_integrity (line 55) | def check_integrity(self): method download (line 69) | def download(self): method __len__ (line 86) | def __len__(self): method __getitem__ (line 90) | def __getitem__(self, index): method _parse_metadata (line 109) | def _parse_metadata(self): method _verify_image (line 127) | def _verify_image(self, idx): method scrape_images (line 137) | def scrape_images(self, missing_ids, chunk_size=8196): method _purge_missing_data (line 165) | def _purge_missing_data(self): class BirdsnapV2 (line 185) | class BirdsnapV2(torch.utils.data.Dataset): method __init__ (line 186) | def __init__(self, root, split='test', transform=None, target_transfor... method __len__ (line 209) | def __len__(self): method __getitem__ (line 213) | def __getitem__(self, index): FILE: clip_benchmark/clip_benchmark/datasets/builder.py function _load_classnames_and_classification_templates (line 20) | def _load_classnames_and_classification_templates(dataset_name, current_... function build_dataset (line 43) | def build_dataset(dataset_name, root='root', transform=None, split='test... class Dummy (line 488) | class Dummy(): method __init__ (line 490) | def __init__(self): method __getitem__ (line 493) | def __getitem__(self, i): method __len__ (line 496) | def __len__(self): function get_dataset_default_task (line 500) | def get_dataset_default_task(dataset): function get_dataset_collate_fn (line 507) | def get_dataset_collate_fn(dataset_name): function has_gdown (line 514) | def has_gdown(): function has_kaggle (line 518) | def has_kaggle(): function build_vtab_dataset (line 522) | def build_vtab_dataset(dataset_name, transform, download=True, split='te... function build_tfds_dataset (line 664) | def build_tfds_dataset(name, transform, download=True, split='test', dat... function build_wds_dataset (line 679) | def build_wds_dataset(dataset_name, transform, split='test', data_dir='r... function _extract_task (line 779) | def _extract_task(dataset_name): function image_captions_collate_fn (line 785) | def image_captions_collate_fn(batch): function get_dataset_collection_from_file (line 792) | def get_dataset_collection_from_file(path): FILE: clip_benchmark/clip_benchmark/datasets/caltech101.py class Caltech101 (line 17) | class Caltech101(VisionDataset): method __init__ (line 41) | def __init__( method __getitem__ (line 82) | def __getitem__(self, index: int) -> Tuple[Any, Any]: method _check_integrity (line 125) | def _check_integrity(self) -> bool: method __len__ (line 129) | def __len__(self) -> int: method download (line 132) | def download(self) -> None: method extra_repr (line 150) | def extra_repr(self) -> str: class Caltech256 (line 154) | class Caltech256(VisionDataset): method __init__ (line 169) | def __init__( method __getitem__ (line 199) | def __getitem__(self, index: int) -> Tuple[Any, Any]: method _check_integrity (line 226) | def _check_integrity(self) -> bool: method __len__ (line 230) | def __len__(self) -> int: method download (line 233) | def download(self) -> None: FILE: clip_benchmark/clip_benchmark/datasets/flickr.py class Flickr (line 13) | class Flickr(VisionDataset): method __init__ (line 15) | def __init__( method __getitem__ (line 36) | def __getitem__(self, index: int) -> Tuple[Any, Any]: method __len__ (line 58) | def __len__(self) -> int: FILE: clip_benchmark/clip_benchmark/datasets/imagenetv2.py class ImageNetValDataset (line 29) | class ImageNetValDataset(Dataset): method __init__ (line 30) | def __init__(self, transform=None, location='.'): method __len__ (line 55) | def __len__(self): method __getitem__ (line 58) | def __getitem__(self, i): class ImageNetV2Dataset (line 65) | class ImageNetV2Dataset(Dataset): method __init__ (line 66) | def __init__(self, variant='matched-frequency', transform=None, locati... method __len__ (line 91) | def __len__(self): method __getitem__ (line 94) | def __getitem__(self, i): FILE: clip_benchmark/clip_benchmark/datasets/kitti.py function _count_all_pp (line 26) | def _count_all_pp(x): function _count_vehicles_pp (line 34) | def _count_vehicles_pp(x): function _count_left_pp (line 44) | def _count_left_pp(x): function _count_far_pp (line 54) | def _count_far_pp(x): function _count_near_pp (line 65) | def _count_near_pp(x): function _closest_object_distance_pp (line 76) | def _closest_object_distance_pp(x): function _closest_vehicle_distance_pp (line 87) | def _closest_vehicle_distance_pp(x): function _closest_object_x_location_pp (line 103) | def _closest_object_x_location_pp(x): class KittiData (line 152) | class KittiData(base.ImageTfdsData): method __init__ (line 164) | def __init__(self, task, data_dir=None): FILE: clip_benchmark/clip_benchmark/datasets/multilingual_mscoco.py class Multilingual_MSCOCO (line 21) | class Multilingual_MSCOCO(VisionDataset): method __init__ (line 23) | def __init__(self, root, ann_file, transform=None, target_transform=No... method __getitem__ (line 31) | def __getitem__(self, index): method __len__ (line 46) | def __len__(self) -> int: function _get_downloadable_file (line 50) | def _get_downloadable_file(filename, download_url, is_json=True): function create_annotation_file (line 60) | def create_annotation_file(root, lang_code): FILE: clip_benchmark/clip_benchmark/datasets/objectnet.py function get_metadata (line 13) | def get_metadata(folder): class ObjectNetDataset (line 43) | class ObjectNetDataset(datasets.ImageFolder): method __init__ (line 45) | def __init__(self, root, transform): method __len__ (line 62) | def __len__(self): method __getitem__ (line 65) | def __getitem__(self, index): FILE: clip_benchmark/clip_benchmark/datasets/tfds.py function download_tfds_dataset (line 5) | def download_tfds_dataset(name, data_dir=None): function disable_gpus_on_tensorflow (line 11) | def disable_gpus_on_tensorflow(): class VTABIterableDataset (line 16) | class VTABIterableDataset(torch.utils.data.IterableDataset): method __init__ (line 18) | def __init__(self, tfds_dataset, split='test', input_name='image', lab... method __iter__ (line 33) | def __iter__(self): method __len__ (line 50) | def __len__(self): FILE: clip_benchmark/clip_benchmark/datasets/tools.py function process_single_caption (line 4) | def process_single_caption(caption, max_words=50): function pre_caption (line 17) | def pre_caption(caption, max_words=50): FILE: clip_benchmark/clip_benchmark/datasets/voc2007.py function download_url (line 35) | def download_url(url, path): function download_voc2007 (line 40) | def download_voc2007(root): function read_split (line 137) | def read_split(root, dataset, split): function read_bndbox (line 152) | def read_bndbox(root, dataset, paths): class PASCALVoc2007 (line 170) | class PASCALVoc2007(data.Dataset): method __init__ (line 177) | def __init__(self, root, set, transform=None, download=False, target_t... method __getitem__ (line 200) | def __getitem__(self, index): method __len__ (line 210) | def __len__(self): class PASCALVoc2007Cropped (line 214) | class PASCALVoc2007Cropped(data.Dataset): method __init__ (line 222) | def __init__(self, root, set, transform=None, download=False, target_t... method __getitem__ (line 240) | def __getitem__(self, index): method __len__ (line 250) | def __len__(self): FILE: clip_benchmark/clip_benchmark/metrics/linear_probe.py function assign_learning_rate (line 15) | def assign_learning_rate(param_group, new_lr): function _warmup_lr (line 19) | def _warmup_lr(base_lr, warmup_length, step): function cosine_lr (line 23) | def cosine_lr(optimizer, base_lrs, warmup_length, steps): class Featurizer (line 41) | class Featurizer(torch.nn.Module): method __init__ (line 42) | def __init__(self, model): method forward (line 46) | def forward(self, input): class FeatureDataset (line 53) | class FeatureDataset(Dataset): method __init__ (line 54) | def __init__(self, features, targets): method __len__ (line 58) | def __len__(self): method __getitem__ (line 61) | def __getitem__(self, i): function evaluate (line 65) | def evaluate(model, train_dataloader, dataloader, fewshot_k, batch_size,... FILE: clip_benchmark/clip_benchmark/metrics/mscoco_generative.py function evaluate (line 8) | def evaluate(model, dataloader, batch_size, device, transform, train_dat... FILE: clip_benchmark/clip_benchmark/metrics/zeroshot_classification.py function zero_shot_classifier (line 13) | def zero_shot_classifier(model, tokenizer, classnames, templates, device... function accuracy (line 54) | def accuracy(output, target, topk=(1,)): function run_classification (line 79) | def run_classification(model, classifier, dataloader, device, amp=True): function average_precision_per_class (line 120) | def average_precision_per_class(scores, targets): function evaluate (line 161) | def evaluate(model, dataloader, tokenizer, classnames, templates, device... FILE: clip_benchmark/clip_benchmark/metrics/zeroshot_retrieval.py function evaluate (line 8) | def evaluate(model, dataloader, tokenizer, device, amp=True, recall_k_li... function dataloader_with_indices (line 93) | def dataloader_with_indices(dataloader): function recall_at_k (line 102) | def recall_at_k(scores, positive_pairs, k): function batchify (line 126) | def batchify(func, X, Y, batch_size, device, *args, **kwargs): FILE: clip_benchmark/clip_benchmark/model_collection.py function get_model_collection_from_file (line 4) | def get_model_collection_from_file(path): FILE: clip_benchmark/clip_benchmark/models/__init__.py function load_clip (line 18) | def load_clip( FILE: clip_benchmark/clip_benchmark/models/intern_vit_6b/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 105) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: clip_benchmark/clip_benchmark/models/intern_vit_6b/flash_attention.py class FlashAttention (line 14) | class FlashAttention(nn.Module): method __init__ (line 25) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 30) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: clip_benchmark/clip_benchmark/models/intern_vit_6b/modeling_intern_vit.py class InternRMSNorm (line 33) | class InternRMSNorm(nn.Module): method __init__ (line 34) | def __init__(self, hidden_size, eps=1e-6): method forward (line 39) | def forward(self, hidden_states): class InternVisionEmbeddings (line 61) | class InternVisionEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: InternVisionConfig): method forward (line 82) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 93) | class InternAttention(nn.Module): method __init__ (line 96) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 126) | def _naive_attn(self, x): method _flash_attn (line 145) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 162) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 167) | class InternMLP(nn.Module): method __init__ (line 168) | def __init__(self, config: InternVisionConfig): method forward (line 175) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 182) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 183) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 198) | def forward( class InternVisionEncoder (line 213) | class InternVisionEncoder(nn.Module): method __init__ (line 223) | def __init__(self, config: InternVisionConfig): method forward (line 232) | def forward( class InternVisionModel (line 279) | class InternVisionModel(PreTrainedModel): method __init__ (line 283) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 290) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 301) | def get_input_embeddings(self): method forward (line 304) | def forward( FILE: clip_benchmark/clip_benchmark/models/internvl.py function load_internvl (line 12) | def load_internvl(model_name, pretrained, cache_dir, device): FILE: clip_benchmark/clip_benchmark/models/internvl_c_pytorch/__init__.py class InternVLTokenizer (line 23) | class InternVLTokenizer(nn.Module): method __init__ (line 24) | def __init__(self, model_path): method forward (line 30) | def forward(self, text, prefix='summarize:'): function build_transform (line 39) | def build_transform(task, image_size=224, mean=[0.485, 0.456, 0.406], st... function get_model_and_transform (line 56) | def get_model_and_transform(task, image_size, device): function load_internvl_c_pytorch (line 65) | def load_internvl_c_pytorch(ckpt_path, device, task, image_size=224): FILE: clip_benchmark/clip_benchmark/models/internvl_c_pytorch/flash_attention.py class FlashAttention (line 15) | class FlashAttention(nn.Module): method __init__ (line 26) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 31) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: clip_benchmark/clip_benchmark/models/internvl_c_pytorch/internvl_c.py class CrossAttention (line 25) | class CrossAttention(nn.Module): method __init__ (line 26) | def __init__( method forward (line 57) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 90) | class AttentiveBlock(nn.Module): method __init__ (line 92) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 105) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 114) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 116) | def forward(self, x): class RMSNorm (line 124) | class RMSNorm(nn.Module): method __init__ (line 125) | def __init__(self, hidden_size, eps=1e-6): method forward (line 130) | def forward(self, hidden_states): class LayerScale (line 152) | class LayerScale(nn.Module): method __init__ (line 153) | def __init__(self, dim, init_values=1e-5, inplace=False, force_fp32=Fa... method forward (line 160) | def forward(self, x): class Attention (line 170) | class Attention(nn.Module): method __init__ (line 171) | def __init__(self, dim, num_heads=8, qkv_bias=False, attn_drop=0., pro... method _naive_attn (line 193) | def _naive_attn(self, x): method _flash_attn (line 212) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 229) | def forward(self, x): class Mlp (line 234) | class Mlp(nn.Module): method __init__ (line 238) | def __init__(self, in_features, hidden_features=None, out_features=Non... method forward (line 252) | def forward(self, x): class Block (line 261) | class Block(nn.Module): method __init__ (line 263) | def __init__( method forward (line 287) | def forward(self, x): class PatchEmbed (line 300) | class PatchEmbed(nn.Module): method __init__ (line 304) | def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=... method forward (line 318) | def forward(self, x, **kwargs): class InternVL_C (line 327) | class InternVL_C(nn.Module): method __init__ (line 328) | def __init__(self, in_chans=3, patch_size=14, img_size=224, qkv_bias=F... method dtype (line 377) | def dtype(self): method forward_features (line 380) | def forward_features(self, x): method encode_image (line 391) | def encode_image(self, image): method encode_text (line 396) | def encode_text(self, text): method forward (line 403) | def forward(self, image, text): FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/__init__.py class InternVLTokenizer (line 23) | class InternVLTokenizer(nn.Module): method __init__ (line 24) | def __init__(self, model_path): method forward (line 30) | def forward(self, text, prefix='summarize:'): function build_transform (line 39) | def build_transform(task, image_size=224, mean=[0.485, 0.456, 0.406], st... function load_internvl_c_huggingface (line 56) | def load_internvl_c_huggingface(ckpt_path, device, task): function load_internvl_g_huggingface (line 73) | def load_internvl_g_huggingface(ckpt_path, device, task): FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 105) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/configuration_internvl.py class InternVLConfig (line 17) | class InternVLConfig(PretrainedConfig): method __init__ (line 57) | def __init__( method to_dict (line 97) | def to_dict(self): FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/flash_attention.py class FlashAttention (line 15) | class FlashAttention(nn.Module): method __init__ (line 26) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 31) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/modeling_intern_vit.py class InternRMSNorm (line 33) | class InternRMSNorm(nn.Module): method __init__ (line 34) | def __init__(self, hidden_size, eps=1e-6): method forward (line 39) | def forward(self, hidden_states): class InternVisionEmbeddings (line 61) | class InternVisionEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: InternVisionConfig): method forward (line 82) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 93) | class InternAttention(nn.Module): method __init__ (line 96) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 126) | def _naive_attn(self, x): method _flash_attn (line 145) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 162) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 167) | class InternMLP(nn.Module): method __init__ (line 168) | def __init__(self, config: InternVisionConfig): method forward (line 175) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 182) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 183) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 198) | def forward( class InternVisionEncoder (line 213) | class InternVisionEncoder(nn.Module): method __init__ (line 223) | def __init__(self, config: InternVisionConfig): method forward (line 232) | def forward( class InternVisionModel (line 279) | class InternVisionModel(PreTrainedModel): method __init__ (line 283) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 290) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 301) | def get_input_embeddings(self): method forward (line 304) | def forward( FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/modeling_internvl.py class InternVLPreTrainedModel (line 33) | class InternVLPreTrainedModel(PreTrainedModel): method _init_weights (line 49) | def _init_weights(self, module): method _set_gradient_checkpointing (line 67) | def _set_gradient_checkpointing(self, module, value=False): class CrossAttention (line 74) | class CrossAttention(nn.Module): method __init__ (line 75) | def __init__( method forward (line 106) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 139) | class AttentiveBlock(nn.Module): method __init__ (line 141) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 154) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 163) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 165) | def forward(self, x): class InternVLModel (line 173) | class InternVLModel(InternVLPreTrainedModel): method __init__ (line 177) | def __init__(self, config: InternVLConfig): method wrap_backbone_lora (line 219) | def wrap_backbone_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method wrap_qllama_lora (line 229) | def wrap_qllama_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method get_input_embeddings (line 240) | def get_input_embeddings(self): method set_input_embeddings (line 243) | def set_input_embeddings(self, value): method set_output_embeddings (line 246) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 249) | def get_output_embeddings(self) -> nn.Module: method generate (line 253) | def generate( method get_text_features (line 288) | def get_text_features( method get_image_features (line 337) | def get_image_features( method encode_image (line 383) | def encode_image(self, image, mode): method encode_text (line 407) | def encode_text(self, text): method forward (line 420) | def forward(self, image, text, mode='InternVL-C'): class InternVL_C (line 437) | class InternVL_C(InternVLModel): method encode_image (line 439) | def encode_image(self, image): method encode_text (line 448) | def encode_text(self, text): method forward (line 461) | def forward(self, image, text): class InternVL_G (line 477) | class InternVL_G(InternVLModel): method encode_image (line 479) | def encode_image(self, image): method encode_text (line 493) | def encode_text(self, text): method forward (line 506) | def forward(self, image, text): FILE: clip_benchmark/clip_benchmark/models/internvl_huggingface/modeling_qllama.py function _make_causal_mask (line 42) | def _make_causal_mask( function _expand_mask (line 60) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class LlamaRMSNorm (line 74) | class LlamaRMSNorm(nn.Module): method __init__ (line 75) | def __init__(self, hidden_size, eps=1e-6): method forward (line 83) | def forward(self, hidden_states): class LlamaRotaryEmbedding (line 109) | class LlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 110) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 124) | def forward(self, x, seq_len=None): class FixedLlamaRotaryEmbedding (line 141) | class FixedLlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 142) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 155) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 165) | def forward(self, x, seq_len=None): function rotate_half (line 179) | def rotate_half(x): function apply_rotary_pos_emb (line 186) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class LlamaMLP (line 196) | class LlamaMLP(nn.Module): method __init__ (line 197) | def __init__( method forward (line 209) | def forward(self, x): class LlamaAttention (line 213) | class LlamaAttention(nn.Module): method __init__ (line 216) | def __init__(self, config: LlamaConfig): method _shape (line 235) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 238) | def forward( class LlamaCrossAttention (line 304) | class LlamaCrossAttention(nn.Module): method __init__ (line 307) | def __init__(self, config: LlamaConfig): method _shape (line 329) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 332) | def forward( class LlamaDecoderLayer (line 408) | class LlamaDecoderLayer(nn.Module): method __init__ (line 409) | def __init__(self, config: LlamaConfig, use_cross_attn: bool): method forward (line 423) | def forward( class LlamaPreTrainedModel (line 520) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 527) | def _init_weights(self, module): method _set_gradient_checkpointing (line 538) | def _set_gradient_checkpointing(self, module, value=False): class LlamaModel (line 613) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 621) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 636) | def get_input_embeddings(self): method set_input_embeddings (line 639) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 643) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 667) | def forward( method forward_train (line 783) | def forward_train( class LlamaForCausalLM (line 915) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 916) | def __init__(self, config): method get_input_embeddings (line 925) | def get_input_embeddings(self): method set_input_embeddings (line 928) | def set_input_embeddings(self, value): method get_output_embeddings (line 931) | def get_output_embeddings(self): method set_output_embeddings (line 934) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 937) | def set_decoder(self, decoder): method get_decoder (line 940) | def get_decoder(self): method forward (line 945) | def forward( method prepare_inputs_for_generation (line 1035) | def prepare_inputs_for_generation( method _reorder_cache (line 1069) | def _reorder_cache(past_key_values, beam_idx): FILE: clip_benchmark/clip_benchmark/models/japanese_clip.py class DictTensor (line 6) | class DictTensor: method __init__ (line 11) | def __init__(self, d: Dict[str, torch.Tensor]): method to (line 14) | def to(self, device): class JaCLIPForBenchmark (line 18) | class JaCLIPForBenchmark: method __init__ (line 23) | def __init__(self, model): method encode_text (line 26) | def encode_text(self, dict_tensor): method encode_image (line 29) | def encode_image(self, image): function load_japanese_clip (line 33) | def load_japanese_clip(pretrained: str, device='cpu', **kwargs): FILE: clip_benchmark/clip_benchmark/models/open_clip.py function load_open_clip (line 4) | def load_open_clip(model_name: str = 'ViT-B-32-quickgelu', pretrained: s... FILE: clip_benchmark/clip_benchmark/webdataset_builder.py function get_parser_args (line 16) | def get_parser_args(): function main (line 52) | def main(): function run (line 57) | def run(args): function PIL_to_bytes (line 92) | def PIL_to_bytes(image_format): function path_to_bytes (line 107) | def path_to_bytes(filepath): function convert_dataset (line 112) | def convert_dataset(dataset, split, output_folder, *, transform=None, function convert_retrieval_dataset (line 213) | def convert_retrieval_dataset(dataset, split, output_folder, *, transfor... FILE: clip_benchmark/probe_benchmark/build_df_scaling_experiments.py function get_us_dataset (line 70) | def get_us_dataset(pretrained): FILE: clip_benchmark/setup.py function load_requirements (line 14) | def load_requirements(f): FILE: clip_benchmark/tests/test_clip_benchmark.py class base_args (line 11) | class base_args: function test_base (line 38) | def test_base(): FILE: internvl_chat/eval/caption/evaluate_caption.py class CaptionDataset (line 40) | class CaptionDataset(torch.utils.data.Dataset): method __init__ (line 42) | def __init__(self, name, root, annotation, prompt, input_size=224, dyn... method __len__ (line 57) | def __len__(self): method __getitem__ (line 60) | def __getitem__(self, idx): function collate_fn (line 89) | def collate_fn(inputs, tokenizer): class InferenceSampler (line 98) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 100) | def __init__(self, size): method _get_local_indices (line 108) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 117) | def __iter__(self): method __len__ (line 120) | def __len__(self): function evaluate_chat_model (line 124) | def evaluate_chat_model(): FILE: internvl_chat/eval/domain_specific/drivelm/evaluate.py function post_process (line 27) | def post_process(pred): function collate_fn (line 68) | def collate_fn(batches, tokenizer): class DriveLMDataset (line 77) | class DriveLMDataset(torch.utils.data.Dataset): method __init__ (line 79) | def __init__(self, root, split, prompt, image_path, input_size=224, dy... method __len__ (line 94) | def __len__(self): method __getitem__ (line 97) | def __getitem__(self, idx): class InferenceSampler (line 128) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 130) | def __init__(self, size): method _get_local_indices (line 138) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 147) | def __iter__(self): method __len__ (line 150) | def __len__(self): function evaluate_chat_model (line 154) | def evaluate_chat_model(): FILE: internvl_chat/eval/domain_specific/mme_rw/evaluate.py function collate_fn (line 29) | def collate_fn(batches, tokenizer): class MMERealworldDataset (line 40) | class MMERealworldDataset(torch.utils.data.Dataset): method __init__ (line 42) | def __init__(self, root, prompt, language, subtask: Literal[ method __len__ (line 59) | def __len__(self): method __getitem__ (line 62) | def __getitem__(self, idx): class InferenceSampler (line 100) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 102) | def __init__(self, size): method _get_local_indices (line 110) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 119) | def __iter__(self): method __len__ (line 122) | def __len__(self): function post_process (line 126) | def post_process(s, choices): function evaluate (line 152) | def evaluate(outputs): function evaluate_chat_model (line 190) | def evaluate_chat_model(): FILE: internvl_chat/eval/domain_specific/rs_det/caculate.py function calculate_iou (line 9) | def calculate_iou(box1, box2): function box_iou (line 32) | def box_iou(boxes1, boxes2): function transform_bbox (line 48) | def transform_bbox(bbox, image_size): function evaluation_metrics (line 59) | def evaluation_metrics(outputs): FILE: internvl_chat/eval/domain_specific/rs_det/evaluate.py function collate_fn (line 26) | def collate_fn(batches, tokenizer): class GroundingDataset (line 35) | class GroundingDataset(torch.utils.data.Dataset): method __init__ (line 37) | def __init__(self, root, image_root, prompt='', input_size=224, dynami... method __len__ (line 50) | def __len__(self): method __getitem__ (line 53) | def __getitem__(self, idx): function calculate_iou (line 80) | def calculate_iou(box1, box2): class InferenceSampler (line 103) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 105) | def __init__(self, size): method _get_local_indices (line 113) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 122) | def __iter__(self): method __len__ (line 125) | def __len__(self): function evaluate_chat_model (line 129) | def evaluate_chat_model(): FILE: internvl_chat/eval/domain_specific/rs_vqa/evaluate.py function collate_fn (line 40) | def collate_fn(batches, tokenizer): class RSVQADataset (line 50) | class RSVQADataset(torch.utils.data.Dataset): method __init__ (line 52) | def __init__(self, root, prompt, image_root, input_size=224, dynamic_i... method __len__ (line 65) | def __len__(self): method __getitem__ (line 68) | def __getitem__(self, idx): function evaluation_metrics (line 96) | def evaluation_metrics(outputs): class InferenceSampler (line 121) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 123) | def __init__(self, size): method _get_local_indices (line 131) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 140) | def __iter__(self): method __len__ (line 143) | def __len__(self): function evaluate_chat_model (line 147) | def evaluate_chat_model(): FILE: internvl_chat/eval/domain_specific/rs_vqa/score.py function is_correct_count (line 5) | def is_correct_count(response, answer): function is_correct_area (line 23) | def is_correct_area(response, answer): function calculate_scores (line 32) | def calculate_scores(data): FILE: internvl_chat/eval/llava_bench/eval_gpt_review_bench.py function get_eval (line 11) | def get_eval(content: str, max_tokens: int): function parse_score (line 34) | def parse_score(review): FILE: internvl_chat/eval/llava_bench/evaluate_llava_bench.py class VQADataset (line 22) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 24) | def __init__(self, root, data, prompt, input_size=224, dynamic_image_s... method __len__ (line 35) | def __len__(self): method __getitem__ (line 38) | def __getitem__(self, idx): function evaluate_chat_model (line 57) | def evaluate_chat_model(): FILE: internvl_chat/eval/llava_bench/summarize_gpt_review.py function parse_args (line 9) | def parse_args(): FILE: internvl_chat/eval/mantis_eval/evaluate_mantis.py function collate_fn (line 26) | def collate_fn(batches, tokenizer): class MantisEvalDataset (line 36) | class MantisEvalDataset(torch.utils.data.Dataset): method __init__ (line 38) | def __init__(self, root, split, prompt, input_size=224, dynamic_image_... method __len__ (line 49) | def __len__(self): method __getitem__ (line 52) | def __getitem__(self, idx): class InferenceSampler (line 103) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 105) | def __init__(self, size): method _get_local_indices (line 113) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 122) | def __iter__(self): method __len__ (line 125) | def __len__(self): function evaluate_chat_model (line 129) | def evaluate_chat_model(): FILE: internvl_chat/eval/mathvista/calculate_score.py function get_most_similar (line 9) | def get_most_similar(prediction, choices): function normalize_extracted_answer (line 19) | def normalize_extracted_answer(extraction, choices, question_type, answe... function safe_equal (line 70) | def safe_equal(prediction, answer): function get_acc_with_contion (line 83) | def get_acc_with_contion(res_pd, key, value): FILE: internvl_chat/eval/mathvista/evaluate_mathvista.py function collate_fn (line 42) | def collate_fn(batches, tokenizer): class MathVistaDataset (line 48) | class MathVistaDataset(torch.utils.data.Dataset): method __init__ (line 50) | def __init__(self, root, split, input_size=224, dynamic_image_size=False, method __len__ (line 60) | def __len__(self): method __getitem__ (line 63) | def __getitem__(self, idx): class InferenceSampler (line 83) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 85) | def __init__(self, size): method _get_local_indices (line 93) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 102) | def __iter__(self): method __len__ (line 105) | def __len__(self): function evaluate_chat_model (line 109) | def evaluate_chat_model(): FILE: internvl_chat/eval/mathvista/extract_answer.py function verify_extraction (line 21) | def verify_extraction(extraction): function create_test_prompt (line 28) | def create_test_prompt(demo_prompt, query, response): function _extract_answer (line 35) | def _extract_answer(text): function extract_answer (line 42) | def extract_answer(response, problem, quick_extract=False): FILE: internvl_chat/eval/mathvista/utilities.py function create_dir (line 14) | def create_dir(output_dir): function read_csv (line 19) | def read_csv(file): function read_pandas_csv (line 27) | def read_pandas_csv(csv_path): function read_json (line 34) | def read_json(path): function read_jsonl (line 39) | def read_jsonl(file): function read_pickle (line 45) | def read_pickle(path): function save_json (line 50) | def save_json(data, path): function save_array_img (line 55) | def save_array_img(path, image): function contains_digit (line 59) | def contains_digit(text): function contains_number_word (line 66) | def contains_number_word(text): function contains_quantity_word (line 86) | def contains_quantity_word(text, special_keep_words=[]): function is_bool_word (line 115) | def is_bool_word(text): function is_digit_string (line 123) | def is_digit_string(text): function is_float_string (line 134) | def is_float_string(text): function copy_image (line 145) | def copy_image(image_path, output_image_path): function copy_dir (line 150) | def copy_dir(src_dir, dst_dir): function get_image_size (line 160) | def get_image_size(img_path): function get_chat_response (line 166) | def get_chat_response(promot, api_key, model='gpt-3.5-turbo', temperatur... FILE: internvl_chat/eval/mirb/evaluate_mirb.py function eval_scores (line 42) | def eval_scores(results, dataset): function exact_yes_no (line 54) | def exact_yes_no(results): function exact_in_match (line 74) | def exact_in_match(results): function exact_match (line 107) | def exact_match(results, dataset): function collate_fn (line 139) | def collate_fn(batches, tokenizer): function get_task_instruction (line 151) | def get_task_instruction(dataset): class MIRBDataset (line 166) | class MIRBDataset(torch.utils.data.Dataset): method __init__ (line 168) | def __init__(self, root, split, input_size=224, dynamic_image_size=False, method __len__ (line 188) | def __len__(self): method __getitem__ (line 191) | def __getitem__(self, idx): class InferenceSampler (line 237) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 239) | def __init__(self, size): method _get_local_indices (line 247) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 256) | def __iter__(self): method __len__ (line 259) | def __len__(self): function evaluate_chat_model (line 263) | def evaluate_chat_model(): FILE: internvl_chat/eval/mmbench/evaluate_mmbench.py function collate_fn (line 64) | def collate_fn(batches, tokenizer): class MMBenchDataset (line 73) | class MMBenchDataset(torch.utils.data.Dataset): method __init__ (line 75) | def __init__(self, root, prompt, language, input_size=224, dynamic_ima... method __len__ (line 86) | def __len__(self): method __getitem__ (line 89) | def __getitem__(self, idx): method load_from_df (line 132) | def load_from_df(self, idx, key): class InferenceSampler (line 139) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 141) | def __init__(self, size): method _get_local_indices (line 149) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 158) | def __iter__(self): method __len__ (line 161) | def __len__(self): function post_process (line 165) | def post_process(pred, option): function evaluate_chat_model (line 180) | def evaluate_chat_model(): FILE: internvl_chat/eval/mme/calculation.py class calculate_metrics (line 16) | class calculate_metrics: method divide_chunks (line 17) | def divide_chunks(self, l, n=2): method parse_pred_ans (line 24) | def parse_pred_ans(self, pred_ans): method compute_metric (line 40) | def compute_metric(self, gts, preds): method process_result (line 84) | def process_result(self, results_dir): FILE: internvl_chat/eval/mme/eval.py function load_image (line 12) | def load_image(image_file, input_size=224): function post_processing (line 26) | def post_processing(response): FILE: internvl_chat/eval/mmhal/evaluate_mmhal.py function collate_fn (line 29) | def collate_fn(batches, tokenizer): class VQADataset (line 39) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 41) | def __init__( method __len__ (line 58) | def __len__(self): method __getitem__ (line 61) | def __getitem__(self, idx): class InferenceSampler (line 97) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 99) | def __init__(self, size): method _get_local_indices (line 107) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 116) | def __iter__(self): method __len__ (line 119) | def __len__(self): function evaluate_chat_model (line 123) | def evaluate_chat_model(): FILE: internvl_chat/eval/mmiu/evaluate_mmiu.py function collate_fn (line 25) | def collate_fn(batches, tokenizer): class MMIUDataset (line 35) | class MMIUDataset(torch.utils.data.Dataset): method __init__ (line 37) | def __init__(self, meta, input_size=224, dynamic_image_size=False, method __len__ (line 51) | def __len__(self): method __getitem__ (line 54) | def __getitem__(self, idx): class InferenceSampler (line 111) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 113) | def __init__(self, size): method _get_local_indices (line 121) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 130) | def __iter__(self): method __len__ (line 133) | def __len__(self): function post_process (line 137) | def post_process(pred, option): function evaluate_chat_model (line 152) | def evaluate_chat_model(): FILE: internvl_chat/eval/mmmu/data_utils.py function save_json (line 55) | def save_json(filename, ds): function get_multi_choice_info (line 60) | def get_multi_choice_info(options): function load_yaml (line 76) | def load_yaml(file_path): function parse_img_path (line 86) | def parse_img_path(text): function process_single_sample (line 91) | def process_single_sample(data): function save_json (line 105) | def save_json(filename, ds): function save_jsonl (line 110) | def save_jsonl(filename, data): function save_args (line 128) | def save_args(args, path_dir): function construct_prompt (line 138) | def construct_prompt(sample, config): FILE: internvl_chat/eval/mmmu/eval_utils.py function parse_multi_choice_response (line 11) | def parse_multi_choice_response(response, all_choices, index2ans): function check_is_number (line 67) | def check_is_number(string): function normalize_str (line 79) | def normalize_str(string): function extract_numbers (line 104) | def extract_numbers(string): function parse_open_response (line 127) | def parse_open_response(response): function eval_multi_choice (line 183) | def eval_multi_choice(gold_i, pred_i): function eval_open (line 200) | def eval_open(gold_i, pred_i): function evaluate (line 229) | def evaluate(samples): function calculate_ins_level_acc (line 255) | def calculate_ins_level_acc(results: Dict): FILE: internvl_chat/eval/mmmu/evaluate_mmmu.py function collate_fn (line 39) | def collate_fn(batches, tokenizer): class MMMUDataset (line 48) | class MMMUDataset(torch.utils.data.Dataset): method __init__ (line 50) | def __init__(self, root, split, prompt, input_size=224, dynamic_image_... method __len__ (line 67) | def __len__(self): method __getitem__ (line 70) | def __getitem__(self, idx): class InferenceSampler (line 119) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 121) | def __init__(self, size): method _get_local_indices (line 129) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 138) | def __iter__(self): method __len__ (line 141) | def __len__(self): function post_process (line 145) | def post_process(pred, option): function evaluate_chat_model (line 160) | def evaluate_chat_model(): FILE: internvl_chat/eval/mmmu_pro/evaluate.py function mmmu_process_results (line 16) | def mmmu_process_results(results): function extract_subset_name (line 40) | def extract_subset_name(input_string): function mmmu_aggregate_results (line 51) | def mmmu_aggregate_results(results): function calculate_ins_level_acc (line 94) | def calculate_ins_level_acc(results): function eval_multi_choice (line 143) | def eval_multi_choice(gold_i, pred_i): function eval_open (line 161) | def eval_open(gold_i, pred_i): function evaluate_mmmu (line 190) | def evaluate_mmmu(samples): function parse_multi_choice_responses (line 214) | def parse_multi_choice_responses(response): function parse_multi_choice_response (line 219) | def parse_multi_choice_response(response, all_choices, index2ans): function extract_numbers (line 296) | def extract_numbers(string): function check_is_number (line 320) | def check_is_number(string): function normalize_str (line 333) | def normalize_str(string): function parse_open_response (line 359) | def parse_open_response(response): function get_multi_choice_info (line 431) | def get_multi_choice_info(options): function check_files (line 451) | def check_files(input_dir): FILE: internvl_chat/eval/mmmu_pro/evaluate_mmmu_pro.py function replace_images_tokens (line 34) | def replace_images_tokens(input_string): function parse_options (line 43) | def parse_options(options): function construct_prompt (line 49) | def construct_prompt(doc): function mmmu_doc_to_text (line 56) | def mmmu_doc_to_text(doc): function origin_mmmu_doc_to_visual (line 61) | def origin_mmmu_doc_to_visual(doc): function vision_mmmu_doc_to_visual (line 70) | def vision_mmmu_doc_to_visual(doc): function process_prompt (line 74) | def process_prompt(data): function run_and_save (line 84) | def run_and_save(pipe): FILE: internvl_chat/eval/mmvet/evaluate_mmvet.py function collate_fn (line 24) | def collate_fn(batches, tokenizer): class VQADataset (line 33) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 35) | def __init__(self, root, data, prompt, input_size=224, dynamic_image_s... method __len__ (line 46) | def __len__(self): method __getitem__ (line 49) | def __getitem__(self, idx): function evaluate_chat_model (line 68) | def evaluate_chat_model(): FILE: internvl_chat/eval/mmvetv2/evaluate_mmvet_v2.py function collate_fn (line 26) | def collate_fn(batches, tokenizer): class VQADataset (line 35) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 37) | def __init__(self, root, data, prompt, input_size=224, dynamic_image_s... method __len__ (line 50) | def __len__(self): method __getitem__ (line 53) | def __getitem__(self, idx): class InferenceSampler (line 80) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 82) | def __init__(self, size): method _get_local_indices (line 90) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 99) | def __iter__(self): method __len__ (line 102) | def __len__(self): function evaluate_chat_model (line 106) | def evaluate_chat_model(): FILE: internvl_chat/eval/mmvp/evaluate_mmvp.py function collate_fn (line 25) | def collate_fn(batches, tokenizer): class MMVPDataset (line 34) | class MMVPDataset(torch.utils.data.Dataset): method __init__ (line 36) | def __init__(self, root, prompt, input_size=224, dynamic_image_size=Fa... method __len__ (line 53) | def __len__(self): method __getitem__ (line 56) | def __getitem__(self, idx): class InferenceSampler (line 98) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 100) | def __init__(self, size): method _get_local_indices (line 108) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 117) | def __iter__(self): method __len__ (line 120) | def __len__(self): function post_process (line 124) | def post_process(pred, option): function evaluate_chat_model (line 139) | def evaluate_chat_model(): FILE: internvl_chat/eval/mpdocvqa/evaluate_vqa.py function collate_fn (line 32) | def collate_fn(batches, tokenizer): class VQADataset (line 42) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 44) | def __init__(self, root, test, prompt, input_size=224, dynamic_image_s... method __len__ (line 56) | def __len__(self): method __getitem__ (line 59) | def __getitem__(self, idx): class InferenceSampler (line 101) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 103) | def __init__(self, size): method _get_local_indices (line 111) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 120) | def __iter__(self): method __len__ (line 123) | def __len__(self): function evaluate_chat_model (line 127) | def evaluate_chat_model(): FILE: internvl_chat/eval/mpdocvqa/infographicsvqa_eval.py function save_json (line 17) | def save_json(file_path, data): function levenshtein_distance (line 22) | def levenshtein_distance(s1, s2): function validate_data (line 38) | def validate_data(gtFilePath, submFilePath): function evaluate_method (line 91) | def evaluate_method(gtFilePath, submFilePath, evaluationParams): function display_results (line 204) | def display_results(results, show_answer_types): FILE: internvl_chat/eval/mvbench/evaluate_mvbench.py function collate_fn (line 52) | def collate_fn(batches, tokenizer): class MVBenchDataset (line 61) | class MVBenchDataset(torch.utils.data.Dataset): method __init__ (line 63) | def __init__(self, data_dir, data_list, prompt, question_prompt, num_s... method __len__ (line 91) | def __len__(self): method __str__ (line 94) | def __str__(self): method get_index (line 116) | def get_index(self, bound, fps, max_frame, first_idx=0): method read_video (line 130) | def read_video(self, video_path, bound=None): method read_gif (line 143) | def read_gif(self, video_path, bound=None, fps=25): method read_frame (line 157) | def read_frame(self, video_path, bound=None, fps=3): method qa_template (line 167) | def qa_template(self, data): method __getitem__ (line 180) | def __getitem__(self, idx): class InferenceSampler (line 220) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 222) | def __init__(self, size): method _get_local_indices (line 230) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 239) | def __iter__(self): method __len__ (line 242) | def __len__(self): function check_ans (line 246) | def check_ans(pred, gt): function evaluate_chat_model (line 265) | def evaluate_chat_model(): FILE: internvl_chat/eval/pope/eval_pope.py function eval_pope (line 6) | def eval_pope(answers, label_file): FILE: internvl_chat/eval/pope/evaluate_pope.py function extract_answer (line 38) | def extract_answer(text): function collate_fn (line 45) | def collate_fn(batches, tokenizer): class VQADataset (line 54) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 56) | def __init__(self, root, data, prompt, input_size=224, dynamic_image_s... method __len__ (line 67) | def __len__(self): method __getitem__ (line 70) | def __getitem__(self, idx): class InferenceSampler (line 98) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 100) | def __init__(self, size): method _get_local_indices (line 108) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 117) | def __iter__(self): method __len__ (line 120) | def __len__(self): function evaluate_chat_model (line 124) | def evaluate_chat_model(): FILE: internvl_chat/eval/refcoco/evaluate_grounding.py function box_iou (line 29) | def box_iou(boxes1, boxes2): function collate_fn (line 45) | def collate_fn(batches, tokenizer): class RefCOCODataset (line 53) | class RefCOCODataset(torch.utils.data.Dataset): method __init__ (line 55) | def __init__(self, test, prompt, input_size=224, dynamic_image_size=Fa... method __len__ (line 65) | def __len__(self): method __getitem__ (line 68) | def __getitem__(self, idx): class InferenceSampler (line 94) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 96) | def __init__(self, size): method _get_local_indices (line 104) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 113) | def __iter__(self): method __len__ (line 116) | def __len__(self): function evaluate_chat_model (line 120) | def evaluate_chat_model(): FILE: internvl_chat/eval/scienceqa/evaluate_scienceqa.py function extract_answer (line 41) | def extract_answer(text): function collate_fn (line 48) | def collate_fn(batches, tokenizer): class ScienceQADataset (line 57) | class ScienceQADataset(torch.utils.data.Dataset): method __init__ (line 59) | def __init__(self, root, prompt, input_size=224, dynamic_image_size=Fa... method __len__ (line 70) | def __len__(self): method __getitem__ (line 73) | def __getitem__(self, idx): class InferenceSampler (line 114) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 116) | def __init__(self, size): method _get_local_indices (line 124) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 133) | def __iter__(self): method __len__ (line 136) | def __len__(self): function post_process (line 140) | def post_process(pred, option): function evaluate_chat_model (line 161) | def evaluate_chat_model(): FILE: internvl_chat/eval/seed/calculation.py function is_integer_string (line 16) | def is_integer_string(s): function filter_questions (line 24) | def filter_questions(data, task='all'): FILE: internvl_chat/eval/seed/evaluate_seed.py function collate_fn (line 25) | def collate_fn(batches, tokenizer): class MultipleChoiceDataset (line 33) | class MultipleChoiceDataset(torch.utils.data.Dataset): method __init__ (line 35) | def __init__(self, root, annotation, input_size=224, dynamic_image_siz... method __len__ (line 46) | def __len__(self): method __getitem__ (line 49) | def __getitem__(self, idx): class InferenceSampler (line 71) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 73) | def __init__(self, size): method _get_local_indices (line 81) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 90) | def __iter__(self): method __len__ (line 93) | def __len__(self): function post_process (line 97) | def post_process(pred, option): function evaluate_chat_model (line 112) | def evaluate_chat_model(): FILE: internvl_chat/eval/tiny_lvlm/calculate_score.py function parse_args (line 10) | def parse_args(): function main (line 17) | def main(args): FILE: internvl_chat/eval/tiny_lvlm/evaluate_lvlm.py function collate_fn (line 24) | def collate_fn(batches, tokenizer): class VQADataset (line 33) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 35) | def __init__(self, root, prompt, input_size=224, dynamic_image_size=Fa... method __len__ (line 56) | def __len__(self): method __getitem__ (line 59) | def __getitem__(self, idx): class InferenceSampler (line 82) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 84) | def __init__(self, size): method _get_local_indices (line 92) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 101) | def __iter__(self): method __len__ (line 104) | def __len__(self): function evaluate_chat_model (line 108) | def evaluate_chat_model(): FILE: internvl_chat/eval/tiny_lvlm/tools.py function remove_special_chars (line 5) | def remove_special_chars(s): function has_word (line 11) | def has_word(sentence, word): class VQAEval (line 20) | class VQAEval: method __init__ (line 21) | def __init__(self): method evaluate (line 186) | def evaluate(self, answer, gt_answers): method evaluate_MRR (line 213) | def evaluate_MRR(self, answer, gt_answers): method processPunctuation (line 231) | def processPunctuation(self, inText): method processDigitArticle (line 243) | def processDigitArticle(self, inText): FILE: internvl_chat/eval/vqa/evaluate_vqa.py function relaxed_correctness (line 144) | def relaxed_correctness(target: str, function evaluate_relaxed_accuracy (line 186) | def evaluate_relaxed_accuracy(entries): function evaluate_exact_match_accuracy (line 199) | def evaluate_exact_match_accuracy(entries): function collate_fn (line 213) | def collate_fn(batches, tokenizer): class VQADataset (line 222) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 224) | def __init__(self, train, test, prompt, few_shot, input_size=224, dyna... method __len__ (line 237) | def __len__(self): method __getitem__ (line 240) | def __getitem__(self, idx): class InferenceSampler (line 273) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 275) | def __init__(self, size): method _get_local_indices (line 283) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 292) | def __iter__(self): method __len__ (line 295) | def __len__(self): function post_process (line 299) | def post_process(response): function evaluate_chat_model (line 318) | def evaluate_chat_model(): FILE: internvl_chat/eval/vqa/infographicsvqa_eval.py function save_json (line 17) | def save_json(file_path, data): function levenshtein_distance (line 22) | def levenshtein_distance(s1, s2): function validate_data (line 38) | def validate_data(gtFilePath, submFilePath): function evaluate_method (line 91) | def evaluate_method(gtFilePath, submFilePath, evaluationParams): function display_results (line 204) | def display_results(results, show_answer_types): FILE: internvl_chat/eval/vqa/textvqa_eval.py class EvalAIAnswerProcessor (line 8) | class EvalAIAnswerProcessor: method __init__ (line 179) | def __init__(self, *args, **kwargs): method word_tokenize (line 182) | def word_tokenize(self, word): method process_punctuation (line 187) | def process_punctuation(self, in_text): method process_digit_article (line 199) | def process_digit_article(self, in_text): method __call__ (line 214) | def __call__(self, item): class TextVQAAccuracyEvaluator (line 222) | class TextVQAAccuracyEvaluator: method __init__ (line 223) | def __init__(self): method _compute_answer_scores (line 226) | def _compute_answer_scores(self, raw_answers): method eval_pred_list (line 249) | def eval_pred_list(self, pred_list, disable_tqdm=False): class STVQAAccuracyEvaluator (line 261) | class STVQAAccuracyEvaluator: method __init__ (line 262) | def __init__(self): method eval_pred_list (line 265) | def eval_pred_list(self, pred_list): class STVQAANLSEvaluator (line 277) | class STVQAANLSEvaluator: method __init__ (line 278) | def __init__(self): method get_anls (line 283) | def get_anls(self, s1, s2): method eval_pred_list (line 290) | def eval_pred_list(self, pred_list): class TextCapsBleu4Evaluator (line 302) | class TextCapsBleu4Evaluator: method __init__ (line 303) | def __init__(self): method eval_pred_list (line 322) | def eval_pred_list(self, pred_list): FILE: internvl_chat/internvl/conversation.py class SeparatorStyle (line 13) | class SeparatorStyle(IntEnum): class Conversation (line 37) | class Conversation: method get_prompt (line 61) | def get_prompt(self) -> str: method set_system_message (line 251) | def set_system_message(self, system_message: str): method append_message (line 255) | def append_message(self, role: str, message: str): method update_last_message (line 259) | def update_last_message(self, message: str): method to_gradio_chatbot (line 267) | def to_gradio_chatbot(self): method to_openai_api_messages (line 277) | def to_openai_api_messages(self): method copy (line 289) | def copy(self): method dict (line 304) | def dict(self): function register_conv_template (line 318) | def register_conv_template(template: Conversation, override: bool = False): function get_conv_template (line 328) | def get_conv_template(name: str) -> Conversation: FILE: internvl_chat/internvl/dist_utils.py function _find_free_port (line 14) | def _find_free_port(): function _is_free_port (line 25) | def _is_free_port(port): function init_dist (line 32) | def init_dist(launcher, backend='nccl', **kwargs): function _init_dist_pytorch (line 45) | def _init_dist_pytorch(backend, **kwargs): function _init_dist_mpi (line 54) | def _init_dist_mpi(backend, **kwargs): function _init_dist_slurm (line 67) | def _init_dist_slurm(backend, port=None): FILE: internvl_chat/internvl/model/__init__.py function split_model (line 14) | def split_model(num_layers, vit_alpha=0.5): function load_model_and_tokenizer (line 39) | def load_model_and_tokenizer(args): FILE: internvl_chat/internvl/model/internlm2/configuration_internlm2.py class InternLM2Config (line 27) | class InternLM2Config(PretrainedConfig): method __init__ (line 77) | def __init__( # pylint: disable=W0102 method _rope_scaling_validation (line 131) | def _rope_scaling_validation(self): FILE: internvl_chat/internvl/model/internlm2/modeling_internlm2.py function _import_flash_attn (line 65) | def _import_flash_attn(): function _get_unpad_data (line 83) | def _get_unpad_data(attention_mask): function _make_causal_mask (line 96) | def _make_causal_mask( function _expand_mask (line 114) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class InternLM2RMSNorm (line 129) | class InternLM2RMSNorm(nn.Module): method __init__ (line 130) | def __init__(self, hidden_size, eps=1e-6): method forward (line 138) | def forward(self, hidden_states): class InternLM2RotaryEmbedding (line 161) | class InternLM2RotaryEmbedding(nn.Module): method __init__ (line 162) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 176) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 186) | def forward(self, x, seq_len=None): class InternLM2LinearScalingRotaryEmbedding (line 198) | class InternLM2LinearScalingRotaryEmbedding(InternLM2RotaryEmbedding): method __init__ (line 201) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 205) | def _set_cos_sin_cache(self, seq_len, device, dtype): class InternLM2DynamicNTKScalingRotaryEmbedding (line 218) | class InternLM2DynamicNTKScalingRotaryEmbedding(InternLM2RotaryEmbedding): method __init__ (line 223) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 227) | def _set_cos_sin_cache(self, seq_len, device, dtype): function rotate_half (line 247) | def rotate_half(x): function apply_rotary_pos_emb (line 255) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class InternLM2MLP (line 264) | class InternLM2MLP(nn.Module): method __init__ (line 265) | def __init__(self, config): method forward (line 275) | def forward(self, x): function repeat_kv (line 282) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class InternLM2Attention (line 295) | class InternLM2Attention(nn.Module): method __init__ (line 298) | def __init__(self, config: InternLM2Config): method _init_rope (line 324) | def _init_rope(self): method _shape (line 352) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 355) | def forward( class InternLM2FlashAttention2 (line 444) | class InternLM2FlashAttention2(InternLM2Attention): method forward (line 451) | def forward( method _flash_attention_forward (line 523) | def _flash_attention_forward( method _unpad_input (line 577) | def _unpad_input(self, query_layer, key_layer, value_layer, attention_... class InternLM2DecoderLayer (line 624) | class InternLM2DecoderLayer(nn.Module): method __init__ (line 625) | def __init__(self, config: InternLM2Config): method forward (line 635) | def forward( class InternLM2PreTrainedModel (line 720) | class InternLM2PreTrainedModel(PreTrainedModel): method _init_weights (line 728) | def _init_weights(self, module): class InternLM2Model (line 810) | class InternLM2Model(InternLM2PreTrainedModel): method __init__ (line 820) | def __init__(self, config: InternLM2Config): method get_input_embeddings (line 838) | def get_input_embeddings(self): method set_input_embeddings (line 841) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 844) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 868) | def forward( class InternLM2ForCausalLM (line 1002) | class InternLM2ForCausalLM(InternLM2PreTrainedModel): method __init__ (line 1007) | def __init__(self, config): method get_input_embeddings (line 1016) | def get_input_embeddings(self): method set_input_embeddings (line 1019) | def set_input_embeddings(self, value): method get_output_embeddings (line 1022) | def get_output_embeddings(self): method set_output_embeddings (line 1025) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1028) | def set_decoder(self, decoder): method get_decoder (line 1031) | def get_decoder(self): method forward (line 1036) | def forward( method prepare_inputs_for_generation (line 1126) | def prepare_inputs_for_generation( method _reorder_cache (line 1166) | def _reorder_cache(past_key_values, beam_idx): method build_inputs (line 1174) | def build_inputs(self, tokenizer, query: str, history: List[Tuple[str,... method chat (line 1187) | def chat( method stream_chat (line 1223) | def stream_chat( class InternLM2ForSequenceClassification (line 1325) | class InternLM2ForSequenceClassification(InternLM2PreTrainedModel): method __init__ (line 1326) | def __init__(self, config): method get_input_embeddings (line 1335) | def get_input_embeddings(self): method set_input_embeddings (line 1338) | def set_input_embeddings(self, value): method forward (line 1342) | def forward( FILE: internvl_chat/internvl/model/internlm2/tokenization_internlm2.py class InternLM2Tokenizer (line 34) | class InternLM2Tokenizer(PreTrainedTokenizer): method __init__ (line 48) | def __init__( method no_prefix_space_tokens (line 80) | def no_prefix_space_tokens(self): method vocab_size (line 87) | def vocab_size(self): method bos_token_id (line 92) | def bos_token_id(self) -> Optional[int]: method eos_token_id (line 96) | def eos_token_id(self) -> Optional[int]: method get_vocab (line 99) | def get_vocab(self): method _tokenize (line 105) | def _tokenize(self, text): method _convert_token_to_id (line 109) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 113) | def _convert_id_to_token(self, index): method _maybe_add_prefix_space (line 118) | def _maybe_add_prefix_space(self, tokens, decoded): method convert_tokens_to_string (line 124) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 145) | def save_vocabulary(self, save_directory, filename_prefix: Optional[st... method build_inputs_with_special_tokens (line 172) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method get_special_tokens_mask (line 188) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 215) | def create_token_type_ids_from_sequences( FILE: internvl_chat/internvl/model/internlm2/tokenization_internlm2_fast.py class InternLM2Converter (line 38) | class InternLM2Converter(SpmConverter): method vocab (line 41) | def vocab(self, proto): method unk_id (line 50) | def unk_id(self, proto): method decoder (line 54) | def decoder(self, replacement, add_prefix_space): method tokenizer (line 64) | def tokenizer(self, proto): method normalizer (line 92) | def normalizer(self, proto): method pre_tokenizer (line 99) | def pre_tokenizer(self, replacement, add_prefix_space): class InternLM2TokenizerFast (line 107) | class InternLM2TokenizerFast(PreTrainedTokenizerFast): method __init__ (line 114) | def __init__( method can_save_slow_tokenizer (line 147) | def can_save_slow_tokenizer(self) -> bool: method update_post_processor (line 150) | def update_post_processor(self): method add_eos_token (line 177) | def add_eos_token(self): method add_bos_token (line 181) | def add_bos_token(self): method add_eos_token (line 185) | def add_eos_token(self, value): method add_bos_token (line 190) | def add_bos_token(self, value): method save_vocabulary (line 194) | def save_vocabulary(self, save_directory: str, filename_prefix: Option... FILE: internvl_chat/internvl/model/internvl_chat/configuration_intern_vit.py class InternVisionConfig (line 16) | class InternVisionConfig(PretrainedConfig): method __init__ (line 64) | def __init__( method from_pretrained (line 108) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: internvl_chat/internvl/model/internvl_chat/configuration_internvl_chat.py class InternVLChatConfig (line 20) | class InternVLChatConfig(PretrainedConfig): method __init__ (line 24) | def __init__( method to_dict (line 86) | def to_dict(self): FILE: internvl_chat/internvl/model/internvl_chat/modeling_intern_vit.py class FlashAttention (line 35) | class FlashAttention(nn.Module): method __init__ (line 46) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 51) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... class InternRMSNorm (line 99) | class InternRMSNorm(nn.Module): method __init__ (line 100) | def __init__(self, hidden_size, eps=1e-6): method forward (line 105) | def forward(self, hidden_states): class InternVisionEmbeddings (line 133) | class InternVisionEmbeddings(nn.Module): method __init__ (line 134) | def __init__(self, config: InternVisionConfig): method _get_pos_embed (line 154) | def _get_pos_embed(self, pos_embed, H, W): method forward (line 162) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 177) | class InternAttention(nn.Module): method __init__ (line 180) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 210) | def _naive_attn(self, x): method _flash_attn (line 229) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 246) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 251) | class InternMLP(nn.Module): method __init__ (line 252) | def __init__(self, config: InternVisionConfig): method forward (line 259) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 266) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 267) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 283) | def forward( class InternVisionEncoder (line 298) | class InternVisionEncoder(nn.Module): method __init__ (line 308) | def __init__(self, config: InternVisionConfig): method forward (line 317) | def forward( class InternVisionModel (line 364) | class InternVisionModel(PreTrainedModel): method __init__ (line 371) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 378) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 390) | def get_input_embeddings(self): method forward (line 393) | def forward( FILE: internvl_chat/internvl/model/internvl_chat/modeling_internvl_chat.py function version_cmp (line 31) | def version_cmp(v1, v2, op='eq'): class InternVLChatModel (line 39) | class InternVLChatModel(PreTrainedModel): method __init__ (line 48) | def __init__(self, config: InternVLChatConfig, vision_model=None, lang... method wrap_backbone_lora (line 111) | def wrap_backbone_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method wrap_llm_lora (line 121) | def wrap_llm_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method forward (line 143) | def forward( method pixel_shuffle (line 257) | def pixel_shuffle(self, x, scale_factor=0.5): method extract_feature (line 273) | def extract_feature(self, pixel_values): method batch_chat (line 293) | def batch_chat(self, tokenizer, pixel_values, questions, generation_co... method chat (line 343) | def chat(self, tokenizer, pixel_values, question, generation_config, h... method generate (line 401) | def generate( method lm_head (line 443) | def lm_head(self): method get_input_embeddings (line 446) | def get_input_embeddings(self): method get_output_embeddings (line 449) | def get_output_embeddings(self): FILE: internvl_chat/internvl/model/phi3/configuration_phi3.py class Phi3Config (line 29) | class Phi3Config(PretrainedConfig): method __init__ (line 115) | def __init__( method _rope_scaling_validation (line 173) | def _rope_scaling_validation(self): FILE: internvl_chat/internvl/model/phi3/modeling_phi3.py class Phi3RMSNorm (line 78) | class Phi3RMSNorm(nn.Module): method __init__ (line 79) | def __init__(self, hidden_size, eps=1e-6): method forward (line 87) | def forward(self, hidden_states): function _get_unpad_data (line 96) | def _get_unpad_data(attention_mask): class Phi3RotaryEmbedding (line 109) | class Phi3RotaryEmbedding(nn.Module): method __init__ (line 110) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 119) | def forward(self, x, position_ids, seq_len=None): class Phi3SuScaledRotaryEmbedding (line 139) | class Phi3SuScaledRotaryEmbedding(Phi3RotaryEmbedding): method __init__ (line 140) | def __init__(self, dim, config, device=None): method forward (line 148) | def forward(self, x, position_ids, seq_len=None): class Phi3YarnScaledRotaryEmbedding (line 180) | class Phi3YarnScaledRotaryEmbedding(Phi3RotaryEmbedding): method __init__ (line 181) | def __init__(self, dim, config, device=None): method forward (line 189) | def forward(self, x, position_ids, seq_len=None): function rotate_half (line 222) | def rotate_half(x): function apply_rotary_pos_emb (line 230) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_di... class Phi3MLP (line 257) | class Phi3MLP(nn.Module): method __init__ (line 258) | def __init__(self, config): method forward (line 267) | def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor: function repeat_kv (line 277) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Phi3Attention (line 289) | class Phi3Attention(nn.Module): method __init__ (line 292) | def __init__(self, config: Phi3Config, layer_idx: Optional[int] = None): method _init_rope (line 326) | def _init_rope(self): method forward (line 342) | def forward( class Phi3FlashAttention2 (line 424) | class Phi3FlashAttention2(Phi3Attention): method __init__ (line 432) | def __init__(self, *args, **kwargs): method forward (line 440) | def forward( method _flash_attention_forward (line 589) | def _flash_attention_forward( method _upad_input (line 690) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class Phi3SdpaAttention (line 735) | class Phi3SdpaAttention(Phi3Attention): method forward (line 743) | def forward( class Phi3DecoderLayer (line 831) | class Phi3DecoderLayer(nn.Module): method __init__ (line 832) | def __init__(self, config: Phi3Config, layer_idx: int): method forward (line 845) | def forward( class Phi3PreTrainedModel (line 930) | class Phi3PreTrainedModel(PreTrainedModel): method __init__ (line 942) | def __init__(self, config: Phi3Config): method _init_weights (line 948) | def _init_weights(self, module): class Phi3Model (line 1034) | class Phi3Model(Phi3PreTrainedModel): method __init__ (line 1042) | def __init__(self, config: Phi3Config): method get_input_embeddings (line 1060) | def get_input_embeddings(self): method set_input_embeddings (line 1063) | def set_input_embeddings(self, value): method forward (line 1067) | def forward( class Phi3ForCausalLM (line 1204) | class Phi3ForCausalLM(Phi3PreTrainedModel): method __init__ (line 1208) | def __init__(self, config): method get_input_embeddings (line 1218) | def get_input_embeddings(self): method set_input_embeddings (line 1222) | def set_input_embeddings(self, value): method get_output_embeddings (line 1226) | def get_output_embeddings(self): method set_output_embeddings (line 1230) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1234) | def set_decoder(self, decoder): method get_decoder (line 1238) | def get_decoder(self): method forward (line 1244) | def forward( method prepare_inputs_for_generation (line 1332) | def prepare_inputs_for_generation( method _reorder_cache (line 1390) | def _reorder_cache(past_key_values, beam_idx): class Phi3ForSequenceClassification (line 1415) | class Phi3ForSequenceClassification(Phi3PreTrainedModel): method __init__ (line 1416) | def __init__(self, config): method get_input_embeddings (line 1425) | def get_input_embeddings(self): method set_input_embeddings (line 1428) | def set_input_embeddings(self, value): method forward (line 1432) | def forward( class Phi3ForTokenClassification (line 1531) | class Phi3ForTokenClassification(Phi3PreTrainedModel): method __init__ (line 1532) | def __init__(self, config: Phi3Config): method forward (line 1555) | def forward( FILE: internvl_chat/internvl/patch/internlm2_packed_training_patch.py class InternLM2FlashAttention2ForPackedTraining (line 15) | class InternLM2FlashAttention2ForPackedTraining(InternLM2FlashAttention2): method _flash_attention_forward (line 17) | def _flash_attention_forward( function replace_internlm2_attention_class (line 72) | def replace_internlm2_attention_class(): FILE: internvl_chat/internvl/patch/internvit_liger_monkey_patch.py function apply_liger_kernel_to_internvit (line 7) | def apply_liger_kernel_to_internvit() -> None: FILE: internvl_chat/internvl/patch/llama2_flash_attn_monkey_patch.py function apply_rotary_pos_emb (line 17) | def apply_rotary_pos_emb(q, k, cos_sin, position_ids): function forward (line 31) | def forward( function _prepare_decoder_attention_mask (line 107) | def _prepare_decoder_attention_mask( function replace_llama2_attn_with_flash_attn (line 131) | def replace_llama2_attn_with_flash_attn(): function test (line 143) | def test(): FILE: internvl_chat/internvl/patch/llama_flash_attn_monkey_patch.py function forward (line 17) | def forward( function _prepare_decoder_attention_mask (line 114) | def _prepare_decoder_attention_mask( function forward_2 (line 121) | def forward_2( function replace_llama_attn_with_flash_attn (line 215) | def replace_llama_attn_with_flash_attn(): FILE: internvl_chat/internvl/patch/llama_packed_training_patch.py class LlamaFlashAttention2ForPackedTraining (line 14) | class LlamaFlashAttention2ForPackedTraining(LlamaFlashAttention2): method _flash_attention_forward (line 16) | def _flash_attention_forward( function replace_llama_attention_class (line 104) | def replace_llama_attention_class(): FILE: internvl_chat/internvl/patch/llama_rmsnorm_monkey_patch.py function replace_llama_rmsnorm_with_fused_rmsnorm (line 10) | def replace_llama_rmsnorm_with_fused_rmsnorm(): FILE: internvl_chat/internvl/patch/pad_data_collator.py function pad_data_collator (line 13) | def pad_data_collator(features, pad_id=0): function concat_pad_data_collator (line 57) | def concat_pad_data_collator(features, max_item_length=None, pad_id=0): function dpo_concat_pad_data_collator (line 119) | def dpo_concat_pad_data_collator(features, pad_id=0): FILE: internvl_chat/internvl/patch/phi3_packed_training_patch.py class Phi3FlashAttention2ForPackedTraining (line 13) | class Phi3FlashAttention2ForPackedTraining(Phi3FlashAttention2): method _flash_attention_forward (line 15) | def _flash_attention_forward( function replace_phi3_attention_class (line 103) | def replace_phi3_attention_class(): FILE: internvl_chat/internvl/patch/qwen2_packed_training_patch.py class Qwen2FlashAttention2ForPackedTraining (line 14) | class Qwen2FlashAttention2ForPackedTraining(Qwen2FlashAttention2): method _flash_attention_forward (line 16) | def _flash_attention_forward( function replace_qwen2_attention_class (line 104) | def replace_qwen2_attention_class(): FILE: internvl_chat/internvl/patch/train_dataloader_patch.py function get_train_dataloader (line 14) | def get_train_dataloader(self) -> DataLoader: function replace_train_dataloader (line 51) | def replace_train_dataloader(): FILE: internvl_chat/internvl/patch/train_sampler_patch.py function split_to_even_chunks (line 19) | def split_to_even_chunks(indices, lengths, num_chunks): function get_length_grouped_indices (line 42) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 54) | class LengthGroupedSampler(Sampler): method __init__ (line 60) | def __init__( method __len__ (line 93) | def __len__(self): method __iter__ (line 96) | def __iter__(self): function _get_train_sampler (line 102) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: function replace_train_sampler (line 123) | def replace_train_sampler(): FILE: internvl_chat/internvl/train/dataset.py function calculate_ngram_repetition (line 43) | def calculate_ngram_repetition(text, n): function check_conversations_repetition (line 52) | def check_conversations_repetition(conversations, repeat_threshold=0.4, ... function get_frame_indices (line 61) | def get_frame_indices(num_frames, vlen, sample='rand', fix_start=None, i... function read_frames_gif (line 102) | def read_frames_gif( function read_frames_decord (line 126) | def read_frames_decord( function extract_frame_number (line 158) | def extract_frame_number(filename): function sort_frames (line 164) | def sort_frames(frame_paths): function read_frames_folder (line 169) | def read_frames_folder( class WeightedConcatDataset (line 199) | class WeightedConcatDataset(ConcatDataset): method __init__ (line 200) | def __init__(self, datasets, weights): method __iter__ (line 206) | def __iter__(self): method __len__ (line 209) | def __len__(self): function pil_loader (line 213) | def pil_loader(img_str): class TCSLoader (line 219) | class TCSLoader(object): method __init__ (line 221) | def __init__(self, conf_path, sc_config_key='sensecore'): method __call__ (line 228) | def __call__(self, fn, image_type='image', max_num_frames=-1, min_num_... function expand2square (line 247) | def expand2square(pil_img, background_color): function simulate_jpeg_degradation (line 261) | def simulate_jpeg_degradation(quality): function build_transform (line 276) | def build_transform(is_train, input_size, pad2square=False, normalize_ty... function preprocess (line 313) | def preprocess( function preprocess_mpt (line 418) | def preprocess_mpt( function preprocess_phi3 (line 512) | def preprocess_phi3( function preprocess_internlm (line 621) | def preprocess_internlm( function preprocess_internvl2_5 (line 711) | def preprocess_internvl2_5( function find_closest_aspect_ratio (line 813) | def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height... function dynamic_preprocess (line 830) | def dynamic_preprocess(image, min_num=1, max_num=6, image_size=448, use_... FILE: internvl_chat/internvl/train/dataset_packed.py function is_dist_avail_and_initialized (line 26) | def is_dist_avail_and_initialized(): function get_world_size (line 34) | def get_world_size(): function get_rank (line 40) | def get_rank(): class PackedDataset (line 46) | class PackedDataset(IterableDataset): method __init__ (line 47) | def __init__( method load_state_dict (line 142) | def load_state_dict(self, state_dict, custom_infos=None): method _should_log (line 154) | def _should_log(self): method next_data (line 163) | def next_data(self, current_dataset_idx): method find_buffer (line 210) | def find_buffer(self, buffer_list, new_sample): method update_buffer (line 234) | def update_buffer(self, buffer, new_sample): method check_valid (line 247) | def check_valid(sample_to_check, min_active_tokens_ratio=1/256): method split_buffer (line 253) | def split_buffer(buffer, max_tokens, img_start_token_id, img_token_id,... method update_buffer_list (line 339) | def update_buffer_list(self, buffer_list, buffer_max_len_list, buffer): method pad_buffer (line 376) | def pad_buffer(self, buffer): method postprocess_buffer (line 392) | def postprocess_buffer(self, buffer, custom_infos=None): method print_log (line 399) | def print_log(self, iter_idx, buffer_list): method __iter__ (line 408) | def __iter__(self): method get_cu_seqlens_and_indexes (line 517) | def get_cu_seqlens_and_indexes( function packed_collate_fn (line 551) | def packed_collate_fn( FILE: internvl_chat/internvl/train/internvl_chat_finetune.py class ModelArguments (line 88) | class ModelArguments: class DataTrainingArguments (line 163) | class DataTrainingArguments: class LazySupervisedDataset (line 269) | class LazySupervisedDataset(Dataset): method __init__ (line 272) | def __init__( method __len__ (line 384) | def __len__(self): method get_preprocess_function (line 387) | def get_preprocess_function(self): method load_image (line 401) | def load_image(self, image_path): method get_image_path (line 407) | def get_image_path(self, image_path): method get_transform (line 414) | def get_transform(self): method multi_modal_get_item (line 420) | def multi_modal_get_item(self, data_item): method multi_modal_multi_image_get_item (line 475) | def multi_modal_multi_image_get_item(self, data_item): method video_get_item (line 525) | def video_get_item(self, data_item): method pure_text_get_item (line 581) | def pure_text_get_item(self, data_item): method _enable_worker_distributed (line 624) | def _enable_worker_distributed(self): method __getitem__ (line 634) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: method __iter__ (line 681) | def __iter__(self): function build_datasets (line 701) | def build_datasets( function len2weight (line 786) | def len2weight(x, loss_reduction): function main (line 798) | def main(): FILE: internvl_chat/internvl/train/internvl_chat_mpo.py class ModelArguments (line 89) | class ModelArguments: class DataTrainingArguments (line 164) | class DataTrainingArguments: class DPOConfig (line 238) | class DPOConfig(DPOConfigTRL): class LazySupervisedDataset (line 245) | class LazySupervisedDataset(Dataset): method __init__ (line 248) | def __init__( method __len__ (line 338) | def __len__(self): method get_preprocess_function (line 341) | def get_preprocess_function(self): method load_image (line 355) | def load_image(self, image_path): method get_image_path (line 361) | def get_image_path(self, image_path): method get_transform (line 368) | def get_transform(self): method get_longest_common_prefix_index (line 375) | def get_longest_common_prefix_index(tensor1, tensor2): method multi_modal_get_item (line 384) | def multi_modal_get_item(self, data_item): method multi_modal_multi_image_get_item (line 456) | def multi_modal_multi_image_get_item(self, data_item): method video_get_item (line 527) | def video_get_item(self, data_item): method pure_text_get_item (line 606) | def pure_text_get_item(self, data_item): method __getitem__ (line 670) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: function build_datasets (line 712) | def build_datasets( function main (line 772) | def main(): FILE: internvl_chat/internvl/train/internvl_chat_pretrain.py class ModelArguments (line 88) | class ModelArguments: class DataTrainingArguments (line 163) | class DataTrainingArguments: class LazySupervisedDataset (line 269) | class LazySupervisedDataset(Dataset): method __init__ (line 272) | def __init__( method __len__ (line 424) | def __len__(self): method get_preprocess_function (line 430) | def get_preprocess_function(self): method load_image (line 444) | def load_image(self, image_path): method get_image_path (line 450) | def get_image_path(self, image_path): method get_transform (line 457) | def get_transform(self): method multi_modal_get_item (line 463) | def multi_modal_get_item(self, data_item): method multi_modal_multi_image_get_item (line 518) | def multi_modal_multi_image_get_item(self, data_item): method video_get_item (line 568) | def video_get_item(self, data_item): method pure_text_get_item (line 624) | def pure_text_get_item(self, data_item): method _enable_worker_distributed (line 667) | def _enable_worker_distributed(self): method __getitem__ (line 678) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: method __iter__ (line 725) | def __iter__(self): function build_datasets (line 745) | def build_datasets( function len2weight (line 830) | def len2weight(x, loss_reduction): function main (line 842) | def main(): FILE: internvl_chat/internvl/train/trainer_dpo.py function _map (line 18) | def _map(self, *args, **kwargs): class MultimodalDPOTrainer (line 25) | class MultimodalDPOTrainer(DPOTrainer): method __init__ (line 26) | def __init__(self, *args, **kwargs): method concatenated_inputs (line 33) | def concatenated_inputs( method concatenated_forward (line 99) | def concatenated_forward( method _prepare_deepspeed_orig (line 178) | def _prepare_deepspeed_orig(self, model): method _prepare_deepspeed (line 191) | def _prepare_deepspeed(self, model): method get_batch_loss_metrics (line 206) | def get_batch_loss_metrics( FILE: internvl_chat/tools/extract_video_frames.py function transform_video (line 22) | def transform_video(buffer): function get_index (line 37) | def get_index(num_frames, num_segments): function fetch_images (line 52) | def fetch_images(qa_item): function fetch_images_parallel (line 99) | def fetch_images_parallel(qa_item): FILE: internvl_chat/tools/images_stitching.py function custom_image (line 11) | def custom_image(img_paths, save_path, image_size=448): function get_images (line 54) | def get_images(ann_file): FILE: internvl_chat/tools/internvl_custom2hf.py function compute_l2_distance (line 13) | def compute_l2_distance(model1, model2): function convert_keys_to_hf (line 41) | def convert_keys_to_hf(custom_state_dict): FILE: internvl_chat/tools/internvl_hf2custom.py function compute_l2_distance (line 11) | def compute_l2_distance(model1, model2): function convert_keys_back (line 39) | def convert_keys_back(hf_state_dict): FILE: internvl_chat/tools/reasoning_data_pipeline/mmpr_data_pipeline_correctness.py function collate_fn (line 49) | def collate_fn(batches): class VQADataset (line 67) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 68) | def __init__( method __len__ (line 86) | def __len__(self): method multi_modal_get_item (line 89) | def multi_modal_get_item(self, item): method pure_text_get_item (line 122) | def pure_text_get_item(self, item): method __getitem__ (line 136) | def __getitem__(self, idx): function evaluate_chat_model (line 143) | def evaluate_chat_model(): FILE: internvl_chat/tools/reasoning_data_pipeline/mmpr_data_pipeline_correctness_postprocess.py function _build_items_based_on_correctness (line 22) | def _build_items_based_on_correctness(lines, mode): function build_neg_based_on_correctness (line 70) | def build_neg_based_on_correctness(lines, mode): function _build_pair_based_on_pos_neg (line 96) | def _build_pair_based_on_pos_neg(item_pos, item_neg): function build_pairs_based_on_pos_neg (line 125) | def build_pairs_based_on_pos_neg(pos_id2item, neg_id2item, allow_entailm... function save_items (line 164) | def save_items(items, save_path, question_only=False, all_incorrect_keys... function save_pairs (line 202) | def save_pairs(pairs, save_path): function main (line 269) | def main(args): FILE: internvl_chat/tools/reasoning_data_pipeline/mmpr_data_pipeline_dropout_ntp.py function collate_fn (line 46) | def collate_fn(batches): class VQADataset (line 61) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 62) | def __init__( method __len__ (line 80) | def __len__(self): method _truncate_prefix (line 83) | def _truncate_prefix(self, prefix): method __getitem__ (line 89) | def __getitem__(self, idx): function evaluate_chat_model (line 121) | def evaluate_chat_model(): FILE: internvl_chat/tools/reasoning_data_pipeline/utils/accuracy_reward.py class EvalAIAnswerProcessor (line 9) | class EvalAIAnswerProcessor: method __init__ (line 180) | def __init__(self, *args, **kwargs): method word_tokenize (line 183) | def word_tokenize(self, word): method process_punctuation (line 188) | def process_punctuation(self, in_text): method process_digit_article (line 200) | def process_digit_article(self, in_text): method __call__ (line 215) | def __call__(self, item): class TextVQAAccuracyEvaluator (line 223) | class TextVQAAccuracyEvaluator: method __init__ (line 224) | def __init__(self): method _compute_answer_scores (line 227) | def _compute_answer_scores(self, raw_answers): method eval_pred_list (line 250) | def eval_pred_list(self, pred_list, disable_tqdm=False): function isfloat (line 267) | def isfloat(x): function math_score (line 275) | def math_score(prediction: str, target: str, max_relative_change: float ... function relaxed_correctness (line 301) | def relaxed_correctness(target: str, function levenshtein_distance (line 347) | def levenshtein_distance(s1, s2): function multi_choice_score (line 363) | def multi_choice_score(answer_pred, answer_gt): function parse_answer (line 378) | def parse_answer(response, prompt_version): function extract_answer_from_mpo (line 395) | def extract_answer_from_mpo(response, version): function extract_answer_from_box (line 419) | def extract_answer_from_box(ans): function check_cot_format (line 446) | def check_cot_format(response: str): function check_r1_format (line 450) | def check_r1_format(response: str): function check_answer (line 467) | def check_answer(answer_pred, answer_gt, mode): function fix_answer (line 531) | def fix_answer(response, answer_pred, answer_gt): function contain_keywords (line 561) | def contain_keywords(ds_name, keywords): function post_process (line 568) | def post_process(pred): function get_mode (line 583) | def get_mode(ds_name): function use_latex_score (line 599) | def use_latex_score(x): function validate_latex (line 612) | def validate_latex(pred, gt, easy_mode=False): function latex_score (line 650) | def latex_score(prediction, target): FILE: internvl_chat/tools/reasoning_data_pipeline/utils/utils.py function localtime (line 11) | def localtime(): function init_distributed_mode (line 15) | def init_distributed_mode(): function init_dist (line 51) | def init_dist(args): function get_global_min (line 90) | def get_global_min(value): function save_outputs (line 98) | def save_outputs(outputs, results_file): function load_outputs (line 120) | def load_outputs(results_file): class InferenceSampler (line 127) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 129) | def __init__(self, size): method _get_local_indices (line 137) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 146) | def __iter__(self): method __len__ (line 149) | def __len__(self): FILE: internvl_chat/tools/reasoning_data_pipeline/visualprm_data_pieline.py function collate_fn (line 53) | def collate_fn(batches): class VQADataset (line 63) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 64) | def __init__( method __len__ (line 78) | def __len__(self): method __getitem__ (line 81) | def __getitem__(self, idx): function split_response (line 116) | def split_response(response, sep='\n\n', max_steps=None): function join_steps (line 129) | def join_steps(steps, sep='\n\n'): function build_responses (line 133) | def build_responses(inputs, num_return_sequences=1, prefixes=None): function build_mc_scores (line 174) | def build_mc_scores(inputs, response_list, items, num_return_sequences): function build_process_supervision (line 254) | def build_process_supervision(inputs, items, num_return_sequences): function print_process_supervision (line 272) | def print_process_supervision(output): function evaluate_chat_model (line 287) | def evaluate_chat_model(): FILE: internvl_chat/tools/reasoning_data_pipeline/visualprm_data_pipeline_postprocess.py function save_outputs (line 10) | def save_outputs(outputs, results_file): function item2conv_prm (line 20) | def item2conv_prm(item): function item2conv_orm (line 47) | def item2conv_orm(item): function main (line 74) | def main(): FILE: internvl_chat_gpt_oss/internvl/dist_utils.py function _find_free_port (line 14) | def _find_free_port(): function _is_free_port (line 25) | def _is_free_port(port): function init_dist (line 32) | def init_dist(launcher, backend='nccl', **kwargs): function _init_dist_pytorch (line 45) | def _init_dist_pytorch(backend, **kwargs): function _init_dist_mpi (line 61) | def _init_dist_mpi(backend, **kwargs): function _init_dist_slurm (line 74) | def _init_dist_slurm(backend, port=None): FILE: internvl_chat_gpt_oss/internvl/model/internvl_chat/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 107) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: internvl_chat_gpt_oss/internvl/model/internvl_chat/configuration_internvl_chat.py class InternVLChatConfig (line 18) | class InternVLChatConfig(PretrainedConfig): method __init__ (line 22) | def __init__( method to_dict (line 95) | def to_dict(self): FILE: internvl_chat_gpt_oss/internvl/model/internvl_chat/conversation.py class SeparatorStyle (line 15) | class SeparatorStyle(IntEnum): class Conversation (line 40) | class Conversation: method get_prompt (line 64) | def get_prompt(self) -> str: method set_system_message (line 271) | def set_system_message(self, system_message: str): method append_message (line 275) | def append_message(self, role: str, message: str): method update_last_message (line 279) | def update_last_message(self, message: str): method to_gradio_chatbot (line 287) | def to_gradio_chatbot(self): method to_openai_api_messages (line 297) | def to_openai_api_messages(self): method copy (line 309) | def copy(self): method dict (line 324) | def dict(self): function register_conv_template (line 338) | def register_conv_template(template: Conversation, override: bool = False): function get_conv_template (line 348) | def get_conv_template(name: str) -> Conversation: FILE: internvl_chat_gpt_oss/internvl/model/internvl_chat/modeling_intern_vit.py class FlashAttention (line 35) | class FlashAttention(nn.Module): method __init__ (line 46) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 51) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... class InternRMSNorm (line 99) | class InternRMSNorm(nn.Module): method __init__ (line 100) | def __init__(self, hidden_size, eps=1e-6): method forward (line 105) | def forward(self, hidden_states): class InternVisionEmbeddings (line 133) | class InternVisionEmbeddings(nn.Module): method __init__ (line 134) | def __init__(self, config: InternVisionConfig): method _get_pos_embed (line 154) | def _get_pos_embed(self, pos_embed, H, W): method forward (line 162) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 177) | class InternAttention(nn.Module): method __init__ (line 180) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 210) | def _naive_attn(self, x): method _flash_attn (line 229) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 246) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 251) | class InternMLP(nn.Module): method __init__ (line 252) | def __init__(self, config: InternVisionConfig): method forward (line 259) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 266) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 267) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 283) | def forward( class InternVisionEncoder (line 298) | class InternVisionEncoder(nn.Module): method __init__ (line 307) | def __init__(self, config: InternVisionConfig): method forward (line 316) | def forward( class InternVisionModel (line 363) | class InternVisionModel(PreTrainedModel): method __init__ (line 370) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 377) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 389) | def get_input_embeddings(self): method forward (line 392) | def forward( FILE: internvl_chat_gpt_oss/internvl/model/internvl_chat/modeling_internvl_chat.py function version_cmp (line 29) | def version_cmp(v1, v2, op='eq'): class InternVLChatModel (line 37) | class InternVLChatModel(PreTrainedModel): method __init__ (line 56) | def __init__(self, config: InternVLChatConfig, vision_model=None, lang... method forward (line 100) | def forward( method pixel_shuffle (line 278) | def pixel_shuffle(self, x, scale_factor=0.5): method extract_feature (line 294) | def extract_feature(self, pixel_values): method batch_chat (line 314) | def batch_chat(self, tokenizer, pixel_values, questions, generation_co... method chat (line 366) | def chat(self, tokenizer, pixel_values, question, generation_config, h... method generate (line 426) | def generate( method lm_head (line 468) | def lm_head(self): method get_output_embeddings (line 471) | def get_output_embeddings(self): method get_input_embeddings (line 474) | def get_input_embeddings(self): method set_input_embeddings (line 477) | def set_input_embeddings(self, value): method set_output_embeddings (line 480) | def set_output_embeddings(self, value): FILE: internvl_chat_gpt_oss/internvl/patch/flash_sink_attn/flash_attn_with_sink.py class FlashAttentionWithSink (line 14) | class FlashAttentionWithSink(torch.autograd.Function): method forward (line 17) | def forward( method backward (line 77) | def backward(ctx, grad_output): function flash_attn_with_sink_func (line 186) | def flash_attn_with_sink_func( FILE: internvl_chat_gpt_oss/internvl/patch/flash_sink_attn/flash_sink_attn.py function _bwd_preprocess_do_o_dot (line 19) | def _bwd_preprocess_do_o_dot( function init_to_zero (line 77) | def init_to_zero(name): function _fwd_kernel (line 82) | def _fwd_kernel( function _bwd_kernel (line 169) | def _bwd_kernel( function _flash_attn_forward (line 263) | def _flash_attn_forward( function _flash_attn_backward (line 314) | def _flash_attn_backward( class FlashSinkAttention (line 377) | class FlashSinkAttention(torch.autograd.Function): method forward (line 380) | def forward( method backward (line 404) | def backward(ctx, do): FILE: internvl_chat_gpt_oss/internvl/patch/flash_sink_attn/flash_sink_attn_gpt_oss.py function _bwd_preprocess_do_o_dot (line 19) | def _bwd_preprocess_do_o_dot( function init_to_zero (line 77) | def init_to_zero(name): function _fwd_kernel (line 82) | def _fwd_kernel( function _bwd_kernel (line 200) | def _bwd_kernel( function _flash_attn_forward (line 333) | def _flash_attn_forward( function _flash_attn_backward (line 383) | def _flash_attn_backward( class FlashSinkAttention (line 446) | class FlashSinkAttention(torch.autograd.Function): method forward (line 449) | def forward( method backward (line 473) | def backward(ctx, do): FILE: internvl_chat_gpt_oss/internvl/patch/flash_sink_attn/flash_sink_varlen_attn_gpt_oss.py function _bwd_preprocess_do_o_dot (line 18) | def _bwd_preprocess_do_o_dot( function init_to_zero (line 62) | def init_to_zero(name): function _fwd_kernel (line 67) | def _fwd_kernel( function _bwd_kernel (line 185) | def _bwd_kernel( function _flash_attn_forward (line 314) | def _flash_attn_forward( function _flash_attn_backward (line 363) | def _flash_attn_backward( class FlashSinkVarlenAttention (line 426) | class FlashSinkVarlenAttention(torch.autograd.Function): method forward (line 428) | def forward( method backward (line 454) | def backward(ctx, do): FILE: internvl_chat_gpt_oss/internvl/patch/flash_sink_attn/sliding_cache.py class SlidingCacheManager (line 12) | class SlidingCacheManager: method __init__ (line 16) | def __init__( method reset (line 25) | def reset(self): method update (line 30) | def update(self, key, val): FILE: internvl_chat_gpt_oss/internvl/patch/flash_sink_attn_monkey_patch.py function _forward_gpt_oss (line 17) | def _forward_gpt_oss( function _forward_gpt_oss_with_varlen (line 64) | def _forward_gpt_oss_with_varlen( function replace_gpt_oss_with_flash_sink_attn (line 125) | def replace_gpt_oss_with_flash_sink_attn(model, use_varlen=False): FILE: internvl_chat_gpt_oss/internvl/patch/pad_data_collator.py function pad_data_collator (line 13) | def pad_data_collator(features, pad_id=0): function concat_pad_data_collator (line 57) | def concat_pad_data_collator(features, max_item_length=None, pad_id=0): function dpo_concat_pad_data_collator (line 119) | def dpo_concat_pad_data_collator(features, pad_id=0): FILE: internvl_chat_gpt_oss/internvl/patch/qwen3_flash_monkey_patch.py function _forward_qwen3 (line 16) | def _forward_qwen3( function replace_qwen3_attention_class (line 91) | def replace_qwen3_attention_class(model): FILE: internvl_chat_gpt_oss/internvl/patch/train_dataloader_patch.py function _get_dataloader (line 16) | def _get_dataloader( function replace_train_dataloader (line 67) | def replace_train_dataloader(): FILE: internvl_chat_gpt_oss/internvl/train/dataset.py function calculate_ngram_repetition (line 38) | def calculate_ngram_repetition(text, n): function check_conversations_repetition (line 47) | def check_conversations_repetition(conversations, repeat_threshold=0.4, ... function get_frame_indices (line 56) | def get_frame_indices(num_frames, vlen, sample='rand', fix_start=None, i... function read_frames_gif (line 97) | def read_frames_gif( function read_frames_decord (line 121) | def read_frames_decord( function extract_frame_number (line 153) | def extract_frame_number(filename): function sort_frames (line 159) | def sort_frames(frame_paths): function read_frames_folder (line 164) | def read_frames_folder( class WeightedConcatDataset (line 194) | class WeightedConcatDataset(ConcatDataset): method __init__ (line 195) | def __init__(self, datasets, weights): method __iter__ (line 201) | def __iter__(self): method __len__ (line 204) | def __len__(self): function pil_loader (line 208) | def pil_loader(img_str): class TCSLoader (line 214) | class TCSLoader(object): method __init__ (line 216) | def __init__(self, conf_path, sc_config_key='sensecore'): method __call__ (line 223) | def __call__(self, fn, image_type='image', max_num_frames=-1, min_num_... function expand2square (line 242) | def expand2square(pil_img, background_color): function simulate_jpeg_degradation (line 256) | def simulate_jpeg_degradation(quality): function build_transform (line 271) | def build_transform(is_train, input_size, pad2square=False, normalize_ty... function preprocess_pretrain (line 308) | def preprocess_pretrain( function preprocess_internvl2_5 (line 389) | def preprocess_internvl2_5( function preprocess_internvl3_5_gpt_oss (line 491) | def preprocess_internvl3_5_gpt_oss( function preprocess_internvl3_5_gpt_oss_with_think (line 597) | def preprocess_internvl3_5_gpt_oss_with_think( function find_closest_aspect_ratio (line 712) | def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height... function dynamic_preprocess (line 729) | def dynamic_preprocess(image, min_num=1, max_num=6, image_size=448, use_... FILE: internvl_chat_gpt_oss/internvl/train/dataset_packed.py function is_dist_avail_and_initialized (line 26) | def is_dist_avail_and_initialized(): function get_rank (line 34) | def get_rank(): class PackedDataset (line 40) | class PackedDataset(IterableDataset): method __init__ (line 41) | def __init__( method load_state_dict (line 136) | def load_state_dict(self, state_dict, custom_infos=None): method _should_log (line 148) | def _should_log(self): method next_data (line 157) | def next_data(self, current_dataset_idx): method find_buffer (line 204) | def find_buffer(self, buffer_list, new_sample): method update_buffer (line 228) | def update_buffer(self, buffer, new_sample): method check_valid (line 241) | def check_valid(sample_to_check, min_active_tokens_ratio=1/256): method split_buffer (line 247) | def split_buffer(buffer, max_tokens, img_start_token_id, img_token_id,... method update_buffer_list (line 333) | def update_buffer_list(self, buffer_list, buffer_max_len_list, buffer): method pad_buffer (line 370) | def pad_buffer(self, buffer): method postprocess_buffer (line 386) | def postprocess_buffer(self, buffer, custom_infos=None): method print_log (line 393) | def print_log(self, iter_idx, buffer_list): method __iter__ (line 402) | def __iter__(self): method get_cu_seqlens_and_indexes (line 511) | def get_cu_seqlens_and_indexes( function packed_collate_fn (line 548) | def packed_collate_fn( FILE: internvl_chat_gpt_oss/internvl/train/internvl_chat_finetune.py class ModelArguments (line 76) | class ModelArguments: class DataTrainingArguments (line 155) | class DataTrainingArguments: class LazySupervisedDataset (line 257) | class LazySupervisedDataset(Dataset): method __init__ (line 260) | def __init__( method __len__ (line 391) | def __len__(self): method get_preprocess_function (line 394) | def get_preprocess_function(self, use_pretrain=False): method load_image (line 407) | def load_image(self, image_path): method get_image_path (line 413) | def get_image_path(self, image_path): method get_transform (line 418) | def get_transform(self): method multi_modal_get_item (line 428) | def multi_modal_get_item(self, data_item): method multi_modal_multi_image_get_item (line 485) | def multi_modal_multi_image_get_item(self, data_item): method video_get_item (line 541) | def video_get_item(self, data_item): method pure_text_get_item (line 599) | def pure_text_get_item(self, data_item): method fake_data_get_item (line 642) | def fake_data_get_item(self): method _enable_worker_distributed (line 690) | def _enable_worker_distributed(self): method __getitem__ (line 700) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: method __iter__ (line 749) | def __iter__(self): function build_datasets (line 769) | def build_datasets( function len2weight (line 849) | def len2weight(x, loss_reduction): function main (line 861) | def main(): FILE: internvl_chat_gpt_oss/internvl/train/internvl_chat_mpo.py class ModelArguments (line 95) | class ModelArguments: class DataTrainingArguments (line 162) | class DataTrainingArguments: class LazySupervisedDataset (line 236) | class LazySupervisedDataset(Dataset): method __init__ (line 239) | def __init__( method __len__ (line 343) | def __len__(self): method get_preprocess_function (line 346) | def get_preprocess_function(self, use_pretrain=False): method load_image (line 359) | def load_image(self, image_path): method get_image_path (line 365) | def get_image_path(self, image_path): method get_transform (line 370) | def get_transform(self): method multi_modal_get_item (line 380) | def multi_modal_get_item(self, data_item): method multi_modal_multi_image_get_item (line 483) | def multi_modal_multi_image_get_item(self, data_item): method video_get_item (line 585) | def video_get_item(self, data_item): method pure_text_get_item (line 696) | def pure_text_get_item(self, data_item): method __getitem__ (line 791) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: function build_datasets (line 837) | def build_datasets( function main (line 890) | def main(): FILE: internvl_chat_gpt_oss/internvl/train/trainer_dpo.py function _map (line 17) | def _map(self, *args, **kwargs): class InternVLDPOTrainer (line 25) | class InternVLDPOTrainer(DPOTrainer): method concatenated_inputs (line 27) | def concatenated_inputs( method concatenated_forward (line 37) | def concatenated_forward( FILE: internvl_chat_gpt_oss/internvl/utils/s3_config.py function _value_to_str (line 30) | def _value_to_str(d): class GetterMixin (line 40) | class GetterMixin(object): method get (line 45) | def get(self, key, default=_UNSET): method has_option (line 54) | def has_option(self, key): method get_boolean (line 61) | def get_boolean(self, key, default=_UNSET): method get_int (line 68) | def get_int(self, key, default=_UNSET): method get_log_level (line 74) | def get_log_level(self, key, default=_UNSET): class _my_dict (line 81) | class _my_dict(configparser._default_dict): class Config (line 85) | class Config(GetterMixin): method __init__ (line 86) | def __init__(self, conf_path, *args, **kwargs): method __getitem__ (line 109) | def __getitem__(self, key): method update (line 115) | def update(self, other: dict): method default (line 119) | def default(self): method items (line 122) | def items(self): class Section (line 129) | class Section(GetterMixin): method __init__ (line 131) | def __init__(self, conf: dict): method __getitem__ (line 135) | def __getitem__(self, key): method update (line 141) | def update(self, other): FILE: internvl_chat_gpt_oss/internvl/utils/s3_exception.py class Error (line 4) | class Error(Exception): method __str__ (line 7) | def __str__(self): class RetriableError (line 13) | class RetriableError(Error): class ConfigError (line 20) | class ConfigError(Error): class InvalidConfigError (line 24) | class InvalidConfigError(ConfigError): class ConfigFileNotFoundError (line 28) | class ConfigFileNotFoundError(ConfigError): class ConfigItemNotFoundError (line 32) | class ConfigItemNotFoundError(ConfigError): class ConfigKeyNotFoundError (line 36) | class ConfigKeyNotFoundError(ConfigItemNotFoundError): class ConfigSectionNotFoundError (line 40) | class ConfigSectionNotFoundError(ConfigItemNotFoundError): class ConfigKeyTypeError (line 44) | class ConfigKeyTypeError(ConfigError): class ConfigKeyValueError (line 48) | class ConfigKeyValueError(ConfigError): class UnSupprotAddressStyle (line 52) | class UnSupprotAddressStyle(ConfigError): class ClientError (line 59) | class ClientError(Error): class ContentTypeError (line 63) | class ContentTypeError(ClientError): class S3ClientError (line 67) | class S3ClientError(ClientError): class InvalidAccessKeyError (line 71) | class InvalidAccessKeyError(S3ClientError): class SignatureNotMatchError (line 75) | class SignatureNotMatchError(S3ClientError): class NetworkConnectionError (line 79) | class NetworkConnectionError(S3ClientError): class ResourceNotFoundError (line 83) | class ResourceNotFoundError(S3ClientError): class AccessDeniedError (line 87) | class AccessDeniedError(ClientError): class RangeError (line 91) | class RangeError(ClientError): class MultipartError (line 95) | class MultipartError(ClientError): class ObjectNotFoundError (line 99) | class ObjectNotFoundError(ClientError): class S3ObjectNotFoundError (line 103) | class S3ObjectNotFoundError(ObjectNotFoundError): class NoSuchBucketError (line 107) | class NoSuchBucketError(S3ObjectNotFoundError): class NoSuchKeyError (line 111) | class NoSuchKeyError(S3ObjectNotFoundError): class CacheError (line 118) | class CacheError(ClientError): class McClientError (line 122) | class McClientError(CacheError): class McObjectNotFoundError (line 126) | class McObjectNotFoundError(ObjectNotFoundError, McClientError): class McTimeoutOccur (line 130) | class McTimeoutOccur(McClientError, RetriableError): class McConnFailed (line 134) | class McConnFailed(McClientError, RetriableError): class McServerFailed (line 138) | class McServerFailed(McClientError, RetriableError): class McServerDisable (line 142) | class McServerDisable(McClientError): class McServerDead (line 146) | class McServerDead(McClientError): class McBadKeyProvided (line 150) | class McBadKeyProvided(McClientError): class McKeySizeExceed (line 154) | class McKeySizeExceed(McClientError): class McObjectSizeExceed (line 158) | class McObjectSizeExceed(McClientError): class InvalidUriError (line 165) | class InvalidUriError(Error): class InvalidS3UriError (line 169) | class InvalidS3UriError(InvalidUriError): class InvalidBucketUriError (line 173) | class InvalidBucketUriError(InvalidS3UriError): class InvalidDfsUriError (line 177) | class InvalidDfsUriError(InvalidUriError): class InvalidMcUriError (line 181) | class InvalidMcUriError(InvalidUriError): class InvalidClusterNameError (line 185) | class InvalidClusterNameError(InvalidUriError): class NoDefaultClusterNameError (line 189) | class NoDefaultClusterNameError(InvalidUriError): FILE: internvl_chat_gpt_oss/internvl/utils/s3_fileio.py class S3Backend (line 26) | class S3Backend(BaseStorageBackend): method __init__ (line 45) | def __init__(self, method _map_path (line 76) | def _map_path(self, filepath: Union[str, Path]) -> str: method _format_path (line 89) | def _format_path(self, filepath: str) -> str: method _parse_path (line 102) | def _parse_path(self, filepath: Union[str, Path]) -> Tuple[str, str]: method _check_bucket (line 121) | def _check_bucket(self, bucket: str) -> bool: method _check_object (line 136) | def _check_object(self, bucket: str, obj_name: str) -> bool: method get (line 151) | def get(self, filepath: str) -> bytes: method get_text (line 170) | def get_text(self, filepath, encoding='utf-8') -> str: method put (line 188) | def put(self, obj: bytes, filepath: Union[str, Path]) -> None: method put_text (line 201) | def put_text(self, method remove (line 215) | def remove(self, filepath: Union[str, Path]) -> None: method exists (line 224) | def exists(self, filepath: Union[str, Path]) -> bool: method isdir (line 235) | def isdir(self, filepath: Union[str, Path]) -> bool: method isfile (line 251) | def isfile(self, filepath: Union[str, Path]) -> bool: method get_local_path (line 267) | def get_local_path( method list (line 297) | def list(self, class MixedClient (line 421) | class MixedClient(object): method __init__ (line 422) | def __init__(self, conf_path, **kwargs): method parse_uri (line 443) | def parse_uri(uri, ceph_dict, default_cluster=None): method get_with_info (line 470) | def get_with_info(self, uri, **kwargs): method list (line 480) | def list(self, uri, **kwargs): class Client (line 487) | class Client(object): method __init__ (line 489) | def __init__(self, conf_path='petreloss.conf', *args, **kwargs): method _get_local_client (line 497) | def _get_local_client(self): method get_with_info (line 513) | def get_with_info(self, uri, **kwargs): method get (line 516) | def get(self, *args, **kwargs): method list (line 520) | def list(self, *args, **kwargs): FILE: internvl_chat_llava/llava/conversation.py class SeparatorStyle (line 6) | class SeparatorStyle(Enum): class Conversation (line 18) | class Conversation: method get_prompt (line 35) | def get_prompt(self): method append_message (line 133) | def append_message(self, role, message): method get_images (line 136) | def get_images(self, return_pil=False, return_org=False): method to_gradio_chatbot (line 197) | def to_gradio_chatbot(self): method copy (line 228) | def copy(self): method dict (line 242) | def dict(self): FILE: internvl_chat_llava/llava/eval/eval_gpt_review.py function get_eval (line 13) | def get_eval(content: str, max_tokens: int): function parse_score (line 39) | def parse_score(review): FILE: internvl_chat_llava/llava/eval/eval_gpt_review_bench.py function get_eval (line 11) | def get_eval(content: str, max_tokens: int): function parse_score (line 36) | def parse_score(review): FILE: internvl_chat_llava/llava/eval/eval_gpt_review_visual.py function get_eval (line 11) | def get_eval(content: str, max_tokens: int): function parse_score (line 36) | def parse_score(review): FILE: internvl_chat_llava/llava/eval/eval_pope.py function eval_pope (line 5) | def eval_pope(answers, label_file): FILE: internvl_chat_llava/llava/eval/eval_science_qa.py function get_args (line 8) | def get_args(): function convert_caps (line 19) | def convert_caps(results): function get_pred_idx (line 28) | def get_pred_idx(prediction, choices, options): FILE: internvl_chat_llava/llava/eval/eval_science_qa_gpt4.py function get_args (line 9) | def get_args(): function convert_caps (line 19) | def convert_caps(results): function get_pred_idx (line 28) | def get_pred_idx(prediction, choices, options): FILE: internvl_chat_llava/llava/eval/eval_science_qa_gpt4_requery.py function get_args (line 9) | def get_args(): function convert_caps (line 21) | def convert_caps(results): function get_pred_idx (line 30) | def get_pred_idx(prediction, choices, options): FILE: internvl_chat_llava/llava/eval/eval_textvqa.py function get_args (line 9) | def get_args(): function prompt_processor (line 17) | def prompt_processor(prompt): function eval_single (line 35) | def eval_single(annotation_file, result_file): FILE: internvl_chat_llava/llava/eval/generate_webpage_data_from_table.py function read_jsonl (line 10) | def read_jsonl(path: str, key: str=None): function trim_hanging_lines (line 23) | def trim_hanging_lines(s: str, n: int) -> str: FILE: internvl_chat_llava/llava/eval/m4c_evaluator.py class EvalAIAnswerProcessor (line 7) | class EvalAIAnswerProcessor: method __init__ (line 178) | def __init__(self, *args, **kwargs): method word_tokenize (line 181) | def word_tokenize(self, word): method process_punctuation (line 186) | def process_punctuation(self, in_text): method process_digit_article (line 198) | def process_digit_article(self, in_text): method __call__ (line 213) | def __call__(self, item): class TextVQAAccuracyEvaluator (line 221) | class TextVQAAccuracyEvaluator: method __init__ (line 222) | def __init__(self): method _compute_answer_scores (line 225) | def _compute_answer_scores(self, raw_answers): method eval_pred_list (line 248) | def eval_pred_list(self, pred_list): class STVQAAccuracyEvaluator (line 260) | class STVQAAccuracyEvaluator: method __init__ (line 261) | def __init__(self): method eval_pred_list (line 264) | def eval_pred_list(self, pred_list): class STVQAANLSEvaluator (line 276) | class STVQAANLSEvaluator: method __init__ (line 277) | def __init__(self): method get_anls (line 282) | def get_anls(self, s1, s2): method eval_pred_list (line 289) | def eval_pred_list(self, pred_list): class TextCapsBleu4Evaluator (line 301) | class TextCapsBleu4Evaluator: method __init__ (line 302) | def __init__(self): method eval_pred_list (line 321) | def eval_pred_list(self, pred_list): FILE: internvl_chat_llava/llava/eval/model_qa.py class KeywordsStoppingCriteria (line 14) | class KeywordsStoppingCriteria(StoppingCriteria): method __init__ (line 15) | def __init__(self, keywords, tokenizer, input_ids): method __call__ (line 21) | def __call__(self, output_ids: torch.LongTensor, scores: torch.FloatTe... function eval_model (line 33) | def eval_model(model_name, questions_file, answers_file): FILE: internvl_chat_llava/llava/eval/model_vqa.py function split_list (line 18) | def split_list(lst, n): function get_chunk (line 24) | def get_chunk(lst, n, k): function eval_model (line 29) | def eval_model(args): FILE: internvl_chat_llava/llava/eval/model_vqa_loader.py function split_list (line 19) | def split_list(lst, n): function get_chunk (line 25) | def get_chunk(lst, n, k): class CustomDataset (line 31) | class CustomDataset(Dataset): method __init__ (line 32) | def __init__(self, questions, image_folder, tokenizer, image_processor... method __getitem__ (line 39) | def __getitem__(self, index): method __len__ (line 60) | def __len__(self): function create_data_loader (line 65) | def create_data_loader(questions, image_folder, tokenizer, image_process... function eval_model (line 72) | def eval_model(args): FILE: internvl_chat_llava/llava/eval/model_vqa_mmbench.py function split_list (line 22) | def split_list(lst, n): function get_chunk (line 28) | def get_chunk(lst, n, k): function is_none (line 33) | def is_none(value): function get_options (line 44) | def get_options(row, options): function eval_model (line 54) | def eval_model(args): FILE: internvl_chat_llava/llava/eval/model_vqa_science.py function split_list (line 18) | def split_list(lst, n): function get_chunk (line 24) | def get_chunk(lst, n, k): function eval_model (line 29) | def eval_model(args): FILE: internvl_chat_llava/llava/eval/qa_baseline_gpt35.py function get_answer (line 16) | def get_answer(question_id: int, question: str, max_tokens: int): FILE: internvl_chat_llava/llava/eval/run_llava.py function load_image (line 17) | def load_image(image_file): function eval_model (line 26) | def eval_model(args): FILE: internvl_chat_llava/llava/eval/summarize_gpt_review.py function parse_args (line 9) | def parse_args(): FILE: internvl_chat_llava/llava/eval/webpage/script.js function text2Markdown (line 35) | function text2Markdown(text) { function capitalizeFirstChar (line 41) | function capitalizeFirstChar(str) { function updateQuestionSelect (line 48) | function updateQuestionSelect(question_id) { function updateModelSelect (line 64) | function updateModelSelect() { function populateModels (line 70) | function populateModels(models) { function populateQuestions (line 81) | function populateQuestions(questions) { function displayQuestion (line 110) | function displayQuestion(index) { function displayAnswers (line 116) | function displayAnswers(index) { function switchQuestionAndCategory (line 203) | function switchQuestionAndCategory() { function updateExpandButtonVisibility (line 226) | function updateExpandButtonVisibility(card) { FILE: internvl_chat_llava/llava/mm_utils.py function load_image_from_base64 (line 10) | def load_image_from_base64(image): function expand2square (line 14) | def expand2square(pil_img, background_color): function process_images (line 28) | def process_images(images, image_processor, model_cfg): function tokenizer_image_token (line 43) | def tokenizer_image_token(prompt, tokenizer, image_token_index=IMAGE_TOK... function get_model_name_from_path (line 71) | def get_model_name_from_path(model_path): class KeywordsStoppingCriteria (line 82) | class KeywordsStoppingCriteria(StoppingCriteria): method __init__ (line 83) | def __init__(self, keywords, tokenizer, input_ids): method __call__ (line 97) | def __call__(self, output_ids: torch.LongTensor, scores: torch.FloatTe... FILE: internvl_chat_llava/llava/model/apply_delta.py function apply_delta (line 13) | def apply_delta(base_model_path, target_model_path, delta_path): FILE: internvl_chat_llava/llava/model/builder.py function load_pretrained_model (line 26) | def load_pretrained_model(model_path, model_base, model_name, load_8bit=... FILE: internvl_chat_llava/llava/model/consolidate.py function consolidate_ckpt (line 13) | def consolidate_ckpt(src_path, dst_path): FILE: internvl_chat_llava/llava/model/language_model/llava_llama.py class LlavaConfig (line 30) | class LlavaConfig(LlamaConfig): class LlavaLlamaModel (line 34) | class LlavaLlamaModel(LlavaMetaModel, LlamaModel): method __init__ (line 37) | def __init__(self, config: LlamaConfig): class LlavaLlamaForCausalLM (line 41) | class LlavaLlamaForCausalLM(LlamaForCausalLM, LlavaMetaForCausalLM): method __init__ (line 44) | def __init__(self, config): method get_model (line 53) | def get_model(self): method forward (line 56) | def forward( method prepare_inputs_for_generation (line 117) | def prepare_inputs_for_generation( FILE: internvl_chat_llava/llava/model/language_model/llava_mpt.py class LlavaMptConfig (line 25) | class LlavaMptConfig(MptConfig): class LlavaMptModel (line 29) | class LlavaMptModel(LlavaMetaModel, MptModel): method __init__ (line 32) | def __init__(self, config: MptConfig): method embed_tokens (line 36) | def embed_tokens(self, x): class LlavaMptForCausalLM (line 40) | class LlavaMptForCausalLM(MptForCausalLM, LlavaMetaForCausalLM): method __init__ (line 44) | def __init__(self, config): method get_model (line 53) | def get_model(self): method _set_gradient_checkpointing (line 56) | def _set_gradient_checkpointing(self, module, value=False): method forward (line 60) | def forward( method prepare_inputs_for_generation (line 87) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... FILE: internvl_chat_llava/llava/model/language_model/mpt/adapt_tokenizer.py function adapt_tokenizer_for_denoising (line 6) | def adapt_tokenizer_for_denoising(tokenizer: Tokenizer): class AutoTokenizerForMOD (line 25) | class AutoTokenizerForMOD(AutoTokenizer): method from_pretrained (line 37) | def from_pretrained(cls, *args, **kwargs): FILE: internvl_chat_llava/llava/model/language_model/mpt/attention.py function _reset_is_causal (line 12) | def _reset_is_causal(num_query_tokens: int, num_key_tokens: int, origina... function scaled_multihead_dot_product_attention (line 20) | def scaled_multihead_dot_product_attention(query, key, value, n_heads, p... function check_valid_inputs (line 64) | def check_valid_inputs(*tensors, valid_dtypes=[torch.float16, torch.bflo... function flash_attn_fn (line 71) | def flash_attn_fn(query, key, value, n_heads, past_key_value=None, softm... function triton_flash_attn_fn (line 107) | def triton_flash_attn_fn(query, key, value, n_heads, past_key_value=None... class MultiheadAttention (line 151) | class MultiheadAttention(nn.Module): method __init__ (line 158) | def __init__(self, d_model: int, n_heads: int, attn_impl: str='triton'... method forward (line 191) | def forward(self, x, past_key_value=None, attn_bias=None, attention_ma... class MultiQueryAttention (line 204) | class MultiQueryAttention(nn.Module): method __init__ (line 211) | def __init__(self, d_model: int, n_heads: int, attn_impl: str='triton'... method forward (line 245) | def forward(self, x, past_key_value=None, attn_bias=None, attention_ma... function attn_bias_shape (line 258) | def attn_bias_shape(attn_impl, n_heads, seq_len, alibi, prefix_lm, causa... function build_attn_bias (line 272) | def build_attn_bias(attn_impl, attn_bias, n_heads, seq_len, causal=False... function gen_slopes (line 283) | def gen_slopes(n_heads, alibi_bias_max=8, device=None): function build_alibi_bias (line 292) | def build_alibi_bias(n_heads, seq_len, full=False, alibi_bias_max=8, dev... FILE: internvl_chat_llava/llava/model/language_model/mpt/blocks.py class MPTMLP (line 8) | class MPTMLP(nn.Module): method __init__ (line 10) | def __init__(self, d_model: int, expansion_ratio: int, device: Optiona... method forward (line 17) | def forward(self, x): class MPTBlock (line 20) | class MPTBlock(nn.Module): method __init__ (line 22) | def __init__(self, d_model: int, n_heads: int, expansion_ratio: int, a... method forward (line 34) | def forward(self, x: torch.Tensor, past_key_value: Optional[Tuple[torc... FILE: internvl_chat_llava/llava/model/language_model/mpt/configuration_mpt.py class MPTConfig (line 7) | class MPTConfig(PretrainedConfig): method __init__ (line 10) | def __init__(self, d_model: int=2048, n_heads: int=16, n_layers: int=2... method _set_config_defaults (line 90) | def _set_config_defaults(self, config, config_defaults): method _validate_config (line 96) | def _validate_config(self): FILE: internvl_chat_llava/llava/model/language_model/mpt/custom_embedding.py class SharedEmbedding (line 6) | class SharedEmbedding(nn.Embedding): method forward (line 8) | def forward(self, input: Tensor, unembed: bool=False) -> Tensor: FILE: internvl_chat_llava/llava/model/language_model/mpt/flash_attn_triton.py function _fwd_kernel (line 51) | def _fwd_kernel(Q, K, V, Bias, Out, Lse, TMP, softmax_scale, stride_qb, ... function _bwd_preprocess_do_o_dot (line 155) | def _bwd_preprocess_do_o_dot(Out, DO, Delta, stride_ob, stride_oh, strid... function _bwd_store_dk_dv (line 168) | def _bwd_store_dk_dv(dk_ptrs, dv_ptrs, dk, dv, offs_n, offs_d, seqlen_k,... function _bwd_kernel_one_col_block (line 184) | def _bwd_kernel_one_col_block(start_n, Q, K, V, Bias, DO, DQ, DK, DV, LS... function init_to_zero (line 300) | def init_to_zero(name): function _bwd_kernel (line 306) | def _bwd_kernel(Q, K, V, Bias, DO, DQ, DK, DV, LSE, D, softmax_scale, st... function _flash_attn_forward (line 329) | def _flash_attn_forward(q, k, v, bias=None, causal=False, softmax_scale=... function _flash_attn_backward (line 366) | def _flash_attn_backward(do, q, k, v, o, lse, dq, dk, dv, bias=None, cau... class FlashAttnQKVPackedFunc (line 401) | class FlashAttnQKVPackedFunc(torch.autograd.Function): method forward (line 404) | def forward(ctx, qkv, bias=None, causal=False, softmax_scale=None): method backward (line 419) | def backward(ctx, do): class FlashAttnKVPackedFunc (line 428) | class FlashAttnKVPackedFunc(torch.autograd.Function): method forward (line 431) | def forward(ctx, q, kv, bias=None, causal=False, softmax_scale=None): method backward (line 446) | def backward(ctx, do): class FlashAttnFunc (line 457) | class FlashAttnFunc(torch.autograd.Function): method forward (line 460) | def forward(ctx, q, k, v, bias=None, causal=False, softmax_scale=None): method backward (line 475) | def backward(ctx, do): FILE: internvl_chat_llava/llava/model/language_model/mpt/hf_prefixlm_converter.py function _convert_gpt_causal_lm_to_prefix_lm (line 29) | def _convert_gpt_causal_lm_to_prefix_lm(model: CAUSAL_GPT_TYPES) -> CAUS... function _convert_bloom_causal_lm_to_prefix_lm (line 113) | def _convert_bloom_causal_lm_to_prefix_lm(model: BloomForCausalLM) -> Bl... function _convert_opt_causal_lm_to_prefix_lm (line 269) | def _convert_opt_causal_lm_to_prefix_lm(model: OPTForCausalLM) -> OPTFor... function convert_hf_causal_lm_to_prefix_lm (line 335) | def convert_hf_causal_lm_to_prefix_lm(model: CAUSAL_LM_TYPES) -> CAUSAL_... function add_bidirectional_mask_if_missing (line 401) | def add_bidirectional_mask_if_missing(batch: Dict[str, Any]): FILE: internvl_chat_llava/llava/model/language_model/mpt/meta_init_context.py function init_empty_weights (line 6) | def init_empty_weights(include_buffers: bool=False): function init_on_device (line 37) | def init_on_device(device: torch.device, include_buffers: bool=False): FILE: internvl_chat_llava/llava/model/language_model/mpt/modeling_mpt.py class MPTPreTrainedModel (line 28) | class MPTPreTrainedModel(PreTrainedModel): class MPTModel (line 33) | class MPTModel(MPTPreTrainedModel): method __init__ (line 35) | def __init__(self, config: MPTConfig): method get_input_embeddings (line 81) | def get_input_embeddings(self): method set_input_embeddings (line 84) | def set_input_embeddings(self, value): method _attn_bias (line 88) | def _attn_bias(self, device, dtype, attention_mask: Optional[torch.Byt... method _apply_prefix_mask (line 119) | def _apply_prefix_mask(self, attn_bias: torch.Tensor, prefix_mask: tor... method _apply_sequence_id (line 134) | def _apply_sequence_id(self, attn_bias: torch.Tensor, sequence_id: tor... method forward (line 144) | def forward(self, input_ids: torch.LongTensor, past_key_values: Option... method param_init_fn (line 222) | def param_init_fn(self, module): method fsdp_wrap_fn (line 226) | def fsdp_wrap_fn(self, module): method activation_checkpointing_fn (line 229) | def activation_checkpointing_fn(self, module): class MPTForCausalLM (line 232) | class MPTForCausalLM(MPTPreTrainedModel): method __init__ (line 234) | def __init__(self, config: MPTConfig): method get_input_embeddings (line 255) | def get_input_embeddings(self): method set_input_embeddings (line 258) | def set_input_embeddings(self, value): method get_output_embeddings (line 261) | def get_output_embeddings(self): method set_output_embeddings (line 264) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 267) | def set_decoder(self, decoder): method get_decoder (line 270) | def get_decoder(self): method forward (line 273) | def forward(self, input_ids: torch.LongTensor, past_key_values: Option... method param_init_fn (line 291) | def param_init_fn(self, module): method fsdp_wrap_fn (line 295) | def fsdp_wrap_fn(self, module): method activation_checkpointing_fn (line 298) | def activation_checkpointing_fn(self, module): method prepare_inputs_for_generation (line 301) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... method _reorder_cache (line 322) | def _reorder_cache(past_key_values, beam_idx): FILE: internvl_chat_llava/llava/model/language_model/mpt/norm.py function _cast_if_autocast_enabled (line 3) | def _cast_if_autocast_enabled(tensor): class LPLayerNorm (line 14) | class LPLayerNorm(torch.nn.LayerNorm): method __init__ (line 16) | def __init__(self, normalized_shape, eps=1e-05, elementwise_affine=Tru... method forward (line 19) | def forward(self, x): function rms_norm (line 27) | def rms_norm(x, weight=None, eps=1e-05): class RMSNorm (line 33) | class RMSNorm(torch.nn.Module): method __init__ (line 35) | def __init__(self, normalized_shape, eps=1e-05, weight=True, dtype=Non... method forward (line 43) | def forward(self, x): class LPRMSNorm (line 46) | class LPRMSNorm(RMSNorm): method __init__ (line 48) | def __init__(self, normalized_shape, eps=1e-05, weight=True, dtype=Non... method forward (line 51) | def forward(self, x): FILE: internvl_chat_llava/llava/model/language_model/mpt/param_init_fns.py function torch_default_param_init_fn_ (line 10) | def torch_default_param_init_fn_(module: nn.Module, verbose: int=0, **kw... function fused_init_helper_ (line 17) | def fused_init_helper_(module: nn.Module, init_fn_): function generic_param_init_fn_ (line 28) | def generic_param_init_fn_(module: nn.Module, init_fn_, n_layers: int, d... function _normal_init_ (line 121) | def _normal_init_(std, mean=0.0): function _normal_param_init_fn_ (line 124) | def _normal_param_init_fn_(module: nn.Module, std: float, n_layers: int,... function baseline_param_init_fn_ (line 131) | def baseline_param_init_fn_(module: nn.Module, init_std: float, n_layers... function small_param_init_fn_ (line 137) | def small_param_init_fn_(module: nn.Module, n_layers: int, d_model: int,... function neox_param_init_fn_ (line 142) | def neox_param_init_fn_(module: nn.Module, n_layers: int, d_model: int, ... function kaiming_uniform_param_init_fn_ (line 155) | def kaiming_uniform_param_init_fn_(module: nn.Module, n_layers: int, d_m... function kaiming_normal_param_init_fn_ (line 162) | def kaiming_normal_param_init_fn_(module: nn.Module, n_layers: int, d_mo... function xavier_uniform_param_init_fn_ (line 169) | def xavier_uniform_param_init_fn_(module: nn.Module, n_layers: int, d_mo... function xavier_normal_param_init_fn_ (line 176) | def xavier_normal_param_init_fn_(module: nn.Module, n_layers: int, d_mod... FILE: internvl_chat_llava/llava/model/llava_arch.py class LlavaMetaModel (line 27) | class LlavaMetaModel: method __init__ (line 29) | def __init__(self, config): method get_vision_tower (line 36) | def get_vision_tower(self): method initialize_vision_modules (line 42) | def initialize_vision_modules(self, model_args, fsdp=None): class LlavaMetaForCausalLM (line 90) | class LlavaMetaForCausalLM(ABC): method get_model (line 93) | def get_model(self): method get_vision_tower (line 96) | def get_vision_tower(self): method encode_images (line 99) | def encode_images(self, images): method prepare_inputs_labels_for_multimodal (line 104) | def prepare_inputs_labels_for_multimodal( method initialize_vision_tokenizer (line 223) | def initialize_vision_tokenizer(self, model_args, tokenizer): FILE: internvl_chat_llava/llava/model/make_delta.py function make_delta (line 13) | def make_delta(base_model_path, target_model_path, delta_path, hub_repo_... FILE: internvl_chat_llava/llava/model/multimodal_encoder/builder.py function build_vision_tower (line 5) | def build_vision_tower(vision_tower_cfg, **kwargs): FILE: internvl_chat_llava/llava/model/multimodal_encoder/clip_encoder.py function is_intern_vit_6b_model (line 15) | def is_intern_vit_6b_model(vision_tower_name): function is_internvl_14b_model (line 20) | def is_internvl_14b_model(vision_tower_name): class CLIPVisionTower (line 25) | class CLIPVisionTower(nn.Module): method __init__ (line 26) | def __init__(self, vision_tower, args, delay_load=False): method load_model (line 47) | def load_model(self): method feature_select (line 72) | def feature_select(self, image_forward_outs): method forward (line 83) | def forward(self, images): method dummy_feature (line 107) | def dummy_feature(self): method dtype (line 111) | def dtype(self): method device (line 115) | def device(self): method config (line 119) | def config(self): method hidden_size (line 126) | def hidden_size(self): method num_patches (line 130) | def num_patches(self): FILE: internvl_chat_llava/llava/model/multimodal_encoder/eva_clip/configuration_evaclip.py class EvaCLIPTextConfig (line 36) | class EvaCLIPTextConfig(PretrainedConfig): method __init__ (line 90) | def __init__( method from_pretrained (line 133) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... class EvaCLIPVisionConfig (line 151) | class EvaCLIPVisionConfig(PretrainedConfig): method __init__ (line 204) | def __init__( method from_pretrained (line 246) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... class EvaCLIPConfig (line 264) | class EvaCLIPConfig(PretrainedConfig): method __init__ (line 313) | def __init__( method from_text_vision_configs (line 402) | def from_text_vision_configs(cls, text_config: EvaCLIPTextConfig, visi... method to_dict (line 413) | def to_dict(self): FILE: internvl_chat_llava/llava/model/multimodal_encoder/eva_clip/modeling_evaclip.py function _expand_mask (line 48) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... function contrastive_loss (line 64) | def contrastive_loss(logits: torch.Tensor) -> torch.Tensor: function clip_loss (line 68) | def clip_loss(similarity: torch.Tensor) -> torch.Tensor: class EvaCLIPVisionModelOutput (line 75) | class EvaCLIPVisionModelOutput(ModelOutput): class EvaCLIPTextModelOutput (line 104) | class EvaCLIPTextModelOutput(ModelOutput): class EvaCLIPOutput (line 133) | class EvaCLIPOutput(ModelOutput): method to_tuple (line 162) | def to_tuple(self) -> Tuple[Any]: class EvaCLIPVisionEmbeddings (line 169) | class EvaCLIPVisionEmbeddings(nn.Module): method __init__ (line 170) | def __init__(self, config: EvaCLIPVisionConfig): method forward (line 192) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class EvaCLIPTextEmbeddings (line 203) | class EvaCLIPTextEmbeddings(nn.Module): method __init__ (line 204) | def __init__(self, config: EvaCLIPTextConfig): method forward (line 214) | def forward( class EvaCLIPAttention (line 234) | class EvaCLIPAttention(nn.Module): method __init__ (line 237) | def __init__(self, config): method _shape (line 255) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 258) | def forward( class EvaCLIPTextAttention (line 336) | class EvaCLIPTextAttention(nn.Module): method __init__ (line 339) | def __init__(self, config): method _shape (line 357) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 360) | def forward( class EvaCLIPMLP (line 438) | class EvaCLIPMLP(nn.Module): method __init__ (line 439) | def __init__(self, config): method forward (line 446) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class EvaCLIPEncoderLayer (line 453) | class EvaCLIPEncoderLayer(nn.Module): method __init__ (line 454) | def __init__(self, config: EvaCLIPConfig): method forward (line 464) | def forward( class EvaCLIPPreTrainedModel (line 510) | class EvaCLIPPreTrainedModel(PreTrainedModel): method _init_weights (line 521) | def _init_weights(self, module): method _set_gradient_checkpointing (line 574) | def _set_gradient_checkpointing(self, module, value=False): class EvaCLIPEncoder (line 679) | class EvaCLIPEncoder(nn.Module): method __init__ (line 688) | def __init__(self, config: EvaCLIPConfig): method forward (line 694) | def forward( class EvaCLIPTextTransformer (line 782) | class EvaCLIPTextTransformer(nn.Module): method __init__ (line 783) | def __init__(self, config: EvaCLIPTextConfig): method forward (line 793) | def forward( method _build_causal_attention_mask (line 861) | def _build_causal_attention_mask(self, bsz, seq_len, dtype): class EvaCLIPTextModel (line 875) | class EvaCLIPTextModel(EvaCLIPPreTrainedModel): method __init__ (line 880) | def __init__(self, config: EvaCLIPTextConfig): method get_input_embeddings (line 886) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 889) | def set_input_embeddings(self, value): method forward (line 894) | def forward( class EvaCLIPVisionTransformer (line 932) | class EvaCLIPVisionTransformer(nn.Module): method __init__ (line 933) | def __init__(self, config: EvaCLIPVisionConfig): method forward (line 944) | def forward( class EvaCLIPVisionModel (line 992) | class EvaCLIPVisionModel(EvaCLIPPreTrainedModel): method __init__ (line 996) | def __init__(self, config: EvaCLIPVisionConfig): method get_input_embeddings (line 1002) | def get_input_embeddings(self) -> nn.Module: method forward (line 1007) | def forward( class EvaCLIPModel (line 1047) | class EvaCLIPModel(EvaCLIPPreTrainedModel): method __init__ (line 1050) | def __init__(self, config: EvaCLIPConfig): method get_text_features (line 1083) | def get_text_features( method get_image_features (line 1130) | def get_image_features( method forward (line 1180) | def forward( class EvaCLIPTextModelWithProjection (line 1278) | class EvaCLIPTextModelWithProjection(EvaCLIPPreTrainedModel): method __init__ (line 1283) | def __init__(self, config: EvaCLIPTextConfig): method get_input_embeddings (line 1293) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1296) | def set_input_embeddings(self, value): method forward (line 1301) | def forward( class EvaCLIPVisionModelWithProjection (line 1359) | class EvaCLIPVisionModelWithProjection(EvaCLIPPreTrainedModel): method __init__ (line 1363) | def __init__(self, config: EvaCLIPVisionConfig): method get_input_embeddings (line 1373) | def get_input_embeddings(self) -> nn.Module: method forward (line 1378) | def forward( FILE: internvl_chat_llava/llava/model/multimodal_encoder/intern_vit_6b/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 105) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: internvl_chat_llava/llava/model/multimodal_encoder/intern_vit_6b/flash_attention.py class FlashAttention (line 14) | class FlashAttention(nn.Module): method __init__ (line 25) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 30) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: internvl_chat_llava/llava/model/multimodal_encoder/intern_vit_6b/modeling_intern_vit.py class InternRMSNorm (line 33) | class InternRMSNorm(nn.Module): method __init__ (line 34) | def __init__(self, hidden_size, eps=1e-6): method forward (line 39) | def forward(self, hidden_states): class InternVisionEmbeddings (line 61) | class InternVisionEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: InternVisionConfig): method _get_pos_embed (line 82) | def _get_pos_embed(self, pos_embed, H, W): method forward (line 90) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 105) | class InternAttention(nn.Module): method __init__ (line 108) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 138) | def _naive_attn(self, x): method _flash_attn (line 157) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 174) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 179) | class InternMLP(nn.Module): method __init__ (line 180) | def __init__(self, config: InternVisionConfig): method forward (line 187) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 194) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 195) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 210) | def forward( class InternVisionEncoder (line 225) | class InternVisionEncoder(nn.Module): method __init__ (line 235) | def __init__(self, config: InternVisionConfig): method forward (line 244) | def forward( class InternVisionModel (line 291) | class InternVisionModel(PreTrainedModel): method __init__ (line 295) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 302) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 313) | def get_input_embeddings(self): method forward (line 316) | def forward( FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/__init__.py class InternVLTokenizer (line 23) | class InternVLTokenizer(nn.Module): method __init__ (line 24) | def __init__(self, model_path): method forward (line 30) | def forward(self, text, prefix='summarize:'): function build_transform (line 39) | def build_transform(task, image_size=224, mean=[0.485, 0.456, 0.406], st... function load_internvl_c_huggingface (line 56) | def load_internvl_c_huggingface(ckpt_path, device, task): function load_internvl_g_huggingface (line 73) | def load_internvl_g_huggingface(ckpt_path, device, task): FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 105) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/configuration_internvl.py class InternVLConfig (line 17) | class InternVLConfig(PretrainedConfig): method __init__ (line 57) | def __init__( method to_dict (line 97) | def to_dict(self): FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/flash_attention.py class FlashAttention (line 15) | class FlashAttention(nn.Module): method __init__ (line 26) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 31) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/modeling_intern_vit.py class InternRMSNorm (line 33) | class InternRMSNorm(nn.Module): method __init__ (line 34) | def __init__(self, hidden_size, eps=1e-6): method forward (line 39) | def forward(self, hidden_states): class InternVisionEmbeddings (line 61) | class InternVisionEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: InternVisionConfig): method _get_pos_embed (line 82) | def _get_pos_embed(self, pos_embed, H, W): method forward (line 90) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 105) | class InternAttention(nn.Module): method __init__ (line 108) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 138) | def _naive_attn(self, x): method _flash_attn (line 157) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 174) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 179) | class InternMLP(nn.Module): method __init__ (line 180) | def __init__(self, config: InternVisionConfig): method forward (line 187) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 194) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 195) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 210) | def forward( class InternVisionEncoder (line 225) | class InternVisionEncoder(nn.Module): method __init__ (line 235) | def __init__(self, config: InternVisionConfig): method forward (line 244) | def forward( class InternVisionModel (line 291) | class InternVisionModel(PreTrainedModel): method __init__ (line 295) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 302) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 313) | def get_input_embeddings(self): method forward (line 316) | def forward( FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/modeling_internvl.py class InternVLPreTrainedModel (line 33) | class InternVLPreTrainedModel(PreTrainedModel): method _init_weights (line 49) | def _init_weights(self, module): method _set_gradient_checkpointing (line 67) | def _set_gradient_checkpointing(self, module, value=False): class CrossAttention (line 74) | class CrossAttention(nn.Module): method __init__ (line 75) | def __init__( method forward (line 106) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 139) | class AttentiveBlock(nn.Module): method __init__ (line 141) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 154) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 163) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 165) | def forward(self, x): class InternVLModel (line 173) | class InternVLModel(InternVLPreTrainedModel): method __init__ (line 177) | def __init__(self, config: InternVLConfig): method wrap_backbone_lora (line 218) | def wrap_backbone_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method wrap_qllama_lora (line 228) | def wrap_qllama_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method get_input_embeddings (line 239) | def get_input_embeddings(self): method set_input_embeddings (line 242) | def set_input_embeddings(self, value): method set_output_embeddings (line 245) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 248) | def get_output_embeddings(self) -> nn.Module: method generate (line 252) | def generate( method get_text_features (line 287) | def get_text_features( method get_image_features (line 336) | def get_image_features( method encode_image (line 382) | def encode_image(self, image, mode): method encode_text (line 406) | def encode_text(self, text): method forward (line 419) | def forward(self, pixel_values: torch.FloatTensor, class InternVL_C (line 461) | class InternVL_C(InternVLModel): method encode_image (line 463) | def encode_image(self, image): method encode_text (line 472) | def encode_text(self, text): method forward (line 485) | def forward(self, image, text): class InternVL_G (line 501) | class InternVL_G(InternVLModel): method encode_image (line 503) | def encode_image(self, image): method encode_text (line 517) | def encode_text(self, text): method forward (line 530) | def forward(self, image, text): FILE: internvl_chat_llava/llava/model/multimodal_encoder/internvl_14b/modeling_qllama.py function _make_causal_mask (line 42) | def _make_causal_mask( function _expand_mask (line 60) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class LlamaRMSNorm (line 74) | class LlamaRMSNorm(nn.Module): method __init__ (line 75) | def __init__(self, hidden_size, eps=1e-6): method forward (line 83) | def forward(self, hidden_states): class LlamaRotaryEmbedding (line 109) | class LlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 110) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 124) | def forward(self, x, seq_len=None): class FixedLlamaRotaryEmbedding (line 141) | class FixedLlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 142) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 155) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 165) | def forward(self, x, seq_len=None): function rotate_half (line 179) | def rotate_half(x): function apply_rotary_pos_emb (line 186) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class LlamaMLP (line 196) | class LlamaMLP(nn.Module): method __init__ (line 197) | def __init__( method forward (line 209) | def forward(self, x): class LlamaAttention (line 213) | class LlamaAttention(nn.Module): method __init__ (line 216) | def __init__(self, config: LlamaConfig): method _shape (line 235) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 238) | def forward( class LlamaCrossAttention (line 304) | class LlamaCrossAttention(nn.Module): method __init__ (line 307) | def __init__(self, config: LlamaConfig): method _shape (line 329) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 332) | def forward( class LlamaDecoderLayer (line 408) | class LlamaDecoderLayer(nn.Module): method __init__ (line 409) | def __init__(self, config: LlamaConfig, use_cross_attn: bool): method forward (line 423) | def forward( class LlamaPreTrainedModel (line 520) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 527) | def _init_weights(self, module): method _set_gradient_checkpointing (line 538) | def _set_gradient_checkpointing(self, module, value=False): class LlamaModel (line 613) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 621) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 636) | def get_input_embeddings(self): method set_input_embeddings (line 639) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 643) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 667) | def forward( method forward_train (line 783) | def forward_train( class LlamaForCausalLM (line 915) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 916) | def __init__(self, config): method get_input_embeddings (line 925) | def get_input_embeddings(self): method set_input_embeddings (line 928) | def set_input_embeddings(self, value): method get_output_embeddings (line 931) | def get_output_embeddings(self): method set_output_embeddings (line 934) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 937) | def set_decoder(self, decoder): method get_decoder (line 940) | def get_decoder(self): method forward (line 945) | def forward( method prepare_inputs_for_generation (line 1035) | def prepare_inputs_for_generation( method _reorder_cache (line 1069) | def _reorder_cache(past_key_values, beam_idx): FILE: internvl_chat_llava/llava/model/multimodal_projector/builder.py class IdentityMap (line 6) | class IdentityMap(nn.Module): method __init__ (line 7) | def __init__(self): method forward (line 10) | def forward(self, x, *args, **kwargs): method config (line 14) | def config(self): class SimpleResBlock (line 18) | class SimpleResBlock(nn.Module): method __init__ (line 19) | def __init__(self, channels): method forward (line 28) | def forward(self, x): class TwoMLP (line 33) | class TwoMLP(nn.Module): method __init__ (line 34) | def __init__(self, config): method forward (line 48) | def forward(self, inputs): function build_vision_projector (line 58) | def build_vision_projector(config, delay_load=False, **kwargs): FILE: internvl_chat_llava/llava/model/utils.py function auto_upgrade (line 4) | def auto_upgrade(config): FILE: internvl_chat_llava/llava/serve/cli.py function load_image (line 18) | def load_image(image_file): function main (line 27) | def main(args): FILE: internvl_chat_llava/llava/serve/controller.py class DispatchMethod (line 28) | class DispatchMethod(Enum): method from_str (line 33) | def from_str(cls, name): class WorkerInfo (line 43) | class WorkerInfo: function heart_beat_controller (line 51) | def heart_beat_controller(controller): class Controller (line 57) | class Controller: method __init__ (line 58) | def __init__(self, dispatch_method: str): method register_worker (line 69) | def register_worker(self, worker_name: str, check_heart_beat: bool, method get_worker_status (line 88) | def get_worker_status(self, worker_name: str): method remove_worker (line 101) | def remove_worker(self, worker_name: str): method refresh_all_workers (line 104) | def refresh_all_workers(self): method list_models (line 112) | def list_models(self): method get_worker_address (line 120) | def get_worker_address(self, model_name: str): method receive_heart_beat (line 173) | def receive_heart_beat(self, worker_name: str, queue_length: int): method remove_stable_workers_by_expiration (line 183) | def remove_stable_workers_by_expiration(self): method worker_api_generate_stream (line 193) | def worker_api_generate_stream(self, params): method worker_api_get_status (line 220) | def worker_api_get_status(self): function register_worker (line 243) | async def register_worker(request: Request): function refresh_all_workers (line 251) | async def refresh_all_workers(): function list_models (line 256) | async def list_models(): function get_worker_address (line 262) | async def get_worker_address(request: Request): function receive_heart_beat (line 269) | async def receive_heart_beat(request: Request): function worker_api_generate_stream (line 277) | async def worker_api_generate_stream(request: Request): function worker_api_get_status (line 284) | async def worker_api_get_status(request: Request): FILE: internvl_chat_llava/llava/serve/gradio_web_server.py function get_conv_log_filename (line 32) | def get_conv_log_filename(): function sort_models (line 38) | def sort_models(models): function get_model_list (line 58) | def get_model_list(): function load_demo (line 79) | def load_demo(url_params, request: gr.Request): function load_demo_refresh_model_list (line 93) | def load_demo_refresh_model_list(request: gr.Request): function vote_last_response (line 104) | def vote_last_response(state, vote_type, model_selector, request: gr.Req... function upvote_last_response (line 116) | def upvote_last_response(state, model_selector, request: gr.Request): function downvote_last_response (line 122) | def downvote_last_response(state, model_selector, request: gr.Request): function flag_last_response (line 128) | def flag_last_response(state, model_selector, request: gr.Request): function regenerate (line 134) | def regenerate(state, image_process_mode, request: gr.Request): function clear_history (line 144) | def clear_history(request: gr.Request): function add_text (line 150) | def add_text(state, text, image, image_process_mode, request: gr.Request): function http_bot (line 174) | def http_bot(state, model_selector, temperature, top_p, max_new_tokens, ... function build_demo (line 344) | def build_demo(embed_mode): FILE: internvl_chat_llava/llava/serve/model_worker.py function heart_beat_worker (line 37) | def heart_beat_worker(controller): class ModelWorker (line 44) | class ModelWorker: method __init__ (line 45) | def __init__(self, controller_addr, worker_addr, method register_to_controller (line 75) | def register_to_controller(self): method send_heart_beat (line 87) | def send_heart_beat(self): method get_queue_length (line 108) | def get_queue_length(self): method get_status (line 115) | def get_status(self): method generate_stream (line 123) | def generate_stream(self, params): method generate_stream_gate (line 194) | def generate_stream_gate(self, params): function release_model_semaphore (line 224) | def release_model_semaphore(fn=None): function generate_stream (line 231) | async def generate_stream(request: Request): function get_status (line 247) | async def get_status(request: Request): FILE: internvl_chat_llava/llava/serve/test_message.py function main (line 9) | def main(): FILE: internvl_chat_llava/llava/train/dist_utils.py function _find_free_port (line 13) | def _find_free_port(): function _is_free_port (line 24) | def _is_free_port(port): function init_dist (line 31) | def init_dist(launcher, backend='nccl', **kwargs): function _init_dist_pytorch (line 44) | def _init_dist_pytorch(backend, **kwargs): function _init_dist_mpi (line 52) | def _init_dist_mpi(backend, **kwargs): function _init_dist_slurm (line 65) | def _init_dist_slurm(backend, port=None): FILE: internvl_chat_llava/llava/train/llama_flash_attn_monkey_patch.py function forward (line 16) | def forward( function _prepare_decoder_attention_mask (line 98) | def _prepare_decoder_attention_mask( function replace_llama_attn_with_flash_attn (line 105) | def replace_llama_attn_with_flash_attn(): FILE: internvl_chat_llava/llava/train/llava_trainer.py function maybe_zero_3 (line 13) | def maybe_zero_3(param, ignore_status=False, name=None): function get_mm_adapter_state_maybe_zero_3 (line 27) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function split_to_even_chunks (line 33) | def split_to_even_chunks(indices, lengths, num_chunks): function get_modality_length_grouped_indices (line 55) | def get_modality_length_grouped_indices(lengths, batch_size, world_size,... function get_length_grouped_indices (line 87) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 98) | class LengthGroupedSampler(Sampler): method __init__ (line 104) | def __init__( method __len__ (line 121) | def __len__(self): method __iter__ (line 124) | def __iter__(self): class LLaVATrainer (line 132) | class LLaVATrainer(Trainer): method _get_train_sampler (line 134) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method _save_checkpoint (line 150) | def _save_checkpoint(self, model, trial, metrics=None): method _save (line 176) | def _save(self, output_dir: Optional[str] = None, state_dict=None): FILE: internvl_chat_llava/llava/train/train.py function rank0_print (line 44) | def rank0_print(*args): class ModelArguments (line 50) | class ModelArguments: class DataArguments (line 66) | class DataArguments: class TrainingArguments (line 77) | class TrainingArguments(transformers.TrainingArguments): function maybe_zero_3 (line 112) | def maybe_zero_3(param, ignore_status=False, name=None): function get_peft_state_maybe_zero_3 (line 127) | def get_peft_state_maybe_zero_3(named_params, bias): function get_peft_state_non_lora_maybe_zero_3 (line 152) | def get_peft_state_non_lora_maybe_zero_3(named_params, require_grad_only... function get_mm_adapter_state_maybe_zero_3 (line 160) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function find_all_linear_names (line 166) | def find_all_linear_names(model): function safe_save_model_for_hf_trainer (line 180) | def safe_save_model_for_hf_trainer(trainer: transformers.Trainer, function smart_tokenizer_and_embedding_resize (line 224) | def smart_tokenizer_and_embedding_resize( function _tokenize_fn (line 249) | def _tokenize_fn(strings: Sequence[str], function _mask_targets (line 276) | def _mask_targets(target, tokenized_lens, speakers): function _add_speaker_and_signal (line 287) | def _add_speaker_and_signal(header, source, get_conversation=True): function preprocess_multimodal (line 308) | def preprocess_multimodal( function preprocess_llama_2 (line 332) | def preprocess_llama_2( function preprocess_v1 (line 414) | def preprocess_v1( function preprocess_mpt (line 505) | def preprocess_mpt( function preprocess_plain (line 571) | def preprocess_plain( function preprocess (line 593) | def preprocess( class LazySupervisedDataset (line 641) | class LazySupervisedDataset(Dataset): method __init__ (line 644) | def __init__(self, data_path: str, method __len__ (line 655) | def __len__(self): method lengths (line 659) | def lengths(self): method modality_lengths (line 667) | def modality_lengths(self): method __getitem__ (line 675) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class DataCollatorForSupervisedDataset (line 733) | class DataCollatorForSupervisedDataset(object): method __call__ (line 738) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: function make_supervised_data_module (line 766) | def make_supervised_data_module(tokenizer: transformers.PreTrainedTokeni... function train (line 778) | def train(attn_implementation=None): FILE: internvl_chat_llava/llava/train/train_custom.py function pil_loader (line 52) | def pil_loader(img_str): class TCSLoader (line 58) | class TCSLoader(object): method __init__ (line 60) | def __init__(self, conf_path): method __call__ (line 66) | def __call__(self, fn): function rank0_print (line 75) | def rank0_print(*args): class ModelArguments (line 81) | class ModelArguments: class DataArguments (line 97) | class DataArguments: class TrainingArguments (line 108) | class TrainingArguments(transformers.TrainingArguments): function maybe_zero_3 (line 143) | def maybe_zero_3(param, ignore_status=False, name=None): function get_peft_state_maybe_zero_3 (line 158) | def get_peft_state_maybe_zero_3(named_params, bias): function get_peft_state_non_lora_maybe_zero_3 (line 183) | def get_peft_state_non_lora_maybe_zero_3(named_params, require_grad_only... function get_mm_adapter_state_maybe_zero_3 (line 191) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function find_all_linear_names (line 197) | def find_all_linear_names(model): function safe_save_model_for_hf_trainer (line 211) | def safe_save_model_for_hf_trainer(trainer: transformers.Trainer, function smart_tokenizer_and_embedding_resize (line 255) | def smart_tokenizer_and_embedding_resize( function _tokenize_fn (line 280) | def _tokenize_fn(strings: Sequence[str], function _mask_targets (line 307) | def _mask_targets(target, tokenized_lens, speakers): function _add_speaker_and_signal (line 318) | def _add_speaker_and_signal(header, source, get_conversation=True): function preprocess_multimodal (line 339) | def preprocess_multimodal( function preprocess_llama_2 (line 363) | def preprocess_llama_2( function preprocess_v1 (line 445) | def preprocess_v1( function preprocess_mpt (line 536) | def preprocess_mpt( function preprocess_plain (line 602) | def preprocess_plain( function preprocess (line 624) | def preprocess( class WeightedConcatDataset (line 675) | class WeightedConcatDataset(ConcatDataset): method __init__ (line 676) | def __init__(self, datasets, weights): method __iter__ (line 682) | def __iter__(self): method __len__ (line 685) | def __len__(self): class LazySupervisedDataset (line 689) | class LazySupervisedDataset(Dataset): method __init__ (line 692) | def __init__(self, meta, method __len__ (line 708) | def __len__(self): method lengths (line 712) | def lengths(self): method modality_lengths (line 720) | def modality_lengths(self): method __getitem__ (line 728) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class DataCollatorForSupervisedDataset (line 788) | class DataCollatorForSupervisedDataset(object): method __call__ (line 793) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: function make_supervised_data_module (line 821) | def make_supervised_data_module(tokenizer: transformers.PreTrainedTokeni... function train (line 850) | def train(attn_implementation=None): FILE: internvl_chat_llava/llava/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: internvl_chat_llava/scripts/convert_mmbench_for_submission.py function get_args (line 6) | def get_args(): FILE: internvl_chat_llava/scripts/convert_seed_for_submission.py function get_args (line 6) | def get_args(): function eval_single (line 14) | def eval_single(result_file, eval_only_type=None): FILE: internvl_chat_llava/scripts/convert_sqa_to_llava.py function convert_to_llava (line 8) | def convert_to_llava(base_dir, split, prompt_format="QCM-LEA"): function convert_to_jsonl (line 49) | def convert_to_jsonl(base_dir, split, prompt_format="QCM-LEPA"): function main (line 83) | def main(task, **kwargs): FILE: internvl_chat_llava/scripts/convert_sqa_to_llava_base_prompt.py function get_question_text (line 1) | def get_question_text(problem): function get_context_text (line 6) | def get_context_text(problem, use_caption): function get_choice_text (line 15) | def get_choice_text(probelm, options): function get_answer (line 25) | def get_answer(problem, options): function get_lecture_text (line 29) | def get_lecture_text(problem): function get_solution_text (line 35) | def get_solution_text(problem): function create_one_example_chatbot (line 41) | def create_one_example_chatbot(format, question, context, choice, answer... function create_one_example (line 106) | def create_one_example(format, question, context, choice, answer, lectur... function create_one_example_gpt4 (line 162) | def create_one_example_gpt4(format, question, context, choice, answer, l... function build_prompt_chatbot (line 221) | def build_prompt_chatbot(problems, shot_qids, prompt_format, use_caption... function build_prompt (line 244) | def build_prompt(problems, shot_qids, test_qid, args): function build_prompt_gpt4 (line 291) | def build_prompt_gpt4(problems, shot_qids, test_qid, args): FILE: internvl_chat_llava/scripts/convert_vizwiz_for_submission.py function parse_args (line 8) | def parse_args(): FILE: internvl_chat_llava/scripts/convert_vqav2_for_submission.py function parse_args (line 8) | def parse_args(): FILE: internvl_chat_llava/scripts/merge_lora_weights.py function merge_lora (line 6) | def merge_lora(args): FILE: internvl_g/eval/evaluate_caption.py class CaptionDataset (line 36) | class CaptionDataset(torch.utils.data.Dataset): method __init__ (line 38) | def __init__(self, name, root, annotation, prompt, input_size=224): method __len__ (line 53) | def __len__(self): method __getitem__ (line 56) | def __getitem__(self, idx): function collate_fn (line 76) | def collate_fn(inputs, tokenizer): class InferenceSampler (line 85) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 87) | def __init__(self, size): method _get_local_indices (line 95) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 104) | def __iter__(self): method __len__ (line 107) | def __len__(self): function evaluate_qllama_model (line 111) | def evaluate_qllama_model(): FILE: internvl_g/internvl/dist_utils.py function _find_free_port (line 13) | def _find_free_port(): function _is_free_port (line 24) | def _is_free_port(port): function init_dist (line 31) | def init_dist(launcher, backend='nccl', **kwargs): function _init_dist_pytorch (line 44) | def _init_dist_pytorch(backend, **kwargs): function _init_dist_mpi (line 52) | def _init_dist_mpi(backend, **kwargs): function _init_dist_slurm (line 65) | def _init_dist_slurm(backend, port=None): FILE: internvl_g/internvl/model/internvl_stage2/__init__.py class InternVLTokenizer (line 23) | class InternVLTokenizer(nn.Module): method __init__ (line 24) | def __init__(self, model_path): method forward (line 30) | def forward(self, text, prefix='summarize:'): function build_transform (line 39) | def build_transform(task, image_size=224, mean=[0.485, 0.456, 0.406], st... function load_internvl_c_huggingface (line 56) | def load_internvl_c_huggingface(ckpt_path, device, task): function load_internvl_g_huggingface (line 73) | def load_internvl_g_huggingface(ckpt_path, device, task): FILE: internvl_g/internvl/model/internvl_stage2/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 105) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: internvl_g/internvl/model/internvl_stage2/configuration_internvl.py class InternVLConfig (line 17) | class InternVLConfig(PretrainedConfig): method __init__ (line 57) | def __init__( method to_dict (line 97) | def to_dict(self): FILE: internvl_g/internvl/model/internvl_stage2/flash_attention.py class FlashAttention (line 15) | class FlashAttention(nn.Module): method __init__ (line 26) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 31) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: internvl_g/internvl/model/internvl_stage2/modeling_intern_vit.py class InternRMSNorm (line 33) | class InternRMSNorm(nn.Module): method __init__ (line 34) | def __init__(self, hidden_size, eps=1e-6): method forward (line 39) | def forward(self, hidden_states): class InternVisionEmbeddings (line 61) | class InternVisionEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: InternVisionConfig): method forward (line 82) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 93) | class InternAttention(nn.Module): method __init__ (line 96) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 126) | def _naive_attn(self, x): method _flash_attn (line 145) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 162) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 167) | class InternMLP(nn.Module): method __init__ (line 168) | def __init__(self, config: InternVisionConfig): method forward (line 175) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 182) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 183) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 198) | def forward( class InternVisionEncoder (line 213) | class InternVisionEncoder(nn.Module): method __init__ (line 223) | def __init__(self, config: InternVisionConfig): method forward (line 232) | def forward( class InternVisionModel (line 279) | class InternVisionModel(PreTrainedModel): method __init__ (line 283) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 290) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 301) | def get_input_embeddings(self): method forward (line 304) | def forward( FILE: internvl_g/internvl/model/internvl_stage2/modeling_internvl.py class InternVLPreTrainedModel (line 35) | class InternVLPreTrainedModel(PreTrainedModel): method _set_gradient_checkpointing (line 69) | def _set_gradient_checkpointing(self, module, value=False): class CrossAttention (line 76) | class CrossAttention(nn.Module): method __init__ (line 77) | def __init__( method forward (line 108) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 141) | class AttentiveBlock(nn.Module): method __init__ (line 143) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 156) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 165) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 167) | def forward(self, x): class InternVLModelOutput (line 176) | class InternVLModelOutput(ModelOutput): method to_tuple (line 186) | def to_tuple(self) -> Tuple[Any]: class GatherLayer (line 195) | class GatherLayer(torch.autograd.Function): method forward (line 200) | def forward(ctx, input): method backward (line 207) | def backward(ctx, grads): class InternVLModel (line 215) | class InternVLModel(InternVLPreTrainedModel): method __init__ (line 219) | def __init__(self, config: InternVLConfig): method wrap_backbone_lora (line 261) | def wrap_backbone_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method wrap_qllama_lora (line 271) | def wrap_qllama_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method get_input_embeddings (line 282) | def get_input_embeddings(self): method set_input_embeddings (line 285) | def set_input_embeddings(self, value): method set_output_embeddings (line 288) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 291) | def get_output_embeddings(self) -> nn.Module: method _prepare_attention_mask (line 295) | def _prepare_attention_mask( method forward (line 329) | def forward( method generate (line 471) | def generate( method get_text_features (line 506) | def get_text_features( method get_image_features (line 555) | def get_image_features( class InternVL_C (line 602) | class InternVL_C(InternVLModel): method encode_image (line 604) | def encode_image(self, image): method encode_text (line 613) | def encode_text(self, text): method forward (line 626) | def forward(self, image, text): class InternVL_G (line 642) | class InternVL_G(InternVLModel): method encode_image (line 644) | def encode_image(self, image): method encode_text (line 658) | def encode_text(self, text): method forward (line 671) | def forward(self, image, text): FILE: internvl_g/internvl/model/internvl_stage2/modeling_qllama.py function _make_causal_mask (line 42) | def _make_causal_mask( function _expand_mask (line 60) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class LlamaRMSNorm (line 74) | class LlamaRMSNorm(nn.Module): method __init__ (line 75) | def __init__(self, hidden_size, eps=1e-6): method forward (line 83) | def forward(self, hidden_states): class LlamaRotaryEmbedding (line 109) | class LlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 110) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 124) | def forward(self, x, seq_len=None): class FixedLlamaRotaryEmbedding (line 141) | class FixedLlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 142) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 155) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 165) | def forward(self, x, seq_len=None): function rotate_half (line 179) | def rotate_half(x): function apply_rotary_pos_emb (line 186) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class LlamaMLP (line 196) | class LlamaMLP(nn.Module): method __init__ (line 197) | def __init__( method forward (line 209) | def forward(self, x): class LlamaAttention (line 213) | class LlamaAttention(nn.Module): method __init__ (line 216) | def __init__(self, config: LlamaConfig): method _shape (line 235) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 238) | def forward( class LlamaCrossAttention (line 304) | class LlamaCrossAttention(nn.Module): method __init__ (line 307) | def __init__(self, config: LlamaConfig): method _shape (line 329) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 332) | def forward( class LlamaDecoderLayer (line 408) | class LlamaDecoderLayer(nn.Module): method __init__ (line 409) | def __init__(self, config: LlamaConfig, use_cross_attn: bool): method forward (line 423) | def forward( class LlamaPreTrainedModel (line 520) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 527) | def _init_weights(self, module): method _set_gradient_checkpointing (line 538) | def _set_gradient_checkpointing(self, module, value=False): class LlamaModel (line 613) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 621) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 636) | def get_input_embeddings(self): method set_input_embeddings (line 639) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 643) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 667) | def forward( method forward_train (line 783) | def forward_train( class LlamaForCausalLM (line 915) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 916) | def __init__(self, config): method get_input_embeddings (line 925) | def get_input_embeddings(self): method set_input_embeddings (line 928) | def set_input_embeddings(self, value): method get_output_embeddings (line 931) | def get_output_embeddings(self): method set_output_embeddings (line 934) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 937) | def set_decoder(self, decoder): method get_decoder (line 940) | def get_decoder(self): method forward (line 945) | def forward( method prepare_inputs_for_generation (line 1035) | def prepare_inputs_for_generation( method _reorder_cache (line 1069) | def _reorder_cache(past_key_values, beam_idx): FILE: internvl_g/internvl/model/internvl_stage2_retrieval/__init__.py class InternVLTokenizer (line 23) | class InternVLTokenizer(nn.Module): method __init__ (line 24) | def __init__(self, model_path): method forward (line 30) | def forward(self, text, prefix='summarize:'): function build_transform (line 39) | def build_transform(task, image_size=224, mean=[0.485, 0.456, 0.406], st... function load_internvl_c_huggingface (line 56) | def load_internvl_c_huggingface(ckpt_path, device, task): function load_internvl_g_huggingface (line 73) | def load_internvl_g_huggingface(ckpt_path, device, task): FILE: internvl_g/internvl/model/internvl_stage2_retrieval/configuration_intern_vit.py class InternVisionConfig (line 15) | class InternVisionConfig(PretrainedConfig): method __init__ (line 63) | def __init__( method from_pretrained (line 105) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... FILE: internvl_g/internvl/model/internvl_stage2_retrieval/configuration_internvl.py class InternVLConfig (line 17) | class InternVLConfig(PretrainedConfig): method __init__ (line 57) | def __init__( method to_dict (line 97) | def to_dict(self): FILE: internvl_g/internvl/model/internvl_stage2_retrieval/flash_attention.py class FlashAttention (line 15) | class FlashAttention(nn.Module): method __init__ (line 26) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 31) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: internvl_g/internvl/model/internvl_stage2_retrieval/modeling_intern_vit.py class InternRMSNorm (line 33) | class InternRMSNorm(nn.Module): method __init__ (line 34) | def __init__(self, hidden_size, eps=1e-6): method forward (line 39) | def forward(self, hidden_states): class InternVisionEmbeddings (line 61) | class InternVisionEmbeddings(nn.Module): method __init__ (line 62) | def __init__(self, config: InternVisionConfig): method forward (line 82) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class InternAttention (line 93) | class InternAttention(nn.Module): method __init__ (line 96) | def __init__(self, config: InternVisionConfig): method _naive_attn (line 126) | def _naive_attn(self, x): method _flash_attn (line 145) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 162) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternMLP (line 167) | class InternMLP(nn.Module): method __init__ (line 168) | def __init__(self, config: InternVisionConfig): method forward (line 175) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class InternVisionEncoderLayer (line 182) | class InternVisionEncoderLayer(nn.Module): method __init__ (line 183) | def __init__(self, config: InternVisionConfig, drop_path_rate: float): method forward (line 198) | def forward( class InternVisionEncoder (line 213) | class InternVisionEncoder(nn.Module): method __init__ (line 223) | def __init__(self, config: InternVisionConfig): method forward (line 232) | def forward( class InternVisionModel (line 279) | class InternVisionModel(PreTrainedModel): method __init__ (line 283) | def __init__(self, config: InternVisionConfig): method resize_pos_embeddings (line 290) | def resize_pos_embeddings(self, old_size, new_size, patch_size): method get_input_embeddings (line 301) | def get_input_embeddings(self): method forward (line 304) | def forward( FILE: internvl_g/internvl/model/internvl_stage2_retrieval/modeling_internvl.py class InternVLPreTrainedModel (line 35) | class InternVLPreTrainedModel(PreTrainedModel): method _set_gradient_checkpointing (line 69) | def _set_gradient_checkpointing(self, module, value=False): class CrossAttention (line 76) | class CrossAttention(nn.Module): method __init__ (line 77) | def __init__( method forward (line 108) | def forward(self, x, k=None, v=None): class AttentiveBlock (line 141) | class AttentiveBlock(nn.Module): method __init__ (line 143) | def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None, drop... method forward (line 156) | def forward(self, x_q, x_kv, pos_q, pos_k, bool_masked_pos, rel_pos_bi... class AttentionPoolingBlock (line 165) | class AttentionPoolingBlock(AttentiveBlock): method forward (line 167) | def forward(self, x): class InternVLModelOutput (line 176) | class InternVLModelOutput(ModelOutput): method to_tuple (line 186) | def to_tuple(self) -> Tuple[Any]: class GatherLayer (line 195) | class GatherLayer(torch.autograd.Function): method forward (line 200) | def forward(ctx, input): method backward (line 207) | def backward(ctx, grads): class InternVLModel (line 215) | class InternVLModel(InternVLPreTrainedModel): method __init__ (line 219) | def __init__(self, config: InternVLConfig): method wrap_backbone_lora (line 261) | def wrap_backbone_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method wrap_qllama_lora (line 271) | def wrap_qllama_lora(self, r=128, lora_alpha=256, lora_dropout=0.05): method get_input_embeddings (line 282) | def get_input_embeddings(self): method set_input_embeddings (line 285) | def set_input_embeddings(self, value): method set_output_embeddings (line 288) | def set_output_embeddings(self, new_embeddings): method get_output_embeddings (line 291) | def get_output_embeddings(self) -> nn.Module: method _prepare_attention_mask (line 295) | def _prepare_attention_mask( method forward (line 322) | def forward( method generate (line 456) | def generate( method get_text_features (line 491) | def get_text_features( method get_image_features (line 540) | def get_image_features( class InternVL_C (line 587) | class InternVL_C(InternVLModel): method encode_image (line 589) | def encode_image(self, image): method encode_text (line 598) | def encode_text(self, text): method forward (line 611) | def forward(self, image, text): class InternVL_G (line 627) | class InternVL_G(InternVLModel): method encode_image (line 629) | def encode_image(self, image): method encode_text (line 643) | def encode_text(self, text): method forward (line 656) | def forward(self, image, text): FILE: internvl_g/internvl/model/internvl_stage2_retrieval/modeling_qllama.py function _make_causal_mask (line 42) | def _make_causal_mask( function _expand_mask (line 60) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class LlamaRMSNorm (line 74) | class LlamaRMSNorm(nn.Module): method __init__ (line 75) | def __init__(self, hidden_size, eps=1e-6): method forward (line 83) | def forward(self, hidden_states): class LlamaRotaryEmbedding (line 109) | class LlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 110) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 124) | def forward(self, x, seq_len=None): class FixedLlamaRotaryEmbedding (line 141) | class FixedLlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 142) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 155) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 165) | def forward(self, x, seq_len=None): function rotate_half (line 179) | def rotate_half(x): function apply_rotary_pos_emb (line 186) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class LlamaMLP (line 196) | class LlamaMLP(nn.Module): method __init__ (line 197) | def __init__( method forward (line 209) | def forward(self, x): class LlamaAttention (line 213) | class LlamaAttention(nn.Module): method __init__ (line 216) | def __init__(self, config: LlamaConfig): method _shape (line 235) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 238) | def forward( class LlamaCrossAttention (line 304) | class LlamaCrossAttention(nn.Module): method __init__ (line 307) | def __init__(self, config: LlamaConfig): method _shape (line 329) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 332) | def forward( class LlamaDecoderLayer (line 408) | class LlamaDecoderLayer(nn.Module): method __init__ (line 409) | def __init__(self, config: LlamaConfig, use_cross_attn: bool): method forward (line 423) | def forward( class LlamaPreTrainedModel (line 520) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 527) | def _init_weights(self, module): method _set_gradient_checkpointing (line 538) | def _set_gradient_checkpointing(self, module, value=False): class LlamaModel (line 613) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 621) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 636) | def get_input_embeddings(self): method set_input_embeddings (line 639) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 643) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 667) | def forward( method forward_train (line 783) | def forward_train( class LlamaForCausalLM (line 915) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 916) | def __init__(self, config): method get_input_embeddings (line 925) | def get_input_embeddings(self): method set_input_embeddings (line 928) | def set_input_embeddings(self, value): method get_output_embeddings (line 931) | def get_output_embeddings(self): method set_output_embeddings (line 934) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 937) | def set_decoder(self, decoder): method get_decoder (line 940) | def get_decoder(self): method forward (line 945) | def forward( method prepare_inputs_for_generation (line 1035) | def prepare_inputs_for_generation( method _reorder_cache (line 1069) | def _reorder_cache(past_key_values, beam_idx): FILE: internvl_g/internvl/train/dataset.py function build_transform (line 13) | def build_transform(input_size): class FlickrDataset (line 27) | class FlickrDataset(Dataset): method __init__ (line 30) | def __init__(self, metas, tokenizer, data_args): method __len__ (line 54) | def __len__(self): method process_single_caption (line 57) | def process_single_caption(self, caption, max_words=50): method preprocess (line 69) | def preprocess(self, image, caption, neg_caption): method __getitem__ (line 135) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class COCODataset (line 157) | class COCODataset(Dataset): method __init__ (line 160) | def __init__(self, metas, tokenizer, data_args): method __len__ (line 183) | def __len__(self): method process_single_caption (line 186) | def process_single_caption(self, caption, max_words=50): method preprocess (line 198) | def preprocess(self, image, caption, neg_caption): method __getitem__ (line 264) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: FILE: internvl_g/internvl/train/internvl_stage2_finetune.py class ModelArguments (line 51) | class ModelArguments: class DataTrainingArguments (line 93) | class DataTrainingArguments: function main (line 126) | def main(): FILE: internvl_g/internvl/train/trainer_monkey_patch.py function get_num_layer_for_vit_and_qllama (line 13) | def get_num_layer_for_vit_and_qllama(var_name, vit_num_max_layer, llama_... function param_classification (line 40) | def param_classification(name): function create_optimizer (line 57) | def create_optimizer(self): function replace_create_optimizer (line 148) | def replace_create_optimizer(): FILE: segmentation/mmcv_custom/__init__.py class ZeroAdamW (line 15) | class ZeroAdamW(ZeroRedundancyOptimizer): method __init__ (line 16) | def __init__(self, params, optimizer_class=torch.optim.AdamW, **kwargs): class ZeroHook (line 26) | class ZeroHook(Hook): method __init__ (line 27) | def __init__(self, interval): method after_epoch (line 30) | def after_epoch(self, runner): method after_train_iter (line 33) | def after_train_iter(self, runner): class ToBFloat16Hook (line 39) | class ToBFloat16Hook(Hook): method before_run (line 41) | def before_run(self, runner): class ToFloat16Hook (line 52) | class ToFloat16Hook(Hook): method before_run (line 54) | def before_run(self, runner): FILE: segmentation/mmcv_custom/ddp_hooks.py function _allreduce_fut (line 7) | def _allreduce_fut( function allreduce_hook (line 23) | def allreduce_hook( function fp16_compress_hook (line 41) | def fp16_compress_hook( function bf16_compress_hook (line 74) | def bf16_compress_hook( function fp16_compress_wrapper (line 109) | def fp16_compress_wrapper( function bf16_compress_wrapper (line 145) | def bf16_compress_wrapper( FILE: segmentation/mmcv_custom/layer_decay_optimizer_constructor.py function get_num_layer_for_vit (line 19) | def get_num_layer_for_vit(var_name, num_max_layer): class CustomLayerDecayOptimizerConstructor (line 37) | class CustomLayerDecayOptimizerConstructor(DefaultOptimizerConstructor): method add_params (line 38) | def add_params(self, params, module, prefix='', is_dcn_module=None): FILE: segmentation/mmseg_custom/datasets/ade.py class ADE20KDataset (line 15) | class ADE20KDataset(CustomDataset): method __init__ (line 88) | def __init__(self, max_image_num=None, **kwargs): method results2img (line 100) | def results2img(self, results, imgfile_prefix, to_label_id, indices=No... method format_results (line 141) | def format_results(self, FILE: segmentation/mmseg_custom/datasets/pipelines/transform.py class SETR_Resize (line 12) | class SETR_Resize(object): method __init__ (line 39) | def __init__(self, method random_select (line 70) | def random_select(img_scales): method random_sample (line 88) | def random_sample(img_scales): method random_sample_ratio (line 115) | def random_sample_ratio(img_scale, ratio_range): method _random_scale (line 141) | def _random_scale(self, results): method _resize_img (line 174) | def _resize_img(self, results): method _resize_seg (line 212) | def _resize_seg(self, results): method __call__ (line 225) | def __call__(self, results): method __repr__ (line 243) | def __repr__(self): class PadShortSide (line 253) | class PadShortSide(object): method __init__ (line 266) | def __init__(self, size=None, pad_val=0, seg_pad_val=255): method _pad_img (line 273) | def _pad_img(self, results): method _pad_seg (line 286) | def _pad_seg(self, results): method __call__ (line 293) | def __call__(self, results): method __repr__ (line 310) | def __repr__(self): FILE: segmentation/mmseg_custom/models/backbones/flash_attention.py class FlashAttention (line 14) | class FlashAttention(nn.Module): method __init__ (line 25) | def __init__(self, softmax_scale=None, attention_dropout=0.0, device=N... method forward (line 30) | def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens... FILE: segmentation/mmseg_custom/models/backbones/intern_vit_6b.py function _freeze_params (line 29) | def _freeze_params(module): class LayerNorm (line 34) | class LayerNorm(nn.Module): method __init__ (line 41) | def __init__(self, normalized_shape, eps=1e-6, data_format='channels_f... method forward (line 51) | def forward(self, x): class RMSNorm (line 65) | class RMSNorm(nn.Module): method __init__ (line 66) | def __init__(self, hidden_size, eps=1e-6): method forward (line 71) | def forward(self, hidden_states): class LayerScale (line 93) | class LayerScale(nn.Module): method __init__ (line 94) | def __init__(self, dim, init_values=1e-5, inplace=False, force_fp32=Fa... method forward (line 101) | def forward(self, x): class Attention (line 111) | class Attention(nn.Module): method __init__ (line 112) | def __init__(self, dim, num_heads=8, qkv_bias=False, attn_drop=0., pro... method _naive_attn (line 134) | def _naive_attn(self, x): method _flash_attn (line 153) | def _flash_attn(self, x, key_padding_mask=None, need_weights=False): method forward (line 170) | def forward(self, x): class Mlp (line 175) | class Mlp(nn.Module): method __init__ (line 179) | def __init__(self, in_features, hidden_features=None, out_features=Non... method forward (line 193) | def forward(self, x): class Block (line 202) | class Block(nn.Module): method __init__ (line 204) | def __init__( method forward (line 228) | def forward(self, x): class PatchEmbed (line 241) | class PatchEmbed(nn.Module): method __init__ (line 245) | def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=... method forward (line 259) | def forward(self, x, **kwargs): class InternViT6B (line 269) | class InternViT6B(BaseModule): method __init__ (line 271) | def __init__(self, in_chans=3, patch_size=14, img_size=224, pretrain_s... method _init_weights (line 347) | def _init_weights(self, m): method init_weights (line 362) | def init_weights(self, pretrained=None): method dtype (line 392) | def dtype(self): method forward (line 395) | def forward(self, x): FILE: segmentation/mmseg_custom/models/decode_heads/fcn_head.py class FCNHead (line 10) | class FCNHead(BaseDecodeHead): method __init__ (line 23) | def __init__(self, method _forward_feature (line 79) | def _forward_feature(self, inputs): method forward (line 96) | def forward(self, inputs): FILE: segmentation/test.py function parse_args (line 26) | def parse_args(): function main (line 115) | def main(): FILE: segmentation/train.py function parse_args (line 27) | def parse_args(): function main (line 104) | def main(): FILE: streamlit_demo/api.py function get_model_list (line 15) | def get_model_list(controller_url): function get_selected_worker_ip (line 23) | def get_selected_worker_ip(controller_url, selected_model): function pil_image_to_base64 (line 30) | def pil_image_to_base64(image): FILE: streamlit_demo/app.py function get_conv_log_filename (line 41) | def get_conv_log_filename(): function get_model_list (line 47) | def get_model_list(): function load_upload_file_and_show (line 56) | def load_upload_file_and_show(): function get_selected_worker_ip (line 79) | def get_selected_worker_ip(): function save_chat_history (line 86) | def save_chat_history(): function generate_response (line 105) | def generate_response(messages): function pil_image_to_base64 (line 153) | def pil_image_to_base64(image): function clear_chat_history (line 159) | def clear_chat_history(): function clear_file_uploader (line 164) | def clear_file_uploader(): function combined_func (line 169) | def combined_func(func_list): function show_one_or_multiple_images (line 174) | def show_one_or_multiple_images(message, total_image_num, is_input=True): function find_bounding_boxes (line 194) | def find_bounding_boxes(response): function query_image_generation (line 227) | def query_image_generation(response, sd_worker_url, timeout=15): function regenerate (line 242) | def regenerate(): FILE: streamlit_demo/controller.py class DispatchMethod (line 25) | class DispatchMethod(Enum): method from_str (line 30) | def from_str(cls, name): class WorkerInfo (line 40) | class WorkerInfo: function heart_beat_controller (line 48) | def heart_beat_controller(controller): class Controller (line 54) | class Controller: method __init__ (line 55) | def __init__(self, dispatch_method: str): method register_worker (line 66) | def register_worker(self, worker_name: str, check_heart_beat: bool, method get_worker_status (line 85) | def get_worker_status(self, worker_name: str): method remove_worker (line 98) | def remove_worker(self, worker_name: str): method refresh_all_workers (line 101) | def refresh_all_workers(self): method list_models (line 109) | def list_models(self): method get_worker_address (line 131) | def get_worker_address(self, model_name: str): method receive_heart_beat (line 167) | def receive_heart_beat(self, worker_name: str, queue_length: int): method remove_stable_workers_by_expiration (line 177) | def remove_stable_workers_by_expiration(self): method worker_api_generate_stream (line 187) | def worker_api_generate_stream(self, params): method worker_api_get_status (line 213) | def worker_api_get_status(self): function register_worker (line 236) | async def register_worker(request: Request): function refresh_all_workers (line 244) | async def refresh_all_workers(): function list_models (line 249) | async def list_models(): function get_worker_address (line 255) | async def get_worker_address(request: Request): function receive_heart_beat (line 262) | async def receive_heart_beat(request: Request): function worker_api_generate_stream (line 270) | async def worker_api_generate_stream(request: Request): function worker_api_get_status (line 277) | async def worker_api_get_status(request: Request): FILE: streamlit_demo/library.py class Library (line 16) | class Library(): method __init__ (line 32) | def __init__(self, images, image_alignment='end', number_of_columns=5): method create (line 40) | def create(_self, images, image_alignment, number_of_columns): FILE: streamlit_demo/model_worker.py function load_image_from_base64 (line 40) | def load_image_from_base64(image): function build_transform (line 44) | def build_transform(input_size): function find_closest_aspect_ratio (line 55) | def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height... function dynamic_preprocess (line 71) | def dynamic_preprocess(image, min_num=1, max_num=6, image_size=448, use_... function heart_beat_worker (line 110) | def heart_beat_worker(controller): function split_model (line 116) | def split_model(model_name, vit_alpha=0.5): class ModelWorker (line 152) | class ModelWorker: method __init__ (line 153) | def __init__(self, controller_addr, worker_addr, worker_id, model_path... method reload_model (line 202) | def reload_model(self): method register_to_controller (line 222) | def register_to_controller(self): method send_heart_beat (line 234) | def send_heart_beat(self): method get_queue_length (line 255) | def get_queue_length(self): method get_status (line 262) | def get_status(self): method generate_stream (line 270) | def generate_stream(self, params): method generate_stream_gate (line 370) | def generate_stream_gate(self, params): function release_model_semaphore (line 400) | def release_model_semaphore(fn=None): function generate_stream (line 407) | async def generate_stream(request: Request): function get_status (line 423) | async def get_status(request: Request): FILE: streamlit_demo/sd_worker.py class CaptionRequest (line 25) | class CaptionRequest(BaseModel): function generate_image (line 31) | async def generate_image(request: CaptionRequest): FILE: streamlit_demo/utils.py function build_logger (line 15) | def build_logger(logger_name, logger_filename): class StreamToLogger (line 58) | class StreamToLogger(object): method __init__ (line 62) | def __init__(self, logger, log_level=logging.INFO): method __getattr__ (line 68) | def __getattr__(self, attr): method write (line 71) | def write(self, buf): method flush (line 85) | def flush(self): function disable_torch_init (line 91) | def disable_torch_init(): function violates_moderation (line 100) | def violates_moderation(text): function pretty_print_semaphore (line 121) | def pretty_print_semaphore(semaphore): FILE: video_retrieval/test_msrvtt.py function recall_at_k (line 15) | def recall_at_k(scores, positive_pairs, k): function batchify (line 39) | def batchify(func, X, Y, batch_size, device, *args, **kwargs): function validate_msrvtt (line 50) | def validate_msrvtt(model, tokenizer, image_processor, root, metadata,