SYMBOL INDEX (596 symbols across 50 files) FILE: clipcrop.py function clip_boxes (line 16) | def clip_boxes(boxes, shape): function find_position (line 28) | def find_position(parent: Image, child: Image): class CropClip (line 40) | class CropClip: method __init__ (line 41) | def __init__(self): method get_center (line 59) | def get_center(self, image: Image, prompt: str): method unload (line 127) | def unload(self): method load (line 135) | def load(self): FILE: dbimutils.py function smart_imread (line 9) | def smart_imread(img, flag=cv2.IMREAD_UNCHANGED): function smart_24bit (line 19) | def smart_24bit(img): function make_square (line 32) | def make_square(img, target_size): function smart_resize (line 49) | def smart_resize(img, size): FILE: file_manager.py function clean_string (line 10) | def clean_string(s): class ImageData (line 28) | class ImageData: method __init__ (line 37) | def __init__(self, image_path): method read_caption (line 44) | def read_caption(self): method split_caption (line 55) | def split_caption(self): method update_image (line 61) | def update_image(self, image: Image, save_file: bool = False): method update_caption (line 72) | def update_caption(self, caption: str, save_file: bool = False): method get_image (line 80) | def get_image(self): class FileManager (line 84) | class FileManager: method __init__ (line 94) | def __init__(self): method __new__ (line 97) | def __new__(cls): method clear (line 102) | def clear(self): method load_files (line 110) | def load_files(self): method filtered_files (line 123) | def filtered_files(self, for_gallery: bool = False): method all_files (line 129) | def all_files(self, for_gallery: bool = False) -> List[ImageData]: method selected_files (line 135) | def selected_files(self, for_gallery: bool = False) -> List[ImageData]: method filtered_and_selected_files (line 141) | def filtered_and_selected_files(self, for_gallery: bool = False) -> Li... method update_files (line 147) | def update_files(self, files: List[ImageData]): method update_file (line 151) | def update_file(self, file: ImageData): method update_filters (line 161) | def update_filters(self): method all_captions (line 253) | def all_captions(self): FILE: interrogators/blip_interrogator.py class BLIPInterrogator (line 11) | class BLIPInterrogator(Interrogator): method __init__ (line 15) | def __init__(self, params: ProcessParams): method __new__ (line 22) | def __new__(cls, params: ProcessParams): method _init (line 34) | def _init(self, params: ProcessParams): method interrogate (line 40) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... method unload (line 51) | def unload(self): method load (line 59) | def load(self): FILE: interrogators/booru_interrogator.py class BooruInterrogator (line 13) | class BooruInterrogator(Interrogator): method __init__ (line 16) | def __init__(self, params: ProcessParams) -> None: method unload (line 22) | def unload(self): method load (line 25) | def load(self): method interrogate (line 29) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... FILE: interrogators/idefics2_interrogator.py class Idefics2Interrogator (line 37) | class Idefics2Interrogator(Interrogator): method __init__ (line 42) | def __init__(self, params: ProcessParams): method interrogate (line 57) | def interrogate(self, image: Image, params: ProcessParams = None, unlo... method _to_cpu (line 93) | def _to_cpu(self): method _to_gpu (line 114) | def _to_gpu(self): method unload (line 128) | def unload(self): method load (line 133) | def load(self): FILE: interrogators/interrogator.py class Interrogator (line 16) | class Interrogator: method __init__ (line 17) | def __init__(self, params: ProcessParams) -> None: method interrogate (line 24) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... method unload (line 27) | def unload(self): method load (line 34) | def load(self): class InterrogatorRegistry (line 45) | class InterrogatorRegistry: method __new__ (line 48) | def __new__(cls): method _init (line 54) | def _init(self): method register (line 57) | def register(self, interrogator: Interrogator): method get_interrogator (line 60) | def get_interrogator(self, interrogator_name: str) -> Interrogator: method get_interrogators (line 63) | def get_interrogators(self): method unload (line 66) | def unload(self): method load (line 70) | def load(self): method list_interrogators (line 75) | def list_interrogators(return_cls=False): FILE: interrogators/llava2_interrogator.py class LLAVA2Interrogator (line 43) | class LLAVA2Interrogator(Interrogator): method __init__ (line 48) | def __init__(self, params: ProcessParams): method interrogate (line 62) | def interrogate(self, image: Image, params: ProcessParams = None, unlo... method _to_cpu (line 113) | def _to_cpu(self): method _to_gpu (line 134) | def _to_gpu(self): method unload (line 147) | def unload(self): method load (line 152) | def load(self): FILE: interrogators/moondream_interrogator.py class MoonDreamInterrogator (line 10) | class MoonDreamInterrogator(Interrogator): method __init__ (line 13) | def __init__(self, params: ProcessParams): method interrogate (line 20) | def interrogate(self, image: Image, params: ProcessParams = None, unlo... method _to_gpu (line 29) | def _to_gpu(self): method _to_cpu (line 32) | def _to_cpu(self): method load (line 35) | def load(self): FILE: interrogators/wolf_interrogator.py class MoatInterrogator (line 27) | class MoatInterrogator(Interrogator): method __init__ (line 30) | def __init__(self, params: ProcessParams) -> None: method _setup (line 34) | def _setup(self): method interrogate (line 38) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... class SwinInterrogator (line 45) | class SwinInterrogator(Interrogator): method __init__ (line 48) | def __init__(self, params: ProcessParams) -> None: method _setup (line 52) | def _setup(self): method interrogate (line 56) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... class ConvInterrogator (line 63) | class ConvInterrogator(Interrogator): method __init__ (line 66) | def __init__(self, params: ProcessParams) -> None: method _setup (line 70) | def _setup(self): method interrogate (line 74) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... class Conv2Interrogator (line 81) | class Conv2Interrogator(Interrogator): method __init__ (line 84) | def __init__(self, params: ProcessParams) -> None: method _setup (line 88) | def _setup(self): method interrogate (line 92) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... class VitInterrogator (line 99) | class VitInterrogator(Interrogator): method __init__ (line 102) | def __init__(self, params: ProcessParams) -> None: method _setup (line 106) | def _setup(self): method interrogate (line 110) | def interrogate(self, image: Image, params: ProcessParams, unload: boo... function predict (line 117) | def predict( function load_model (line 174) | def load_model(model_path, device): function smart_imread (line 183) | def smart_imread(img, flag=cv2.IMREAD_UNCHANGED): function smart_24bit (line 193) | def smart_24bit(img): function make_square (line 206) | def make_square(img, target_size): function smart_resize (line 223) | def smart_resize(img, size): function load_labels (line 232) | def load_labels() -> list[str]: FILE: javascript/smart_process.js function start_smart_process (line 1) | function start_smart_process() { function atEnd (line 10) | function atEnd() { FILE: model_download.py function fetch_model (line 10) | def fetch_model(model_repo, model_type, single_file=False): function disable_safe_unpickle (line 24) | def disable_safe_unpickle(): function enable_safe_unpickle (line 36) | def enable_safe_unpickle(): FILE: mplug_owl2/conversation.py class SeparatorStyle (line 6) | class SeparatorStyle(Enum): class Conversation (line 17) | class Conversation: method get_prompt (line 30) | def get_prompt(self): method append_message (line 119) | def append_message(self, role, message): method get_images (line 122) | def get_images(self, return_pil=False): method to_gradio_chatbot (line 172) | def to_gradio_chatbot(self): method copy (line 203) | def copy(self): method dict (line 214) | def dict(self): FILE: mplug_owl2/evaluate/evaluate_caption.py class CaptionDataset (line 27) | class CaptionDataset(torch.utils.data.Dataset): method __init__ (line 29) | def __init__(self, train, test, prompt, image_processor, few_shot=0): method __len__ (line 38) | def __len__(self): method __getitem__ (line 41) | def __getitem__(self, idx): function collate_fn (line 56) | def collate_fn(inputs, tokenizer): class InferenceSampler (line 75) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 77) | def __init__(self, size): method _get_local_indices (line 86) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 95) | def __iter__(self): method __len__ (line 98) | def __len__(self): FILE: mplug_owl2/evaluate/evaluate_mmbench.py function mapping_to_annotation (line 51) | def mapping_to_annotation(results, raw_annotation): function generate_submission_file (line 69) | def generate_submission_file(results, raw_annotation): function collate_fn (line 86) | def collate_fn(batches, tokenizer): class VQADataset (line 107) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 109) | def __init__(self, test, prompt, image_processor): method __len__ (line 116) | def __len__(self): method __getitem__ (line 119) | def __getitem__(self, idx): class InferenceSampler (line 144) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 146) | def __init__(self, size): method _get_local_indices (line 155) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 164) | def __iter__(self): method __len__ (line 167) | def __len__(self): FILE: mplug_owl2/evaluate/evaluate_mme.py class calculate_metrics (line 36) | class calculate_metrics: method divide_chunks (line 37) | def divide_chunks(self, l, n=2): method parse_pred_ans (line 44) | def parse_pred_ans(self, pred_ans): method compute_metric (line 61) | def compute_metric(self, gts, preds): method process_result (line 107) | def process_result(self, outputs): function collate_fn (line 172) | def collate_fn(batches, tokenizer): class VQADataset (line 196) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 198) | def __init__(self, test, base_dir, prompt, image_processor): method __len__ (line 218) | def __len__(self): method __getitem__ (line 221) | def __getitem__(self, idx): class InferenceSampler (line 250) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 252) | def __init__(self, size): method _get_local_indices (line 261) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 270) | def __iter__(self): method __len__ (line 273) | def __len__(self): FILE: mplug_owl2/evaluate/evaluate_mmmu.py function parse_multi_choice_response (line 72) | def parse_multi_choice_response(response, all_choices, index2ans): function check_is_number (line 127) | def check_is_number(string): function normalize_str (line 138) | def normalize_str(string): function extract_numbers (line 162) | def extract_numbers(string): function parse_open_response (line 184) | def parse_open_response(response): function eval_multi_choice (line 237) | def eval_multi_choice(gold_i, pred_i): function eval_open (line 253) | def eval_open(gold_i, pred_i): function evaluate (line 281) | def evaluate(samples): function collate_fn (line 306) | def collate_fn(batches, tokenizer): class VQADataset (line 329) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 331) | def __init__(self, split, image_processor, eval_split='dev'): method __len__ (line 345) | def __len__(self): method __getitem__ (line 348) | def __getitem__(self, idx): class InferenceSampler (line 391) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 393) | def __init__(self, size): method _get_local_indices (line 402) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 411) | def __iter__(self): method __len__ (line 414) | def __len__(self): FILE: mplug_owl2/evaluate/evaluate_vqa.py function collate_fn (line 55) | def collate_fn(batches, tokenizer): class VQADataset (line 77) | class VQADataset(torch.utils.data.Dataset): method __init__ (line 79) | def __init__(self, train, test, prompt, image_processor, few_shot): method __len__ (line 88) | def __len__(self): method __getitem__ (line 91) | def __getitem__(self, idx): class InferenceSampler (line 108) | class InferenceSampler(torch.utils.data.sampler.Sampler): method __init__ (line 110) | def __init__(self, size): method _get_local_indices (line 119) | def _get_local_indices(total_size, world_size, rank): method __iter__ (line 128) | def __iter__(self): method __len__ (line 131) | def __len__(self): FILE: mplug_owl2/evaluate/mmbench_converter.py function decode_base64_to_image (line 15) | def decode_base64_to_image(base64_string): FILE: mplug_owl2/evaluate/vqa.py class VQA (line 31) | class VQA: method __init__ (line 33) | def __init__(self, annotation_file=None, question_file=None): method createIndex (line 55) | def createIndex(self): method info (line 73) | def info(self): method getQuesIds (line 81) | def getQuesIds(self, imgIds=[], quesTypes=[], ansTypes=[]): method getImgIds (line 114) | def getImgIds(self, quesIds=[], quesTypes=[], ansTypes=[]): method loadQA (line 143) | def loadQA(self, ids=[]): method showQA (line 154) | def showQA(self, anns): method loadRes (line 168) | def loadRes(self, resFile, quesFile): FILE: mplug_owl2/evaluate/vqa_eval.py class VQAEval (line 18) | class VQAEval: method __init__ (line 20) | def __init__(self, vqa=None, vqaRes=None, n=2): method evaluate (line 194) | def evaluate(self, quesIds=None): method processPunctuation (line 254) | def processPunctuation(self, inText): method processDigitArticle (line 265) | def processDigitArticle(self, inText): method setAccuracy (line 280) | def setAccuracy(self, accQA, accQuesType, accAnsType): method setEvalQA (line 298) | def setEvalQA(self, quesId, acc): method setEvalQuesType (line 301) | def setEvalQuesType(self, quesId, quesType, acc): method setEvalAnsType (line 306) | def setEvalAnsType(self, quesId, ansType, acc): method updateProgress (line 311) | def updateProgress(self, progress): class EvalAIAnswerProcessor (line 337) | class EvalAIAnswerProcessor: method __init__ (line 508) | def __init__(self, *args, **kwargs): method word_tokenize (line 511) | def word_tokenize(self, word): method process_punctuation (line 516) | def process_punctuation(self, in_text): method process_digit_article (line 528) | def process_digit_article(self, in_text): method __call__ (line 543) | def __call__(self, item): FILE: mplug_owl2/local_serve/local_web_server.py function get_conv_log_filename (line 26) | def get_conv_log_filename(): function load_demo (line 41) | def load_demo(url_params, request: gr.Request): function vote_last_response (line 47) | def vote_last_response(state, vote_type, request: gr.Request): function upvote_last_response (line 58) | def upvote_last_response(state, request: gr.Request): function downvote_last_response (line 64) | def downvote_last_response(state, request: gr.Request): function flag_last_response (line 70) | def flag_last_response(state, request: gr.Request): function regenerate (line 76) | def regenerate(state, image_process_mode, request: gr.Request): function clear_history (line 86) | def clear_history(request: gr.Request): function add_text (line 92) | def add_text(state, text, image, image_process_mode, request: gr.Request): function http_bot (line 118) | def http_bot(state, temperature, top_p, max_new_tokens, request: gr.Requ... function build_demo (line 246) | def build_demo(embed_mode): FILE: mplug_owl2/local_serve/model_worker.py class ModelWorker (line 29) | class ModelWorker: method __init__ (line 30) | def __init__(self, model_path, model_base, model_name, load_8bit, load... method generate_stream (line 50) | def generate_stream(self, params): method generate_stream_gate (line 119) | def generate_stream_gate(self, params): FILE: mplug_owl2/mm_utils.py function load_image_from_base64 (line 11) | def load_image_from_base64(image): function expand2square (line 15) | def expand2square(pil_img, background_color): function process_images (line 29) | def process_images(images, image_processor, model_cfg=None): function tokenizer_image_token (line 53) | def tokenizer_image_token(prompt, tokenizer, image_token_index=IMAGE_TOK... function get_model_name_from_path (line 76) | def get_model_name_from_path(model_path): class KeywordsStoppingCriteria (line 85) | class KeywordsStoppingCriteria(StoppingCriteria): method __init__ (line 86) | def __init__(self, keywords, tokenizer, input_ids): method __call__ (line 100) | def __call__(self, output_ids: torch.LongTensor, scores: torch.FloatTe... FILE: mplug_owl2/model/builder.py function load_pretrained_model (line 30) | def load_pretrained_model(model_path, model_base, model_name, load_8bit=... FILE: mplug_owl2/model/configuration_mplug_owl2.py class LlamaConfig (line 15) | class LlamaConfig(PretrainedConfig): method __init__ (line 99) | def __init__( method _rope_scaling_validation (line 152) | def _rope_scaling_validation(self): class MplugOwlVisionConfig (line 174) | class MplugOwlVisionConfig(PretrainedConfig): method __init__ (line 216) | def __init__( method from_pretrained (line 255) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... class MplugOwlVisualAbstractorConfig (line 271) | class MplugOwlVisualAbstractorConfig(PretrainedConfig): method __init__ (line 274) | def __init__( method from_pretrained (line 305) | def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.... class MPLUGOwl2Config (line 327) | class MPLUGOwl2Config(LlamaConfig): method __init__ (line 329) | def __init__(self, visual_config=None, **kwargs): class MPLUGOwl2QwenConfig (line 339) | class MPLUGOwl2QwenConfig(QWenConfig): method __init__ (line 341) | def __init__(self, visual_config=None, **kwargs): FILE: mplug_owl2/model/configuration_qwen.py class QWenConfig (line 9) | class QWenConfig(PretrainedConfig): method __init__ (line 13) | def __init__( FILE: mplug_owl2/model/convert_mplug_owl2_weight_to_hf.py function compute_intermediate_size (line 65) | def compute_intermediate_size(n): function read_json (line 69) | def read_json(path): function write_json (line 74) | def write_json(text, path): function write_model (line 79) | def write_model(model_path, function write_tokenizer (line 346) | def write_tokenizer(tokenizer_path, input_tokenizer_path): function main (line 354) | def main(): FILE: mplug_owl2/model/modeling_attn_mask_utils.py class AttentionMaskConverter (line 19) | class AttentionMaskConverter: method __init__ (line 35) | def __init__(self, is_causal: bool, sliding_window: Optional[int] = No... method to_causal_4d (line 44) | def to_causal_4d( method to_4d (line 77) | def to_4d( method _make_causal_mask (line 120) | def _make_causal_mask( method _expand_mask (line 150) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Opti... function _prepare_4d_causal_attention_mask (line 164) | def _prepare_4d_causal_attention_mask( function _prepare_4d_attention_mask (line 204) | def _prepare_4d_attention_mask(mask: torch.Tensor, dtype: torch.dtype, t... function _create_4d_causal_attention_mask (line 220) | def _create_4d_causal_attention_mask( FILE: mplug_owl2/model/modeling_llama2.py function repeat_kv (line 22) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class LlamaAttention (line 34) | class LlamaAttention(nn.Module): method __init__ (line 37) | def __init__(self, config: LlamaConfig): method _init_rope (line 65) | def _init_rope(self): method _shape (line 92) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 95) | def forward( class LlamaDecoderLayer (line 169) | class LlamaDecoderLayer(nn.Module): method __init__ (line 170) | def __init__(self, config: LlamaConfig, annoying_param): method forward (line 186) | def forward( function model_forward (line 243) | def model_forward( function causal_model_forward (line 373) | def causal_model_forward( function replace_llama_modality_adaptive (line 468) | def replace_llama_modality_adaptive(): FILE: mplug_owl2/model/modeling_mplug_owl2.py class MPLUGOwl2MetaModel (line 32) | class MPLUGOwl2MetaModel: method __init__ (line 33) | def __init__(self, config): method get_vision_tower (line 42) | def get_vision_tower(self): method get_visual_abstractor (line 48) | def get_visual_abstractor(self): class MPLUGOwl2MetaForCausalLM (line 55) | class MPLUGOwl2MetaForCausalLM(ABC): method get_model (line 57) | def get_model(self): method encode_images (line 60) | def encode_images(self, images): method prepare_inputs_labels_for_multimodal (line 65) | def prepare_inputs_labels_for_multimodal( function _expand_mask (line 215) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... function _make_causal_mask (line 231) | def _make_causal_mask( class MPLUGOwl2LlamaModel (line 252) | class MPLUGOwl2LlamaModel(MPLUGOwl2MetaModel, LlamaModel): method __init__ (line 255) | def __init__(self, config: MPLUGOwl2Config): method _prepare_decoder_attention_mask (line 258) | def _prepare_decoder_attention_mask( class MPLUGOwl2QWenModel (line 285) | class MPLUGOwl2QWenModel(MPLUGOwl2MetaModel, QWenModel): method __init__ (line 288) | def __init__(self, config: MPLUGOwl2QwenConfig): class MPLUGOwl2LlamaForCausalLM (line 292) | class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausal... method __init__ (line 295) | def __init__(self, config): method encode_images (line 304) | def encode_images(self, images): method get_model (line 309) | def get_model(self): method forward (line 312) | def forward( method prepare_inputs_for_generation (line 374) | def prepare_inputs_for_generation( class MPLUGOwl2QWenForCausalLM (line 397) | class MPLUGOwl2QWenForCausalLM(QWenLMHeadModel, MPLUGOwl2MetaForCausalLM): method __init__ (line 400) | def __init__(self, config): method get_model (line 458) | def get_model(self): method forward (line 461) | def forward( FILE: mplug_owl2/model/modeling_qwen.py function _import_flash_attn (line 78) | def _import_flash_attn(): function quantize_cache_v (line 118) | def quantize_cache_v(fdata, bits, qmax, qmin): function dequantize_cache_torch (line 140) | def dequantize_cache_torch(qdata, scale, zero): class FlashSelfAttention (line 144) | class FlashSelfAttention(torch.nn.Module): method __init__ (line 145) | def __init__( method unpad_input (line 162) | def unpad_input(self, hidden_states, attention_mask): method pad_input (line 171) | def pad_input(self, hidden_states, indices, batch, seqlen): method forward (line 177) | def forward(self, q, k, v, attention_mask=None): class QWenAttention (line 242) | class QWenAttention(nn.Module): method __init__ (line 243) | def __init__(self, config): method _attn (line 325) | def _attn(self, query, key, value, causal_mask=None, attention_mask=No... method _split_heads (line 396) | def _split_heads(self, tensor, num_heads, attn_head_size): method _merge_heads (line 401) | def _merge_heads(self, tensor, num_heads, attn_head_size): method forward (line 406) | def forward( class QWenMLP (line 564) | class QWenMLP(nn.Module): method __init__ (line 565) | def __init__(self, config): method forward (line 576) | def forward(self, hidden_states): class QWenBlock (line 584) | class QWenBlock(nn.Module): method __init__ (line 585) | def __init__(self, config): method forward (line 602) | def forward( class QWenPreTrainedModel (line 648) | class QWenPreTrainedModel(PreTrainedModel): method __init__ (line 656) | def __init__(self, *inputs, **kwargs): method _init_weights (line 659) | def _init_weights(self, module): method _set_gradient_checkpointing (line 682) | def _set_gradient_checkpointing(self, module, value=False): class QWenModel (line 687) | class QWenModel(QWenPreTrainedModel): method __init__ (line 690) | def __init__(self, config): method get_input_embeddings (line 737) | def get_input_embeddings(self): method embed_tokens (line 740) | def embed_tokens(self, input_ids): method set_input_embeddings (line 743) | def set_input_embeddings(self, new_embeddings): method get_ntk_alpha (line 746) | def get_ntk_alpha(self, true_seq_len): method forward (line 752) | def forward( class QWenLMHeadModel (line 943) | class QWenLMHeadModel(QWenPreTrainedModel): method __init__ (line 947) | def __init__(self, config): method get_output_embeddings (line 1004) | def get_output_embeddings(self): method set_output_embeddings (line 1007) | def set_output_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 1010) | def prepare_inputs_for_generation( method forward (line 1036) | def forward( method _reorder_cache (line 1100) | def _reorder_cache( method generate (line 1180) | def generate( class RotaryEmbedding (line 1227) | class RotaryEmbedding(torch.nn.Module): method __init__ (line 1228) | def __init__(self, dim, base=10000): method update_rotary_pos_emb_cache (line 1242) | def update_rotary_pos_emb_cache(self, seqlen, ntk_alpha=1.0): method forward (line 1265) | def forward(self, max_seq_len, ntk_alpha=1.0): function _rotate_half (line 1271) | def _rotate_half(x): function apply_rotary_pos_emb (line 1279) | def apply_rotary_pos_emb(t, freqs): class RMSNorm (line 1303) | class RMSNorm(torch.nn.Module): method __init__ (line 1304) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 1309) | def _norm(self, x): method forward (line 1312) | def forward(self, x): FILE: mplug_owl2/model/multiway.py class MultiwayNetwork (line 7) | class MultiwayNetwork(nn.Module): method __init__ (line 9) | def __init__(self, module_provider, num_multiway=2, out_features=None): method forward (line 14) | def forward(self, hidden_states, multiway_indices): FILE: mplug_owl2/model/utils.py function auto_upgrade (line 4) | def auto_upgrade(config): FILE: mplug_owl2/model/visual_encoder.py function get_abs_pos (line 14) | def get_abs_pos(abs_pos, tgt_size): function get_2d_sincos_pos_embed (line 34) | def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False): function get_2d_sincos_pos_embed_from_grid (line 52) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 63) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): class MplugOwlVisionEmbeddings (line 85) | class MplugOwlVisionEmbeddings(nn.Module): method __init__ (line 86) | def __init__(self, config): method forward (line 113) | def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor: class MplugOwlVisionAttention (line 129) | class MplugOwlVisionAttention(nn.Module): method __init__ (line 132) | def __init__(self, config): method _shape (line 149) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 152) | def forward( class MplugOwlMLP (line 237) | class MplugOwlMLP(nn.Module): method __init__ (line 238) | def __init__(self, config): method forward (line 246) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MplugOwlVisionEncoderLayer (line 253) | class MplugOwlVisionEncoderLayer(nn.Module): method __init__ (line 254) | def __init__(self, config): method forward (line 262) | def forward( class MplugOwlVisionEncoder (line 301) | class MplugOwlVisionEncoder(nn.Module): method __init__ (line 311) | def __init__(self, config): method forward (line 317) | def forward( class MplugOwlVisionModel (line 393) | class MplugOwlVisionModel(PreTrainedModel): method __init__ (line 396) | def __init__(self, config): method _get_no_split_modules (line 410) | def _get_no_split_modules(self, device_map: str): method forward (line 418) | def forward( method get_input_embeddings (line 465) | def get_input_embeddings(self): class MplugOwlVisualAbstractorMLP (line 469) | class MplugOwlVisualAbstractorMLP(nn.Module): method __init__ (line 470) | def __init__(self, config): method forward (line 481) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class MplugOwlVisualAbstractorMultiHeadAttention (line 488) | class MplugOwlVisualAbstractorMultiHeadAttention(nn.Module): method __init__ (line 489) | def __init__(self, config): method save_attn_gradients (line 527) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 530) | def get_attn_gradients(self): method save_attention_map (line 533) | def save_attention_map(self, attention_map): method get_attention_map (line 536) | def get_attention_map(self): method transpose_for_scores (line 539) | def transpose_for_scores(self, x): method forward (line 544) | def forward( class MplugOwlVisualAbstractorCrossOutput (line 606) | class MplugOwlVisualAbstractorCrossOutput(nn.Module): method __init__ (line 607) | def __init__(self, config): method forward (line 614) | def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Ten... class MplugOwlVisualAbstractorAttention (line 620) | class MplugOwlVisualAbstractorAttention(nn.Module): method __init__ (line 621) | def __init__(self, config): method prune_heads (line 639) | def prune_heads(self, heads): method forward (line 657) | def forward( class MplugOwlVisualAbstractorLayer (line 687) | class MplugOwlVisualAbstractorLayer(nn.Module): method __init__ (line 688) | def __init__(self, config, layer_idx): method forward (line 698) | def forward( class MplugOwlVisualAbstractorEncoder (line 723) | class MplugOwlVisualAbstractorEncoder(nn.Module): method __init__ (line 724) | def __init__(self, config): method forward (line 732) | def forward( class MplugOwlVisualAbstractorModel (line 787) | class MplugOwlVisualAbstractorModel(PreTrainedModel): method __init__ (line 788) | def __init__(self, config, language_hidden_size): method _get_no_split_modules (line 800) | def _get_no_split_modules(self, device_map: str): method _prune_heads (line 808) | def _prune_heads(self, heads_to_prune): method get_extended_attention_mask (line 816) | def get_extended_attention_mask( method forward (line 860) | def forward( FILE: mplug_owl2/serve/cli.py function disable_torch_init (line 17) | def disable_torch_init(): function load_image (line 26) | def load_image(image_file): function main (line 35) | def main(args): FILE: mplug_owl2/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: mplug_owl2/serve/gradio_web_server.py function get_conv_log_filename (line 32) | def get_conv_log_filename(): function get_model_list (line 38) | def get_model_list(): function load_demo (line 58) | def load_demo(url_params, request: gr.Request): function load_demo_refresh_model_list (line 72) | def load_demo_refresh_model_list(request: gr.Request): function vote_last_response (line 83) | def vote_last_response(state, vote_type, model_selector, request: gr.Req... function upvote_last_response (line 95) | def upvote_last_response(state, model_selector, request: gr.Request): function downvote_last_response (line 101) | def downvote_last_response(state, model_selector, request: gr.Request): function flag_last_response (line 107) | def flag_last_response(state, model_selector, request: gr.Request): function regenerate (line 113) | def regenerate(state, image_process_mode, request: gr.Request): function clear_history (line 123) | def clear_history(request: gr.Request): function add_text (line 129) | def add_text(state, text, image, image_process_mode, request: gr.Request): function http_bot (line 156) | def http_bot(state, model_selector, temperature, top_p, max_new_tokens, ... function build_demo (line 298) | def build_demo(embed_mode): FILE: mplug_owl2/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 192) | def generate_stream_gate(self, params): function release_model_semaphore (line 220) | def release_model_semaphore(fn=None): function generate_stream (line 227) | async def generate_stream(request: Request): function get_status (line 243) | async def get_status(request: Request): FILE: mplug_owl2/train/llama_flash_attn_monkey_patch.py function forward (line 16) | def forward( function _prepare_decoder_attention_mask (line 100) | def _prepare_decoder_attention_mask( function replace_llama_attn_with_flash_attn (line 107) | def replace_llama_attn_with_flash_attn(): FILE: mplug_owl2/train/mplug_owl2_trainer.py function maybe_zero_3 (line 18) | def maybe_zero_3(param, ignore_status=False, name=None): function get_mm_adapter_state_maybe_zero_3 (line 32) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function split_to_even_chunks (line 38) | def split_to_even_chunks(indices, lengths, num_chunks): function get_modality_length_grouped_indices (line 60) | def get_modality_length_grouped_indices(lengths, batch_size, world_size,... function get_length_grouped_indices (line 88) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 99) | class LengthGroupedSampler(Sampler): method __init__ (line 105) | def __init__( method __len__ (line 122) | def __len__(self): method __iter__ (line 125) | def __iter__(self): class MPLUGOwl2Trainer (line 133) | class MPLUGOwl2Trainer(Trainer): method _get_train_sampler (line 135) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method create_optimizer (line 150) | def create_optimizer(self): method _save_checkpoint (line 239) | def _save_checkpoint(self, model, trial, metrics=None): method _save (line 242) | def _save(self, output_dir: Optional[str] = None, state_dict=None): FILE: mplug_owl2/train/train.py function rank0_print (line 44) | def rank0_print(*args): class ModelArguments (line 50) | class ModelArguments: class DataArguments (line 56) | class DataArguments: class TrainingArguments (line 67) | class TrainingArguments(transformers.TrainingArguments): function maybe_zero_3 (line 104) | def maybe_zero_3(param, ignore_status=False, name=None): function get_peft_state_maybe_zero_3 (line 119) | def get_peft_state_maybe_zero_3(named_params, bias): function get_peft_state_non_lora_maybe_zero_3 (line 144) | def get_peft_state_non_lora_maybe_zero_3(named_params, require_grad_only... function get_mm_adapter_state_maybe_zero_3 (line 152) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function find_all_linear_names (line 158) | def find_all_linear_names(model): function safe_save_model_for_hf_trainer (line 173) | def safe_save_model_for_hf_trainer(trainer: transformers.Trainer, function smart_tokenizer_and_embedding_resize (line 192) | def smart_tokenizer_and_embedding_resize( function _tokenize_fn (line 217) | def _tokenize_fn(strings: Sequence[str], function _mask_targets (line 244) | def _mask_targets(target, tokenized_lens, speakers): function _add_speaker_and_signal (line 255) | def _add_speaker_and_signal(header, source, get_conversation=True): function preprocess_multimodal (line 276) | def preprocess_multimodal( function preprocess_v1 (line 297) | def preprocess_v1( function preprocess_plain (line 379) | def preprocess_plain( function preprocess (line 401) | def preprocess( class LazySupervisedDataset (line 444) | class LazySupervisedDataset(Dataset): method __init__ (line 447) | def __init__(self, data_path: str, method __len__ (line 458) | def __len__(self): method lengths (line 462) | def lengths(self): method modality_lengths (line 471) | def modality_lengths(self): method next_rand (line 528) | def next_rand(self): method __getitem__ (line 532) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class DataCollatorForSupervisedDataset (line 590) | class DataCollatorForSupervisedDataset(object): method __call__ (line 595) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: function make_supervised_data_module (line 623) | def make_supervised_data_module(tokenizer: transformers.PreTrainedTokeni... function train (line 635) | def train(): FILE: mplug_owl2/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: process_params.py class ProcessParams (line 8) | class ProcessParams: method clip_params (line 62) | def clip_params(self): method pre_only (line 78) | def pre_only(self): method cap_only (line 83) | def cap_only(self): method post_only (line 89) | def post_only(self): method from_dict (line 95) | def from_dict(cls, d): FILE: processors.py class Processor (line 17) | class Processor: method __init__ (line 18) | def __init__(self): method unload (line 22) | def unload(self): method process (line 29) | def process(self, images: List[Image.Image]) -> List[Any]: class ClipProcessor (line 33) | class ClipProcessor(Processor): method __init__ (line 34) | def __init__( method process (line 66) | def process(self, images: List[Image.Image], short:bool=False) -> List... method unload (line 77) | def unload(self): class BooruProcessor (line 85) | class BooruProcessor(Processor): method __init__ (line 86) | def __init__(self, min_score: float): method process (line 93) | def process(self, images: List[Image.Image]) -> List[List[str]]: method unload (line 106) | def unload(self): class CropProcessor (line 113) | class CropProcessor(Processor): method __init__ (line 114) | def __init__(self, subject_class: str, pad: bool, crop: bool): method process (line 124) | def process(self, images: List[Image.Image], captions: List[str] = Non... method _process_img (line 135) | def _process_img(self, img, short_caption): method unload (line 191) | def unload(self): class UpscaleProcessor (line 197) | class UpscaleProcessor(Processor): method __init__ (line 198) | def __init__(self): method process (line 204) | def process(self, images: List[Image.Image], captions: List[str] = Non... method unload (line 215) | def unload(self): FILE: scripts/process_main.py function list_scalers (line 60) | def list_scalers(): function generate_caption_section (line 94) | def generate_caption_section(): function sort_tags_dict (line 168) | def sort_tags_dict(): function create_process_ui (line 183) | def create_process_ui(): FILE: smartprocess.py function printi (line 33) | def printi(message): function get_backup_path (line 38) | def get_backup_path(file_path, params: ProcessParams): function save_pic (line 52) | def save_pic(img, src_name, img_index, params: ProcessParams): function save_img_caption (line 64) | def save_img_caption(image_path: str, img_caption: str, params: ProcessP... function list_features (line 76) | def list_features(): function is_image (line 97) | def is_image(path: Union[Path, str], feats=None): function cleanup (line 108) | def cleanup(): function vram_usage (line 118) | def vram_usage(): function unload_system (line 127) | def unload_system(): function load_system (line 145) | def load_system(): function get_crop_clip (line 156) | def get_crop_clip(): function get_image_interrogators (line 168) | def get_image_interrogators(params: ProcessParams, all_captioners): function clean_string (line 187) | def clean_string(s): function read_caption (line 214) | def read_caption(image): function build_caption (line 225) | def build_caption(image, captions_list, tags_to_ignore, caption_length, ... function calculate_job_length (line 293) | def calculate_job_length(files, crop, caption, captioners, flip, restore... function crop_smart (line 309) | def crop_smart(img: Image, interrogator: BLIPInterrogator, cc: CropClip,... function crop_center (line 348) | def crop_center(img: Image, max_size: int): function crop_empty (line 362) | def crop_empty(img: Image): function crop_contain (line 412) | def crop_contain(img, params: ProcessParams): function get_blip_interrogator (line 426) | def get_blip_interrogator(params: ProcessParams): function process_pre (line 439) | def process_pre(files: List[ImageData], params: ProcessParams) -> List[I... function process_captions (line 497) | def process_captions(files: List[ImageData], params: ProcessParams, all_... function process_post (line 569) | def process_post(files: ImageData, params: ProcessParams, all_files: boo... function do_process (line 694) | def do_process(params: ProcessParams, all_files=False) -> Tuple[List[Ima... FILE: super_resolution.py function initialize_model (line 21) | def initialize_model(): function make_batch_sd (line 53) | def make_batch_sd( function make_noise_augmentation (line 70) | def make_noise_augmentation(model, batch, noise_level=None): function paint (line 77) | def paint(sampler, image, prompt, seed, scale, h, w, steps, num_samples=... function pad_image (line 139) | def pad_image(input_image): function predict (line 147) | def predict(sampler, input_image, prompt, steps, num_samples, scale, see... function super_resolution (line 168) | def super_resolution(self, images, steps=50, target_scale=2, half_attent... FILE: upscalers/spandrel/spandrel_srformer_model.py class SpandrelSRFormerModel (line 22) | class SpandrelSRFormerModel(SpandrelUpscaler): method __init__ (line 26) | def __init__(self, create_dirs=False): FILE: upscalers/spandrel/spandrel_upscaler_base.py function convert_google_drive_link (line 29) | def convert_google_drive_link(url: str) -> str: function download_file (line 40) | def download_file(url: str, filename: Path | str) -> None: function extract_file_from_zip (line 59) | def extract_file_from_zip( function image_to_tensor (line 72) | def image_to_tensor(img: np.ndarray, device: str, half) -> torch.Tensor: function tensor_to_image (line 87) | def tensor_to_image(tensor: torch.Tensor) -> np.ndarray: function image_inference_tensor (line 96) | def image_inference_tensor( function image_inference (line 104) | def image_inference(model: ImageModelDescriptor, image: np.ndarray, devi... function get_h_w_c (line 108) | def get_h_w_c(image: np.ndarray) -> tuple[int, int, int]: class SpandrelUpscaler (line 114) | class SpandrelUpscaler(Upscaler): method __init__ (line 120) | def __init__(self, create_dirs=False): method do_upscale (line 126) | def do_upscale(self, img: PIL.Image, selected_model: str): method load_model (line 130) | def load_model(self, path: str): method preprocess (line 139) | def preprocess(self, image: Image) -> Image: method postprocess (line 161) | def postprocess(self, image: Image, original_width: int, original_heig... method internal_upscale (line 180) | def internal_upscale(self, image: Image): method unload (line 215) | def unload(self): method load (line 222) | def load(self):