SYMBOL INDEX (1352 symbols across 120 files) FILE: llavamod/config/args.py class ModelArguments (line 9) | class ModelArguments: class DataArguments (line 63) | class DataArguments: class TrainingArguments (line 76) | class TrainingArguments(transformers.TrainingArguments): class AlignArguments (line 115) | class AlignArguments: class DPOArguments (line 127) | class DPOArguments: FILE: llavamod/conversation.py class SeparatorStyle (line 6) | class SeparatorStyle(Enum): class Conversation (line 18) | class Conversation: method get_prompt (line 31) | def get_prompt(self): method append_message (line 125) | def append_message(self, role, message): method get_images (line 128) | def get_images(self, return_pil=False): method to_gradio_chatbot (line 178) | def to_gradio_chatbot(self): method copy (line 209) | def copy(self): method dict (line 220) | def dict(self): FILE: llavamod/data/data_utils.py function smart_tokenizer_and_embedding_resize (line 18) | def smart_tokenizer_and_embedding_resize( function _tokenize_fn (line 43) | def _tokenize_fn(strings: Sequence[str], function _mask_targets (line 70) | def _mask_targets(target, tokenized_lens, speakers): function _add_speaker_and_signal (line 81) | def _add_speaker_and_signal(header, source, get_conversation=True): function preprocess_multimodal (line 102) | def preprocess_multimodal( function preprocess_llama_2 (line 154) | def preprocess_llama_2( function preprocess_v1 (line 236) | def preprocess_v1( function preprocess_phi (line 318) | def preprocess_phi( function preprocess_openchat (line 397) | def preprocess_openchat( function preprocess_mpt (line 478) | def preprocess_mpt( function preprocess_gemma_2 (line 545) | def preprocess_gemma_2( function preprocess_plain (line 627) | def preprocess_plain( function preprocess (line 653) | def preprocess( function expand2square (line 714) | def expand2square(pil_img, background_color): FILE: llavamod/data/dataset.py function rank0_print (line 14) | def rank0_print(*args): class LazySupervisedDataset (line 25) | class LazySupervisedDataset(Dataset): method __init__ (line 28) | def __init__(self, data_path: str, method __len__ (line 49) | def __len__(self): method modality_lengths (line 53) | def modality_lengths(self): method __getitem__ (line 63) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class DataCollatorForSupervisedDataset (line 168) | class DataCollatorForSupervisedDataset(object): method __call__ (line 173) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: function make_supervised_data_module (line 235) | def make_supervised_data_module(tokenizer: transformers.PreTrainedTokeni... class LazyDPODataset (line 253) | class LazyDPODataset(Dataset): method __init__ (line 256) | def __init__(self, data_path: str, method __len__ (line 277) | def __len__(self): method modality_lengths (line 281) | def modality_lengths(self): method __getitem__ (line 291) | def __getitem__(self, i) -> Dict[str, torch.Tensor]: class DataCollatorForDPODataset (line 435) | class DataCollatorForDPODataset(object): method __call__ (line 440) | def __call__(self, instances: Sequence[Dict]) -> Dict[str, torch.Tensor]: function make_dpo_data_module (line 508) | def make_dpo_data_module(tokenizer: transformers.PreTrainedTokenizer, FILE: llavamod/eval/eval_gpt_objhal.py function parse_object_list (line 33) | def parse_object_list(content): function preprocess_coh_results (line 72) | def preprocess_coh_results(caps): function combine_coco_captions (line 92) | def combine_coco_captions(annotation_path): function combine_coco_instances (line 108) | def combine_coco_instances(annotation_path): class CHAIR (line 126) | class CHAIR(object): method __init__ (line 128) | def __init__(self, imids, coco_path, openai_apikey): method _load_generated_captions_into_evaluator (line 168) | def _load_generated_captions_into_evaluator(self, cap_file, sample_num... method get_double_words_only (line 184) | def get_double_words_only(self, word_list): method caption_to_words (line 202) | def caption_to_words(self, caption): method caption_objects_to_coco_objects (line 241) | def caption_objects_to_coco_objects(self, words): method get_annotations_from_segments (line 255) | def get_annotations_from_segments(self): method get_annotations_from_captions (line 278) | def get_annotations_from_captions(self): method get_annotations (line 298) | def get_annotations(self): method get_gpt_resp (line 307) | def get_gpt_resp(self, data_item): method gpt_caption_processor (line 359) | def gpt_caption_processor(self, max_workers=64): method postagging (line 390) | def postagging(self, doc): method get_pred_objs_match (line 406) | def get_pred_objs_match(self, caps): method compute_chair (line 437) | def compute_chair(self, cap_file, sample_num, gpt_process=False, org_d... function read_jsonl (line 549) | def read_jsonl(jsonl_file): function load_generated_captions (line 557) | def load_generated_captions(cap_file, org_dir=None): function save_hallucinated_words (line 639) | def save_hallucinated_words(cap_file, cap_dict, save_dir, sample_num): function print_metrics (line 645) | def print_metrics(hallucination_cap_dict, quiet=False): FILE: llavamod/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: llavamod/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: llavamod/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: llavamod/eval/eval_gqa.py function loadFile (line 108) | def loadFile(name): function toScore (line 168) | def toScore(b): function avg (line 173) | def avg(l): function wavg (line 179) | def wavg(l, w): function getWordsNum (line 215) | def getWordsNum(question): function getStepsNum (line 220) | def getStepsNum(question): function toSlice (line 229) | def toSlice(strSlice): function intsFromSlice (line 238) | def intsFromSlice(strSlice): function belongs (line 246) | def belongs(element, group, question): function updateConsistency (line 257) | def updateConsistency(questionId, question, questions): function yrange (line 278) | def yrange(c): function xrange (line 282) | def xrange(c): function length (line 286) | def length(r): function size (line 292) | def size(c): function intersection (line 296) | def intersection(r1, r2): function intersectionSize (line 303) | def intersectionSize(c1, c2): function intersectionRate (line 307) | def intersectionRate(c1, c2): function getCell (line 312) | def getCell(i, j): function getRegion (line 318) | def getRegion(sceneGraph, objectId): function computeGroundingScore (line 329) | def computeGroundingScore(question, sceneGraph, attentionMap): function chiSquare (line 359) | def chiSquare(goldDist, predictedDist): FILE: llavamod/eval/eval_gqa_1.py function loadFile (line 108) | def loadFile(name): function toScore (line 162) | def toScore(b): function avg (line 167) | def avg(l): function wavg (line 173) | def wavg(l, w): function getWordsNum (line 209) | def getWordsNum(question): function getStepsNum (line 214) | def getStepsNum(question): function toSlice (line 223) | def toSlice(strSlice): function intsFromSlice (line 232) | def intsFromSlice(strSlice): function belongs (line 240) | def belongs(element, group, question): function updateConsistency (line 251) | def updateConsistency(questionId, question, questions): function yrange (line 272) | def yrange(c): function xrange (line 276) | def xrange(c): function length (line 280) | def length(r): function size (line 286) | def size(c): function intersection (line 290) | def intersection(r1, r2): function intersectionSize (line 297) | def intersectionSize(c1, c2): function intersectionRate (line 301) | def intersectionRate(c1, c2): function getCell (line 306) | def getCell(i, j): function getRegion (line 312) | def getRegion(sceneGraph, objectId): function computeGroundingScore (line 323) | def computeGroundingScore(question, sceneGraph, attentionMap): function chiSquare (line 353) | def chiSquare(goldDist, predictedDist): FILE: llavamod/eval/eval_pope.py function eval_pope (line 6) | def eval_pope(answers, label_file): FILE: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/eval/gpt4_grpc.py class Chat (line 6) | class Chat: method __init__ (line 7) | def __init__(self, model="", timeout_sec=20, openai_apikey=''): method chat_completion (line 12) | def chat_completion(self, messages, temperature=0.2, top_p=1, max_toke... function get_eval (line 29) | def get_eval(model, content: str, FILE: llavamod/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: llavamod/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: llavamod/eval/model_vqa.py function split_list (line 19) | def split_list(lst, n): function get_chunk (line 25) | def get_chunk(lst, n, k): function eval_model (line 30) | def eval_model(args): FILE: llavamod/eval/model_vqa_loader.py function split_list (line 20) | def split_list(lst, n): function get_chunk (line 26) | def get_chunk(lst, n, k): class CustomDataset (line 32) | class CustomDataset(Dataset): method __init__ (line 33) | def __init__(self, questions, image_folder, tokenizer, image_processor... method __getitem__ (line 40) | def __getitem__(self, index): method __len__ (line 61) | def __len__(self): function create_data_loader (line 66) | def create_data_loader(questions, image_folder, tokenizer, image_process... function eval_model (line 73) | def eval_model(args): FILE: llavamod/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 45) | def get_options(row, options): function eval_model (line 55) | def eval_model(args): FILE: llavamod/eval/model_vqa_mmhal.py function split_list (line 20) | def split_list(lst, n): function get_chunk (line 26) | def get_chunk(lst, n, k): function eval_model (line 31) | def eval_model(args): FILE: llavamod/eval/model_vqa_objhal.py function split_list (line 21) | def split_list(lst, n): function get_chunk (line 27) | def get_chunk(lst, n, k): function eval_model (line 32) | def eval_model(args): FILE: llavamod/eval/model_vqa_qbench.py function load_image (line 18) | def load_image(image_file): function eval_model (line 27) | def eval_model(args): FILE: llavamod/eval/model_vqa_science.py function split_list (line 19) | def split_list(lst, n): function get_chunk (line 25) | def get_chunk(lst, n, k): function eval_model (line 30) | def eval_model(args): FILE: llavamod/eval/qa_baseline_gpt35.py function get_answer (line 16) | def get_answer(question_id: int, question: str, max_tokens: int): FILE: llavamod/eval/run_llava.py function image_parser (line 29) | def image_parser(args): function load_image (line 34) | def load_image(image_file): function load_images (line 43) | def load_images(image_files): function eval_model (line 51) | def eval_model(args): FILE: llavamod/eval/summarize_gpt_review.py function parse_args (line 10) | def parse_args(): FILE: llavamod/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: llavamod/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 65) | def get_model_name_from_path(model_path): class KeywordsStoppingCriteria (line 74) | class KeywordsStoppingCriteria(StoppingCriteria): method __init__ (line 75) | def __init__(self, keywords, tokenizer, input_ids): method call_for_batch (line 89) | def call_for_batch(self, output_ids: torch.LongTensor, scores: torch.F... method __call__ (line 101) | def __call__(self, output_ids: torch.LongTensor, scores: torch.FloatTe... function is_gemma_tokenizer (line 108) | def is_gemma_tokenizer(tokenizer): FILE: llavamod/model/apply_delta.py function apply_delta (line 13) | def apply_delta(base_model_path, target_model_path, delta_path): FILE: llavamod/model/builder.py function load_pretrained_model (line 57) | def load_pretrained_model(model_path, model_base, model_name, load_8bit=... FILE: llavamod/model/cache_utils.py class Cache (line 18) | class Cache(torch.nn.Module): method __init__ (line 23) | def __init__(self): method update (line 26) | def update( method get_seq_length (line 52) | def get_seq_length(self, layer_idx: Optional[int] = 0) -> int: method get_max_length (line 57) | def get_max_length(self) -> Optional[int]: method get_usable_length (line 61) | def get_usable_length(self, new_seq_length: int, layer_idx: Optional[i... method reorder_cache (line 72) | def reorder_cache(self, beam_idx: torch.LongTensor): method seen_tokens (line 81) | def seen_tokens(self): class CacheConfig (line 93) | class CacheConfig: method from_dict (line 101) | def from_dict(cls, config_dict, **kwargs): method to_json_file (line 122) | def to_json_file(self, json_file_path: Union[str, os.PathLike]): method to_dict (line 140) | def to_dict(self) -> Dict[str, Any]: method __iter__ (line 148) | def __iter__(self): method __repr__ (line 154) | def __repr__(self): method to_json_string (line 157) | def to_json_string(self): method update (line 166) | def update(self, **kwargs): class DynamicCache (line 189) | class DynamicCache(Cache): method __init__ (line 197) | def __init__(self) -> None: method __getitem__ (line 203) | def __getitem__(self, layer_idx: int) -> List[Tuple[torch.Tensor]]: method __iter__ (line 213) | def __iter__(self): method __len__ (line 221) | def __len__(self): method update (line 228) | def update( method get_seq_length (line 265) | def get_seq_length(self, layer_idx: Optional[int] = 0) -> int: method get_max_length (line 272) | def get_max_length(self) -> Optional[int]: method to_legacy_cache (line 276) | def to_legacy_cache(self) -> Tuple[Tuple[torch.Tensor], Tuple[torch.Te... method from_legacy_cache (line 285) | def from_legacy_cache(cls, past_key_values: Optional[Tuple[Tuple[torch... method crop (line 295) | def crop(self, max_length: int): method batch_split (line 310) | def batch_split(self, full_batch_size: int, split_size: int) -> List["... method from_batch_splits (line 323) | def from_batch_splits(cls, splits: List["DynamicCache"]) -> "DynamicCa... method batch_repeat_interleave (line 333) | def batch_repeat_interleave(self, repeats: int): method batch_select_indices (line 339) | def batch_select_indices(self, indices: torch.Tensor): class OffloadedCache (line 346) | class OffloadedCache(DynamicCache): method __init__ (line 359) | def __init__(self) -> None: method prefetch_layer (line 367) | def prefetch_layer(self, layer_idx: int): method evict_previous_layer (line 376) | def evict_previous_layer(self, layer_idx: int): method __getitem__ (line 384) | def __getitem__(self, layer_idx: int) -> List[Tuple[torch.Tensor]]: method reorder_cache (line 406) | def reorder_cache(self, beam_idx: torch.LongTensor): method update (line 413) | def update( class HybridCache (line 458) | class HybridCache(Cache): method __init__ (line 479) | def __init__( method _sliding_update (line 534) | def _sliding_update(self, cache_position, layer_idx, key_states, value... method _static_update (line 562) | def _static_update(self, cache_position, layer_idx, key_states, value_... method update (line 570) | def update( method get_max_length (line 598) | def get_max_length(self) -> Optional[int]: method get_seq_length (line 603) | def get_seq_length(self, layer_idx: Optional[int] = 0): method reset (line 606) | def reset(self): FILE: llavamod/model/consolidate.py function consolidate_ckpt (line 13) | def consolidate_ckpt(src_path, dst_path): FILE: llavamod/model/import_utils.py function _is_package_available (line 16) | def _is_package_available(pkg_name: str, return_version: bool = False) -... function is_flash_attn_greater_or_equal (line 50) | def is_flash_attn_greater_or_equal(library_version: str): FILE: llavamod/model/language_model/gemma2/configuration_gemma2.py class Gemma2Config (line 9) | class Gemma2Config(PretrainedConfig): method __init__ (line 82) | def __init__( FILE: llavamod/model/language_model/gemma2/modeling_gemma2.py function _prepare_4d_causal_attention_mask_with_cache_position (line 45) | def _prepare_4d_causal_attention_mask_with_cache_position( class Gemma2RMSNorm (line 97) | class Gemma2RMSNorm(nn.Module): method __init__ (line 98) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 103) | def _norm(self, x): method forward (line 106) | def forward(self, x): method extra_repr (line 113) | def extra_repr(self): class Gemma2RotaryEmbedding (line 117) | class Gemma2RotaryEmbedding(nn.Module): method __init__ (line 118) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 128) | def forward(self, x, position_ids, seq_len=None): function rotate_half (line 145) | def rotate_half(x): function apply_rotary_pos_emb (line 152) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_di... class Gemma2MLP (line 179) | class Gemma2MLP(nn.Module): method __init__ (line 180) | def __init__(self, config): method forward (line 190) | def forward(self, x): function repeat_kv (line 194) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Gemma2Attention (line 206) | class Gemma2Attention(nn.Module): method __init__ (line 209) | def __init__(self, config: Gemma2Config, layer_idx: Optional[int] = No... method forward (line 248) | def forward( class Gemma2FlashAttention2 (line 316) | class Gemma2FlashAttention2(Gemma2Attention): method __init__ (line 323) | def __init__(self, *args, **kwargs): method forward (line 331) | def forward( class Gemma2SdpaAttention (line 431) | class Gemma2SdpaAttention(Gemma2Attention): method forward (line 439) | def forward( class Gemma2DecoderLayer (line 528) | class Gemma2DecoderLayer(nn.Module): method __init__ (line 529) | def __init__(self, config: Gemma2Config, layer_idx: int): method forward (line 545) | def forward( class Gemma2PreTrainedModel (line 634) | class Gemma2PreTrainedModel(PreTrainedModel): method _init_weights (line 646) | def _init_weights(self, module): class Gemma2Model (line 739) | class Gemma2Model(Gemma2PreTrainedModel): method __init__ (line 747) | def __init__(self, config: Gemma2Config): method get_input_embeddings (line 762) | def get_input_embeddings(self): method set_input_embeddings (line 765) | def set_input_embeddings(self, value): method forward (line 769) | def forward( method _update_causal_mask (line 895) | def _update_causal_mask( class Gemma2ForCausalLM (line 932) | class Gemma2ForCausalLM(Gemma2PreTrainedModel): method __init__ (line 935) | def __init__(self, config): method get_input_embeddings (line 944) | def get_input_embeddings(self): method set_input_embeddings (line 947) | def set_input_embeddings(self, value): method get_output_embeddings (line 950) | def get_output_embeddings(self): method set_output_embeddings (line 953) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 956) | def set_decoder(self, decoder): method get_decoder (line 959) | def get_decoder(self): method forward (line 964) | def forward( method prepare_inputs_for_generation (line 1048) | def prepare_inputs_for_generation( class Gemma2ForSequenceClassification (line 1137) | class Gemma2ForSequenceClassification(Gemma2PreTrainedModel): method __init__ (line 1138) | def __init__(self, config): method get_input_embeddings (line 1147) | def get_input_embeddings(self): method set_input_embeddings (line 1150) | def set_input_embeddings(self, value): method forward (line 1154) | def forward( class Gemma2ForTokenClassification (line 1252) | class Gemma2ForTokenClassification(Gemma2PreTrainedModel): method __init__ (line 1253) | def __init__(self, config): method get_input_embeddings (line 1269) | def get_input_embeddings(self): method set_input_embeddings (line 1272) | def set_input_embeddings(self, value): method forward (line 1276) | def forward( FILE: llavamod/model/language_model/gemma2/tokenization_gemma2.py class GemmaTokenizer (line 38) | class GemmaTokenizer(PreTrainedTokenizer): method __init__ (line 88) | def __init__( method __getstate__ (line 132) | def __getstate__(self): method __setstate__ (line 139) | def __setstate__(self, d): method vocab_size (line 146) | def vocab_size(self): method get_vocab (line 151) | def get_vocab(self): method _tokenize (line 157) | def _tokenize(self, text, **kwargs): method _convert_token_to_id (line 164) | def _convert_token_to_id(self, token): method _convert_id_to_token (line 169) | def _convert_id_to_token(self, index): method _decode (line 174) | def _decode( method convert_tokens_to_string (line 203) | def convert_tokens_to_string(self, tokens): method save_vocabulary (line 218) | def save_vocabulary(self, save_directory, filename_prefix: Optional[st... method build_inputs_with_special_tokens (line 246) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... method get_special_tokens_mask (line 258) | def get_special_tokens_mask( method create_token_type_ids_from_sequences (line 296) | def create_token_type_ids_from_sequences( FILE: llavamod/model/language_model/gemma2/tokenization_gemma2_fast.py class GemmaTokenizerFast (line 37) | class GemmaTokenizerFast(PreTrainedTokenizerFast): method __init__ (line 90) | def __init__( method can_save_slow_tokenizer (line 121) | def can_save_slow_tokenizer(self) -> bool: method update_post_processor (line 125) | def update_post_processor(self): method add_eos_token (line 152) | def add_eos_token(self): method add_bos_token (line 156) | def add_bos_token(self): method add_eos_token (line 160) | def add_eos_token(self, value): method add_bos_token (line 165) | def add_bos_token(self, value): method save_vocabulary (line 170) | def save_vocabulary(self, save_directory: str, filename_prefix: Option... method build_inputs_with_special_tokens (line 190) | def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=No... FILE: llavamod/model/language_model/llama/configuration_llama.py class LlamaConfig (line 31) | class LlamaConfig(PretrainedConfig): method __init__ (line 117) | def __init__( method _rope_scaling_validation (line 172) | def _rope_scaling_validation(self): FILE: llavamod/model/language_model/llama/modeling_llama.py function _get_unpad_data (line 77) | def _get_unpad_data(attention_mask): function _expand_mask (line 89) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... function _make_causal_mask (line 96) | def _make_causal_mask( class LlamaRMSNorm (line 107) | class LlamaRMSNorm(nn.Module): method __init__ (line 108) | def __init__(self, hidden_size, eps=1e-6): method forward (line 116) | def forward(self, hidden_states): class LlamaRotaryEmbedding (line 127) | class LlamaRotaryEmbedding(nn.Module): method __init__ (line 128) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 142) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 152) | def forward(self, x, seq_len=None): class LlamaLinearScalingRotaryEmbedding (line 163) | class LlamaLinearScalingRotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 166) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 170) | def _set_cos_sin_cache(self, seq_len, device, dtype): class LlamaDynamicNTKScalingRotaryEmbedding (line 182) | class LlamaDynamicNTKScalingRotaryEmbedding(LlamaRotaryEmbedding): method __init__ (line 185) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 189) | def _set_cos_sin_cache(self, seq_len, device, dtype): function rotate_half (line 208) | def rotate_half(x): function apply_rotary_pos_emb (line 215) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class LlamaMLP (line 243) | class LlamaMLP(nn.Module): method __init__ (line 244) | def __init__(self, config): method forward (line 254) | def forward(self, x): function repeat_kv (line 277) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class LlamaAttention (line 289) | class LlamaAttention(nn.Module): method __init__ (line 292) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None): method _init_rope (line 325) | 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 LlamaFlashAttention2 (line 460) | class LlamaFlashAttention2(LlamaAttention): method __init__ (line 467) | def __init__(self, *args, **kwargs): method forward (line 475) | def forward( method _flash_attention_forward (line 565) | def _flash_attention_forward( method _upad_input (line 624) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class LlamaSdpaAttention (line 663) | class LlamaSdpaAttention(LlamaAttention): method forward (line 671) | def forward( class LlamaDecoderLayer (line 757) | class LlamaDecoderLayer(nn.Module): method __init__ (line 758) | def __init__(self, config: LlamaConfig, layer_idx: int): method forward (line 768) | def forward( class LlamaPreTrainedModel (line 851) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 861) | def _init_weights(self, module): class LlamaModel (line 947) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 955) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 972) | def get_input_embeddings(self): method set_input_embeddings (line 975) | def set_input_embeddings(self, value): method forward (line 979) | def forward( class LlamaForCausalLM (line 1110) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 1113) | def __init__(self, config): method get_input_embeddings (line 1122) | def get_input_embeddings(self): method set_input_embeddings (line 1125) | def set_input_embeddings(self, value): method get_output_embeddings (line 1128) | def get_output_embeddings(self): method set_output_embeddings (line 1131) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1134) | def set_decoder(self, decoder): method get_decoder (line 1137) | def get_decoder(self): method forward (line 1142) | def forward( method prepare_inputs_for_generation (line 1234) | def prepare_inputs_for_generation( method _reorder_cache (line 1291) | def _reorder_cache(past_key_values, beam_idx): class LlamaForSequenceClassification (line 1315) | class LlamaForSequenceClassification(LlamaPreTrainedModel): method __init__ (line 1316) | def __init__(self, config): method get_input_embeddings (line 1325) | def get_input_embeddings(self): method set_input_embeddings (line 1328) | def set_input_embeddings(self, value): method forward (line 1332) | def forward( FILE: llavamod/model/language_model/llava_gemma2.py class LlavaGemma2Config (line 33) | class LlavaGemma2Config(Gemma2Config): class LlavaGemma2Model (line 37) | class LlavaGemma2Model(LlavaMetaModel, Gemma2Model): method __init__ (line 40) | def __init__(self, config: Gemma2Config): class LlavaGemma2ForCausalLM (line 44) | class LlavaGemma2ForCausalLM(Gemma2ForCausalLM, LlavaMetaForCausalLM): method __init__ (line 47) | def __init__(self, config): method get_model (line 56) | def get_model(self): method forward (line 59) | def forward( method prepare_inputs_for_generation (line 112) | def prepare_inputs_for_generation( FILE: llavamod/model/language_model/llava_gemma2_moe.py function rank0_print (line 48) | def rank0_print(*args): class LLaVAMoDGemma2Config (line 53) | class LLaVAMoDGemma2Config(Gemma2Config): method __init__ (line 56) | def __init__(self, class LLaVAMoDGemma2Model (line 89) | class LLaVAMoDGemma2Model(LlavaMetaModel, Gemma2Model): method __init__ (line 92) | def __init__(self, config: Gemma2Config): class MoEBaseModelOutputWithPast (line 97) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 106) | class MoECausalLMOutputWithPast(ModelOutput): function MoEGemma2DecoderLayer_forward (line 117) | def MoEGemma2DecoderLayer_forward(self): function MoEGemma2Model_forward (line 196) | def MoEGemma2Model_forward(self): class LLaVAMoDGemma2ForCausalLM (line 333) | class LLaVAMoDGemma2ForCausalLM(Gemma2ForCausalLM, LlavaMetaForCausalLM): method __init__ (line 336) | def __init__(self, config): method get_model (line 345) | def get_model(self): method forward (line 348) | def forward( method prepare_inputs_for_generation (line 450) | def prepare_inputs_for_generation( method initialize_moe_modules (line 472) | def initialize_moe_modules(self, model_args): class LLaVAMoDGemma2ForCausalLMFineTune (line 561) | class LLaVAMoDGemma2ForCausalLMFineTune(LLaVAMoDGemma2ForCausalLM): method __init__ (line 564) | def __init__(self, config): method initialize_moe_modules (line 616) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDGemma2ForCausalLM (line 626) | class EvalLLaVAMoDGemma2ForCausalLM(LLaVAMoDGemma2ForCausalLM): method __init__ (line 629) | def __init__(self, config): FILE: llavamod/model/language_model/llava_llama.py class LlavaLlamaConfig (line 33) | class LlavaLlamaConfig(LlamaConfig): class LlavaLlamaModel (line 37) | class LlavaLlamaModel(LlavaMetaModel, LlamaModel): method __init__ (line 40) | def __init__(self, config: LlamaConfig): class LlavaLlamaForCausalLM (line 44) | class LlavaLlamaForCausalLM(LlamaForCausalLM, LlavaMetaForCausalLM): method __init__ (line 47) | def __init__(self, config): method get_model (line 57) | def get_model(self): method forward (line 60) | def forward( method prepare_inputs_for_generation (line 112) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... FILE: llavamod/model/language_model/llava_llama_moe.py function rank0_print (line 47) | def rank0_print(*args): class LLaVAMoDLlamaConfig (line 52) | class LLaVAMoDLlamaConfig(LlamaConfig): method __init__ (line 55) | def __init__(self, class LLaVAMoDLlamaModel (line 87) | class LLaVAMoDLlamaModel(LlavaMetaModel, LlamaModel): method __init__ (line 90) | def __init__(self, config: LlamaConfig): class MoEBaseModelOutputWithPast (line 95) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 104) | class MoECausalLMOutputWithPast(ModelOutput): function MoELlamaDecoderLayer_forward_before (line 115) | def MoELlamaDecoderLayer_forward_before(self): function MoELlamaModel_forward_before (line 170) | def MoELlamaModel_forward_before(self): function MoELlamaDecoderLayer_forward (line 316) | def MoELlamaDecoderLayer_forward(self): function MoELlamaModel_forward (line 388) | def MoELlamaModel_forward(self): class LLaVAMoDLlamaForCausalLM (line 535) | class LLaVAMoDLlamaForCausalLM(LlamaForCausalLM, LlavaMetaForCausalLM): method __init__ (line 538) | def __init__(self, config): method get_model (line 548) | def get_model(self): method forward (line 551) | def forward( method prepare_inputs_for_generation (line 653) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... method initialize_moe_modules (line 662) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDLlamaForCausalLM (line 742) | class EvalLLaVAMoDLlamaForCausalLM(LLaVAMoDLlamaForCausalLM): method __init__ (line 745) | def __init__(self, config): FILE: llavamod/model/language_model/llava_minicpm.py class LlavaMiniCPMConfig (line 32) | class LlavaMiniCPMConfig(MiniCPMConfig): class LlavaMiniCPMModel (line 36) | class LlavaMiniCPMModel(LlavaMetaModel, MiniCPMModel): method __init__ (line 39) | def __init__(self, config: MiniCPMConfig): class LlavaMiniCPMForCausalLM (line 43) | class LlavaMiniCPMForCausalLM(MiniCPMForCausalLM, LlavaMetaForCausalLM): method __init__ (line 46) | def __init__(self, config): method get_model (line 55) | def get_model(self): method forward (line 58) | def forward( method prepare_inputs_for_generation (line 112) | def prepare_inputs_for_generation( FILE: llavamod/model/language_model/llava_minicpm_moe.py function rank0_print (line 46) | def rank0_print(*args): class LLaVAMoDMiniCPMConfig (line 51) | class LLaVAMoDMiniCPMConfig(MiniCPMConfig): method __init__ (line 54) | def __init__(self, class LLaVAMoDMiniCPMModel (line 87) | class LLaVAMoDMiniCPMModel(LlavaMetaModel, MiniCPMModel): method __init__ (line 90) | def __init__(self, config: MiniCPMConfig): class MoEBaseModelOutputWithPast (line 95) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 104) | class MoECausalLMOutputWithPast(ModelOutput): function MoEMiniCPMDecoderLayer_forward (line 114) | def MoEMiniCPMDecoderLayer_forward(self): function MoEMiniCPMModel_forward (line 172) | def MoEMiniCPMModel_forward(self): class LLaVAMoDMiniCPMForCausalLM (line 316) | class LLaVAMoDMiniCPMForCausalLM(MiniCPMForCausalLM, LlavaMetaForCausalLM): method __init__ (line 319) | def __init__(self, config): method get_model (line 328) | def get_model(self): method forward (line 331) | def forward( method prepare_inputs_for_generation (line 426) | def prepare_inputs_for_generation( method initialize_moe_modules (line 448) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDMiniCPMForCausalLM (line 542) | class EvalLLaVAMoDMiniCPMForCausalLM(LLaVAMoDMiniCPMForCausalLM): method __init__ (line 545) | def __init__(self, config): FILE: llavamod/model/language_model/llava_mistral.py class LlavaMistralConfig (line 31) | class LlavaMistralConfig(MistralConfig): class LlavaMistralModel (line 35) | class LlavaMistralModel(LlavaMetaModel, MistralModel): method __init__ (line 38) | def __init__(self, config: MistralConfig): class LlavaMistralForCausalLM (line 42) | class LlavaMistralForCausalLM(MistralForCausalLM, LlavaMetaForCausalLM): method __init__ (line 45) | def __init__(self, config): method get_model (line 55) | def get_model(self): method forward (line 58) | def forward( method prepare_inputs_for_generation (line 111) | def prepare_inputs_for_generation( FILE: llavamod/model/language_model/llava_mistral_moe.py function rank0_print (line 42) | def rank0_print(*args): class LLaVAMoDMistralConfig (line 47) | class LLaVAMoDMistralConfig(MistralConfig): method __init__ (line 50) | def __init__(self, class LLaVAMoDMistralModel (line 82) | class LLaVAMoDMistralModel(LlavaMetaModel, MistralModel): method __init__ (line 85) | def __init__(self, config: MistralConfig): class MoEBaseModelOutputWithPast (line 90) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 99) | class MoECausalLMOutputWithPast(ModelOutput): function MoEMistralDecoderLayer_forward (line 109) | def MoEMistralDecoderLayer_forward(self): function MoEMistralModel_forward (line 164) | def MoEMistralModel_forward(self): class LLaVAMoDMistralForCausalLM (line 323) | class LLaVAMoDMistralForCausalLM(MistralForCausalLM, LlavaMetaForCausalLM): method __init__ (line 326) | def __init__(self, config): method get_model (line 336) | def get_model(self): method forward (line 339) | def forward( method prepare_inputs_for_generation (line 440) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... method initialize_moe_modules (line 449) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDMistralForCausalLM (line 532) | class EvalLLaVAMoDMistralForCausalLM(LLaVAMoDMistralForCausalLM): method __init__ (line 535) | def __init__(self, config): FILE: llavamod/model/language_model/llava_mpt.py class LlavaMPTConfig (line 31) | class LlavaMPTConfig(MPTConfig): class LlavaMPTModel (line 35) | class LlavaMPTModel(LlavaMetaModel, MPTModel): method __init__ (line 38) | def __init__(self, config: MPTConfig): method embed_tokens (line 42) | def embed_tokens(self, x): class LlavaMPTForCausalLM (line 46) | class LlavaMPTForCausalLM(MPTForCausalLM, LlavaMetaForCausalLM): method __init__ (line 50) | def __init__(self, config): method get_model (line 66) | def get_model(self): method _set_gradient_checkpointing (line 69) | def _set_gradient_checkpointing(self, module, value=False): method forward (line 73) | def forward(self, input_ids: torch.LongTensor, past_key_values: Option... method prepare_inputs_for_generation (line 92) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... FILE: llavamod/model/language_model/llava_phi.py class LlavaPhiConfig (line 32) | class LlavaPhiConfig(PhiConfig): class LlavaPhiModel (line 36) | class LlavaPhiModel(LlavaMetaModel, PhiModel): method __init__ (line 39) | def __init__(self, config: PhiConfig): class LlavaPhiForCausalLM (line 43) | class LlavaPhiForCausalLM(PhiForCausalLM, LlavaMetaForCausalLM): method __init__ (line 46) | def __init__(self, config): method get_model (line 55) | def get_model(self): method forward (line 58) | def forward( method prepare_inputs_for_generation (line 112) | def prepare_inputs_for_generation( FILE: llavamod/model/language_model/llava_phi_moe.py function rank0_print (line 44) | def rank0_print(*args): class LLaVAMoDPhiConfig (line 49) | class LLaVAMoDPhiConfig(PhiConfig): method __init__ (line 52) | def __init__(self, class LLaVAMoDPhiModel (line 84) | class LLaVAMoDPhiModel(LlavaMetaModel, PhiModel): method __init__ (line 87) | def __init__(self, config: PhiConfig): class MoEBaseModelOutputWithPast (line 92) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 101) | class MoECausalLMOutputWithPast(ModelOutput): function MoEPhiDecoderLayer_forward (line 111) | def MoEPhiDecoderLayer_forward(self): function MoEPhiModel_forward (line 158) | def MoEPhiModel_forward(self): class LLaVAMoDPhiForCausalLM (line 297) | class LLaVAMoDPhiForCausalLM(PhiForCausalLM, LlavaMetaForCausalLM): method __init__ (line 300) | def __init__(self, config): method get_model (line 309) | def get_model(self): method forward (line 312) | def forward( method prepare_inputs_for_generation (line 407) | def prepare_inputs_for_generation( method initialize_moe_modules (line 429) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDPhiForCausalLM (line 512) | class EvalLLaVAMoDPhiForCausalLM(LLaVAMoDPhiForCausalLM): method __init__ (line 515) | def __init__(self, config): FILE: llavamod/model/language_model/llava_qwen.py class LlavaQWenConfig (line 35) | class LlavaQWenConfig(QWenConfig): class LlavaQWenModel (line 39) | class LlavaQWenModel(LlavaMetaModel, QWenModel): method __init__ (line 42) | def __init__(self, config: QWenConfig): method embed_tokens (line 45) | def embed_tokens(self, input_ids): class LlavaQWenForCausalLM (line 49) | class LlavaQWenForCausalLM(QWenLMHeadModel, LlavaQWenMetaForCausalLM): method __init__ (line 52) | def __init__(self, config): method get_model (line 118) | def get_model(self): method forward (line 121) | def forward( method prepare_inputs_for_generation (line 190) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... FILE: llavamod/model/language_model/llava_qwen1_5.py function rank0_print (line 33) | def rank0_print(*args, **kwargs): class LlavaQwen1_5Config (line 45) | class LlavaQwen1_5Config(Qwen2Config): class LlavaQwen1_5Model (line 49) | class LlavaQwen1_5Model(LlavaMetaModel, Qwen2Model): method __init__ (line 52) | def __init__(self, config: Qwen2Config): class LlavaQwen1_5ForCausalLM (line 56) | class LlavaQwen1_5ForCausalLM(Qwen2ForCausalLM, LlavaMetaForCausalLM): method __init__ (line 59) | def __init__(self, config): method get_model (line 68) | def get_model(self): method forward (line 71) | def forward( method prepare_inputs_for_generation (line 147) | def prepare_inputs_for_generation( FILE: llavamod/model/language_model/llava_qwen1_5_moe.py function rank0_print (line 43) | def rank0_print(*args): class LLaVAMoDQwen1_5Config (line 48) | class LLaVAMoDQwen1_5Config(Qwen2Config): method __init__ (line 51) | def __init__(self, class LLaVAMoDQwen1_5Model (line 84) | class LLaVAMoDQwen1_5Model(LlavaMetaModel, Qwen2Model): method __init__ (line 87) | def __init__(self, config: Qwen2Config): class MoEBaseModelOutputWithPast (line 92) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 101) | class MoECausalLMOutputWithPast(ModelOutput): function MoEQwen1_5DecoderLayer_forward (line 112) | def MoEQwen1_5DecoderLayer_forward(self): function MoEQwen1_5Model_forward (line 184) | def MoEQwen1_5Model_forward(self): class LLaVAMoDQwen1_5ForCausalLM (line 342) | class LLaVAMoDQwen1_5ForCausalLM(Qwen2ForCausalLM, LlavaMetaForCausalLM): method __init__ (line 345) | def __init__(self, config): method get_model (line 354) | def get_model(self): method forward (line 357) | def forward( method prepare_inputs_for_generation (line 453) | def prepare_inputs_for_generation( method initialize_moe_modules (line 475) | def initialize_moe_modules(self, model_args): class LLaVAMoDQwen1_5ForCausalLMFineTune (line 564) | class LLaVAMoDQwen1_5ForCausalLMFineTune(LLaVAMoDQwen1_5ForCausalLM): method __init__ (line 567) | def __init__(self, config): method initialize_moe_modules (line 619) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDQwen1_5ForCausalLM (line 629) | class EvalLLaVAMoDQwen1_5ForCausalLM(LLaVAMoDQwen1_5ForCausalLM): method __init__ (line 632) | def __init__(self, config): FILE: llavamod/model/language_model/llava_qwen2.py class LlavaQwen2Config (line 31) | class LlavaQwen2Config(Qwen2Config): class LlavaQwen2Model (line 35) | class LlavaQwen2Model(LlavaMetaModel, Qwen2Model): method __init__ (line 38) | def __init__(self, config: Qwen2Config): class LlavaQwen2ForCausalLM (line 42) | class LlavaQwen2ForCausalLM(Qwen2ForCausalLM, LlavaMetaForCausalLM): method __init__ (line 45) | def __init__(self, config): method get_model (line 54) | def get_model(self): method forward (line 57) | def forward( method prepare_inputs_for_generation (line 110) | def prepare_inputs_for_generation( FILE: llavamod/model/language_model/llava_qwen2_moe.py function rank0_print (line 43) | def rank0_print(*args): class LLaVAMoDQwen2Config (line 48) | class LLaVAMoDQwen2Config(Qwen2Config): method __init__ (line 51) | def __init__(self, class LLaVAMoDQwen2Model (line 84) | class LLaVAMoDQwen2Model(LlavaMetaModel, Qwen2Model): method __init__ (line 87) | def __init__(self, config: Qwen2Config): class MoEBaseModelOutputWithPast (line 92) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 101) | class MoECausalLMOutputWithPast(ModelOutput): function MoEQwen2DecoderLayer_forward (line 112) | def MoEQwen2DecoderLayer_forward(self): function MoEQwen2Model_forward (line 184) | def MoEQwen2Model_forward(self): class LLaVAMoDQwen2ForCausalLM (line 342) | class LLaVAMoDQwen2ForCausalLM(Qwen2ForCausalLM, LlavaMetaForCausalLM): method __init__ (line 345) | def __init__(self, config): method get_model (line 354) | def get_model(self): method forward (line 357) | def forward( method prepare_inputs_for_generation (line 453) | def prepare_inputs_for_generation( method initialize_moe_modules (line 475) | def initialize_moe_modules(self, model_args): class LLaVAMoDQwen2ForCausalLMFineTune (line 564) | class LLaVAMoDQwen2ForCausalLMFineTune(LLaVAMoDQwen2ForCausalLM): method __init__ (line 567) | def __init__(self, config): method initialize_moe_modules (line 619) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDQwen2ForCausalLM (line 629) | class EvalLLaVAMoDQwen2ForCausalLM(LLaVAMoDQwen2ForCausalLM): method __init__ (line 632) | def __init__(self, config): FILE: llavamod/model/language_model/llava_qwen_moe.py function rank0_print (line 38) | def rank0_print(*args): class LLaVAMoDQWenConfig (line 43) | class LLaVAMoDQWenConfig(QWenConfig): method __init__ (line 46) | def __init__(self, class LLaVAMoDQWenModel (line 78) | class LLaVAMoDQWenModel(LlavaMetaModel, QWenModel): method __init__ (line 81) | def __init__(self, config: QWenConfig): method embed_tokens (line 84) | def embed_tokens(self, input_ids): class MoEBaseModelOutputWithPast (line 89) | class MoEBaseModelOutputWithPast(BaseModelOutputWithPast): class MoECausalLMOutputWithPast (line 98) | class MoECausalLMOutputWithPast(CausalLMOutputWithPast): function MoEQWenBlock_forward (line 109) | def MoEQWenBlock_forward(self): function MoEQWenModel_forward (line 162) | def MoEQWenModel_forward(self): class LLaVAMoDQWenForCausalLM (line 360) | class LLaVAMoDQWenForCausalLM(QWenLMHeadModel, LlavaQWenMetaForCausalLM): method __init__ (line 363) | def __init__(self, config): method get_model (line 429) | def get_model(self): method forward (line 432) | def forward( method prepare_inputs_for_generation (line 537) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... method initialize_moe_modules (line 546) | def initialize_moe_modules(self, model_args): class LLaVAMoDQWenForCausalLMFineTune (line 626) | class LLaVAMoDQWenForCausalLMFineTune(LLaVAMoDQWenForCausalLM): method __init__ (line 629) | def __init__(self, config): method initialize_moe_modules (line 658) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDQWenForCausalLM (line 668) | class EvalLLaVAMoDQWenForCausalLM(LLaVAMoDQWenForCausalLM): method __init__ (line 671) | def __init__(self, config): FILE: llavamod/model/language_model/llava_stablelm.py class LlavaStablelmConfig (line 32) | class LlavaStablelmConfig(StableLMEpochConfig): class LlavaStablelmModel (line 36) | class LlavaStablelmModel(LlavaMetaModel, StableLMEpochModel): method __init__ (line 39) | def __init__(self, config: StableLMEpochConfig): class LlavaStablelmForCausalLM (line 43) | class LlavaStablelmForCausalLM(StableLMEpochForCausalLM, LlavaMetaForCau... method __init__ (line 46) | def __init__(self, config): method get_model (line 55) | def get_model(self): method forward (line 58) | def forward( method prepare_inputs_for_generation (line 111) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... FILE: llavamod/model/language_model/llava_stablelm_moe.py function rank0_print (line 44) | def rank0_print(*args): class LLaVAMoDStablelmConfig (line 49) | class LLaVAMoDStablelmConfig(StableLMEpochConfig): method __init__ (line 52) | def __init__(self, class LLaVAMoDStablelmModel (line 84) | class LLaVAMoDStablelmModel(LlavaMetaModel, StableLMEpochModel): method __init__ (line 87) | def __init__(self, config: StableLMEpochConfig): class MoEBaseModelOutputWithPast (line 92) | class MoEBaseModelOutputWithPast(ModelOutput): class MoECausalLMOutputWithPast (line 101) | class MoECausalLMOutputWithPast(ModelOutput): function MoEStablelmDecoderLayer_forward (line 111) | def MoEStablelmDecoderLayer_forward(self): function MoEStablelmModel_forward (line 166) | def MoEStablelmModel_forward(self): class LLaVAMoDStablelmForCausalLM (line 311) | class LLaVAMoDStablelmForCausalLM(StableLMEpochForCausalLM, LlavaMetaFor... method __init__ (line 314) | def __init__(self, config): method get_model (line 323) | def get_model(self): method forward (line 326) | def forward( method prepare_inputs_for_generation (line 421) | def prepare_inputs_for_generation(self, input_ids, past_key_values=Non... method initialize_moe_modules (line 430) | def initialize_moe_modules(self, model_args): class EvalLLaVAMoDStablelmForCausalLM (line 513) | class EvalLLaVAMoDStablelmForCausalLM(LLaVAMoDStablelmForCausalLM): method __init__ (line 516) | def __init__(self, config): FILE: llavamod/model/language_model/minicpm/configuration_minicpm.py class MiniCPMConfig (line 31) | class MiniCPMConfig(PretrainedConfig): method __init__ (line 117) | def __init__( method _rope_scaling_validation (line 178) | def _rope_scaling_validation(self): FILE: llavamod/model/language_model/minicpm/modeling_minicpm.py function _get_unpad_data (line 74) | def _get_unpad_data(attention_mask): function _expand_mask (line 86) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... function _make_causal_mask (line 93) | def _make_causal_mask( function rms_layernorm (line 104) | def rms_layernorm(hidden: torch.Tensor, weight: torch.Tensor, eps: float): class MiniCPMRMSNorm (line 111) | class MiniCPMRMSNorm(nn.Module): method __init__ (line 112) | def __init__(self, hidden_size, eps=1e-6): method forward (line 120) | def forward(self, hidden_states): class MiniCPMRotaryEmbedding (line 127) | class MiniCPMRotaryEmbedding(nn.Module): method __init__ (line 128) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 143) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 153) | def forward(self, x, seq_len=None): class MiniCPMLinearScalingRotaryEmbedding (line 164) | class MiniCPMLinearScalingRotaryEmbedding(MiniCPMRotaryEmbedding): method __init__ (line 167) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 171) | def _set_cos_sin_cache(self, seq_len, device, dtype): class MiniCPMDynamicNTKScalingRotaryEmbedding (line 183) | class MiniCPMDynamicNTKScalingRotaryEmbedding(MiniCPMRotaryEmbedding): method __init__ (line 186) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 190) | def _set_cos_sin_cache(self, seq_len, device, dtype): function rotate_half (line 210) | def rotate_half(x): function apply_rotary_pos_emb (line 217) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class MiniCPMMLP (line 251) | class MiniCPMMLP(nn.Module): method __init__ (line 252) | def __init__(self, config): method forward (line 262) | def forward(self, x): function repeat_kv (line 285) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class MiniCPMAttention (line 298) | class MiniCPMAttention(nn.Module): method __init__ (line 301) | def __init__(self, config: MiniCPMConfig, layer_idx: Optional[int] = N... method _init_rope (line 334) | def _init_rope(self): method _shape (line 361) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 364) | def forward( class MiniCPMFlashAttention2 (line 469) | class MiniCPMFlashAttention2(MiniCPMAttention): method __init__ (line 476) | def __init__(self, *args, **kwargs): method forward (line 484) | def forward( method _flash_attention_forward (line 572) | def _flash_attention_forward( method _upad_input (line 629) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class MiniCPMSdpaAttention (line 668) | class MiniCPMSdpaAttention(MiniCPMAttention): method forward (line 676) | def forward( class MiniCPMDecoderLayer (line 762) | class MiniCPMDecoderLayer(nn.Module): method __init__ (line 763) | def __init__(self, config: MiniCPMConfig, layer_idx: int): method forward (line 776) | def forward( class MiniCPMPreTrainedModel (line 859) | class MiniCPMPreTrainedModel(PreTrainedModel): method _init_weights (line 869) | def _init_weights(self, module): class MiniCPMModel (line 955) | class MiniCPMModel(MiniCPMPreTrainedModel): method __init__ (line 963) | def __init__(self, config: MiniCPMConfig): method get_input_embeddings (line 981) | def get_input_embeddings(self): method set_input_embeddings (line 984) | def set_input_embeddings(self, value): method forward (line 988) | def forward( class MiniCPMForCausalLM (line 1119) | class MiniCPMForCausalLM(MiniCPMPreTrainedModel): method __init__ (line 1122) | def __init__(self, config): method get_input_embeddings (line 1131) | def get_input_embeddings(self): method set_input_embeddings (line 1134) | def set_input_embeddings(self, value): method get_output_embeddings (line 1137) | def get_output_embeddings(self): method set_output_embeddings (line 1140) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1143) | def set_decoder(self, decoder): method get_decoder (line 1146) | def get_decoder(self): method forward (line 1151) | def forward( method prepare_inputs_for_generation (line 1242) | def prepare_inputs_for_generation( method _reorder_cache (line 1299) | def _reorder_cache(past_key_values, beam_idx): method chat (line 1308) | def chat(self, tokenizer, query: str, history: List[Dict] = None, role... class MiniCPMForSequenceClassification (line 1349) | class MiniCPMForSequenceClassification(MiniCPMPreTrainedModel): method __init__ (line 1350) | def __init__(self, config): method get_input_embeddings (line 1359) | def get_input_embeddings(self): method set_input_embeddings (line 1362) | def set_input_embeddings(self, value): method forward (line 1366) | def forward( FILE: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/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: llavamod/model/language_model/phi/configuration_phi.py class PhiConfig (line 30) | class PhiConfig(PretrainedConfig): method __init__ (line 117) | def __init__( method _rope_scaling_validation (line 174) | def _rope_scaling_validation(self): FILE: llavamod/model/language_model/phi/modeling_phi.py function _get_unpad_data (line 69) | def _get_unpad_data(attention_mask): class PhiRotaryEmbedding (line 82) | class PhiRotaryEmbedding(nn.Module): method __init__ (line 83) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 97) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 107) | def forward(self, x, seq_len=None): class PhiLinearScalingRotaryEmbedding (line 119) | class PhiLinearScalingRotaryEmbedding(PhiRotaryEmbedding): method __init__ (line 122) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 126) | def _set_cos_sin_cache(self, seq_len, device, dtype): class PhiDynamicNTKScalingRotaryEmbedding (line 139) | class PhiDynamicNTKScalingRotaryEmbedding(PhiRotaryEmbedding): method __init__ (line 142) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 146) | def _set_cos_sin_cache(self, seq_len, device, dtype): function rotate_half (line 166) | def rotate_half(x): function apply_rotary_pos_emb (line 174) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class PhiMLP (line 203) | class PhiMLP(nn.Module): method __init__ (line 204) | def __init__(self, config): method forward (line 211) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: function repeat_kv (line 219) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class PhiAttention (line 231) | class PhiAttention(nn.Module): method __init__ (line 234) | def __init__(self, config: PhiConfig, layer_idx: Optional[int] = None): method _init_rope (line 278) | def _init_rope(self): method forward (line 308) | def forward( class PhiFlashAttention2 (line 406) | class PhiFlashAttention2(PhiAttention): method __init__ (line 414) | def __init__(self, *args, **kwargs): method forward (line 422) | def forward( method _flash_attention_forward (line 524) | def _flash_attention_forward( method _upad_input (line 584) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class PhiDecoderLayer (line 629) | class PhiDecoderLayer(nn.Module): method __init__ (line 630) | def __init__(self, config: PhiConfig, layer_idx: int): method forward (line 637) | def forward( class PhiPreTrainedModel (line 713) | class PhiPreTrainedModel(PreTrainedModel): method _init_weights (line 722) | def _init_weights(self, module): class PhiModel (line 808) | class PhiModel(PhiPreTrainedModel): method __init__ (line 816) | def __init__(self, config: PhiConfig): method get_input_embeddings (line 833) | def get_input_embeddings(self): method set_input_embeddings (line 836) | def set_input_embeddings(self, value): method forward (line 840) | def forward( class PhiForCausalLM (line 964) | class PhiForCausalLM(PhiPreTrainedModel): method __init__ (line 968) | def __init__(self, config): method get_input_embeddings (line 978) | def get_input_embeddings(self): method set_input_embeddings (line 982) | def set_input_embeddings(self, value): method get_output_embeddings (line 986) | def get_output_embeddings(self): method set_output_embeddings (line 990) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 994) | def set_decoder(self, decoder): method get_decoder (line 998) | def get_decoder(self): method forward (line 1003) | def forward( method prepare_inputs_for_generation (line 1091) | def prepare_inputs_for_generation( method _reorder_cache (line 1149) | def _reorder_cache(past_key_values, beam_idx): class PhiForSequenceClassification (line 1174) | class PhiForSequenceClassification(PhiPreTrainedModel): method __init__ (line 1175) | def __init__(self, config): method get_input_embeddings (line 1184) | def get_input_embeddings(self): method set_input_embeddings (line 1187) | def set_input_embeddings(self, value): method forward (line 1191) | def forward( class PhiForTokenClassification (line 1290) | class PhiForTokenClassification(PhiPreTrainedModel): method __init__ (line 1291) | def __init__(self, config: PhiConfig): method forward (line 1314) | def forward( FILE: llavamod/model/language_model/qwen/configuration_qwen.py class QWenConfig (line 9) | class QWenConfig(PretrainedConfig): method __init__ (line 13) | def __init__( FILE: llavamod/model/language_model/qwen/cpp_kernels.py function _get_cuda_bare_metal_version (line 6) | def _get_cuda_bare_metal_version(cuda_dir): function _create_build_dir (line 17) | def _create_build_dir(buildpath): function _cpp_extention_load_helper (line 39) | def _cpp_extention_load_helper(name, sources, extra_cuda_flags): FILE: llavamod/model/language_model/qwen/modeling_qwen.py function _import_flash_attn (line 83) | def _import_flash_attn(): function quantize_cache_v (line 123) | def quantize_cache_v(fdata, bits, qmax, qmin): function dequantize_cache_torch (line 145) | def dequantize_cache_torch(qdata, scale, zero): class FlashSelfAttention (line 149) | class FlashSelfAttention(torch.nn.Module): method __init__ (line 150) | def __init__( method unpad_input (line 167) | def unpad_input(self, hidden_states, attention_mask): method pad_input (line 176) | def pad_input(self, hidden_states, indices, batch, seqlen): method forward (line 182) | def forward(self, q, k, v, attention_mask=None): class QWenAttention (line 247) | class QWenAttention(nn.Module): method __init__ (line 248) | def __init__(self, config): method _attn (line 323) | def _attn(self, query, key, value, causal_mask=None, attention_mask=No... method _split_heads (line 394) | def _split_heads(self, tensor, num_heads, attn_head_size): method _merge_heads (line 399) | def _merge_heads(self, tensor, num_heads, attn_head_size): method forward (line 404) | def forward( class QWenMLP (line 558) | class QWenMLP(nn.Module): method __init__ (line 559) | def __init__(self, config): method forward (line 570) | def forward(self, hidden_states): class QWenBlock (line 578) | class QWenBlock(nn.Module): method __init__ (line 579) | def __init__(self, config): method forward (line 596) | def forward( class QWenPreTrainedModel (line 640) | class QWenPreTrainedModel(PreTrainedModel): method __init__ (line 648) | def __init__(self, *inputs, **kwargs): method _init_weights (line 651) | def _init_weights(self, module): method _set_gradient_checkpointing (line 674) | def _set_gradient_checkpointing(self, module, value=False): class QWenModel (line 679) | class QWenModel(QWenPreTrainedModel): method __init__ (line 682) | def __init__(self, config): method get_input_embeddings (line 729) | def get_input_embeddings(self): method set_input_embeddings (line 732) | def set_input_embeddings(self, new_embeddings): method get_ntk_alpha (line 735) | def get_ntk_alpha(self, true_seq_len): method forward (line 741) | def forward( class QWenLMHeadModel (line 929) | class QWenLMHeadModel(QWenPreTrainedModel): method __init__ (line 933) | def __init__(self, config): method get_output_embeddings (line 990) | def get_output_embeddings(self): method set_output_embeddings (line 993) | def set_output_embeddings(self, new_embeddings): method prepare_inputs_for_generation (line 996) | def prepare_inputs_for_generation( method forward (line 1022) | def forward( method _reorder_cache (line 1093) | def _reorder_cache( method chat (line 1105) | def chat( method chat_stream (line 1171) | def chat_stream( method generate (line 1234) | def generate( class RotaryEmbedding (line 1280) | class RotaryEmbedding(torch.nn.Module): method __init__ (line 1281) | def __init__(self, dim, base=10000): method update_rotary_pos_emb_cache (line 1295) | def update_rotary_pos_emb_cache(self, seqlen, ntk_alpha=1.0): method forward (line 1318) | def forward(self, max_seq_len, ntk_alpha=1.0): function _rotate_half (line 1324) | def _rotate_half(x): function apply_rotary_pos_emb (line 1332) | def apply_rotary_pos_emb(t, freqs): class RMSNorm (line 1357) | class RMSNorm(torch.nn.Module): method __init__ (line 1358) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 1363) | def _norm(self, x): method forward (line 1366) | def forward(self, x): FILE: llavamod/model/language_model/qwen/qwen_generation_utils.py function pad_batch (line 25) | def pad_batch(batch: BatchTokensType, pad_id: int, seq_length: int) -> B... function get_ltor_masks_and_position_ids (line 33) | def get_ltor_masks_and_position_ids( function get_batch (line 94) | def get_batch(context_tokens: torch.LongTensor, eod_id: int): function get_stop_words_ids (line 109) | def get_stop_words_ids(chat_format, tokenizer): function make_context (line 119) | def make_context( function _decode_default (line 192) | def _decode_default( function _decode_chatml (line 225) | def _decode_chatml( function decode_tokens (line 261) | def decode_tokens( class StopWordsLogitsProcessor (line 301) | class StopWordsLogitsProcessor(LogitsProcessor): method __init__ (line 314) | def __init__(self, stop_words_ids: Iterable[Iterable[int]], eos_token_... method __call__ (line 348) | def __call__( method _tokens_match (line 357) | def _tokens_match(self, prev_tokens: torch.LongTensor, tokens: List[in... method _calc_stopped_samples (line 370) | def _calc_stopped_samples(self, prev_input_ids: Iterable[int]) -> Iter... function top_k_logits (line 384) | def top_k_logits(logits, top_k=0, top_p=0.0, filter_value=-float("Inf")): function switch (line 414) | def switch(val1, val2, boolean): FILE: llavamod/model/language_model/qwen/tokenization_qwen.py function _load_tiktoken_bpe (line 48) | def _load_tiktoken_bpe(tiktoken_bpe_file: str) -> Dict[bytes, int]: class QWenTokenizer (line 57) | class QWenTokenizer(PreTrainedTokenizer): method __init__ (line 62) | def __init__( method __getstate__ (line 116) | def __getstate__(self): method __setstate__ (line 122) | def __setstate__(self, state): method __len__ (line 133) | def __len__(self) -> int: method get_vocab (line 136) | def get_vocab(self) -> Dict[bytes, int]: method convert_tokens_to_ids (line 139) | def convert_tokens_to_ids( method _add_tokens (line 155) | def _add_tokens( method save_vocabulary (line 168) | def save_vocabulary(self, save_directory: str, **kwargs) -> Tuple[str]: method tokenize (line 181) | def tokenize( method convert_tokens_to_string (line 214) | def convert_tokens_to_string(self, tokens: List[Union[bytes, str]]) ->... method vocab_size (line 235) | def vocab_size(self): method _convert_id_to_token (line 238) | def _convert_id_to_token(self, index: int) -> Union[bytes, str]: method _convert_token_to_id (line 244) | def _convert_token_to_id(self, token: Union[bytes, str]) -> int: method _tokenize (line 252) | def _tokenize(self, text: str, **kwargs): method _decode (line 260) | def _decode( FILE: llavamod/model/language_model/qwen1_5/configuration_qwen2.py class Qwen2Config (line 28) | class Qwen2Config(PretrainedConfig): method __init__ (line 99) | def __init__( FILE: llavamod/model/language_model/qwen1_5/modeling_qwen2.py function rank0_print (line 59) | def rank0_print(*args, **kwargs): function _get_unpad_data (line 83) | def _get_unpad_data(attention_mask): class Qwen2RMSNorm (line 96) | class Qwen2RMSNorm(nn.Module): method __init__ (line 97) | def __init__(self, hidden_size, eps=1e-6): method forward (line 105) | def forward(self, hidden_states): class Qwen2RotaryEmbedding (line 114) | class Qwen2RotaryEmbedding(nn.Module): method __init__ (line 115) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 129) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 139) | def forward(self, x, seq_len=None): function rotate_half (line 151) | def rotate_half(x): function apply_rotary_pos_emb (line 159) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class Qwen2MLP (line 188) | class Qwen2MLP(nn.Module): method __init__ (line 189) | def __init__(self, config): method forward (line 199) | def forward(self, x): function repeat_kv (line 204) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Qwen2Attention (line 216) | class Qwen2Attention(nn.Module): method __init__ (line 222) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): method forward (line 259) | def forward( class Qwen2FlashAttention2 (line 341) | class Qwen2FlashAttention2(Qwen2Attention): method __init__ (line 351) | def __init__(self, *args, **kwargs): method forward (line 359) | def forward( method _flash_attention_forward (line 495) | def _flash_attention_forward( method _upad_input (line 600) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class Qwen2SdpaAttention (line 644) | class Qwen2SdpaAttention(Qwen2Attention): method forward (line 652) | def forward( class Qwen2DecoderLayer (line 738) | class Qwen2DecoderLayer(nn.Module): method __init__ (line 739) | def __init__(self, config: Qwen2Config, layer_idx: int): method forward (line 754) | def forward( class Qwen2PreTrainedModel (line 836) | class Qwen2PreTrainedModel(PreTrainedModel): method _init_weights (line 846) | def _init_weights(self, module): class Qwen2Model (line 932) | class Qwen2Model(Qwen2PreTrainedModel): method __init__ (line 940) | def __init__(self, config: Qwen2Config): method get_input_embeddings (line 956) | def get_input_embeddings(self): method set_input_embeddings (line 959) | def set_input_embeddings(self, value): method forward (line 963) | def forward( class Qwen2ForCausalLM (line 1110) | class Qwen2ForCausalLM(Qwen2PreTrainedModel): method __init__ (line 1113) | def __init__(self, config): method get_input_embeddings (line 1122) | def get_input_embeddings(self): method set_input_embeddings (line 1125) | def set_input_embeddings(self, value): method get_output_embeddings (line 1128) | def get_output_embeddings(self): method set_output_embeddings (line 1131) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1134) | def set_decoder(self, decoder): method get_decoder (line 1137) | def get_decoder(self): method forward (line 1142) | def forward( method prepare_inputs_for_generation (line 1219) | def prepare_inputs_for_generation( method _reorder_cache (line 1277) | def _reorder_cache(past_key_values, beam_idx): class Qwen2ForSequenceClassification (line 1301) | class Qwen2ForSequenceClassification(Qwen2PreTrainedModel): method __init__ (line 1302) | def __init__(self, config): method get_input_embeddings (line 1311) | def get_input_embeddings(self): method set_input_embeddings (line 1314) | def set_input_embeddings(self, value): method forward (line 1318) | def forward( FILE: llavamod/model/language_model/qwen2/configuration_qwen2.py class Qwen2Config (line 28) | class Qwen2Config(PretrainedConfig): method __init__ (line 99) | def __init__( FILE: llavamod/model/language_model/qwen2/modeling_qwen2.py function _get_unpad_data (line 70) | def _get_unpad_data(attention_mask): class Qwen2RMSNorm (line 83) | class Qwen2RMSNorm(nn.Module): method __init__ (line 84) | def __init__(self, hidden_size, eps=1e-6): method forward (line 92) | def forward(self, hidden_states): class Qwen2RotaryEmbedding (line 101) | class Qwen2RotaryEmbedding(nn.Module): method __init__ (line 102) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method _set_cos_sin_cache (line 116) | def _set_cos_sin_cache(self, seq_len, device, dtype): method forward (line 126) | def forward(self, x, seq_len=None): function rotate_half (line 138) | def rotate_half(x): function apply_rotary_pos_emb (line 146) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids, unsqueeze_dim=1): class Qwen2MLP (line 175) | class Qwen2MLP(nn.Module): method __init__ (line 176) | def __init__(self, config): method forward (line 186) | def forward(self, x): function repeat_kv (line 191) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Qwen2Attention (line 203) | class Qwen2Attention(nn.Module): method __init__ (line 209) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None): method forward (line 246) | def forward( class Qwen2FlashAttention2 (line 328) | class Qwen2FlashAttention2(Qwen2Attention): method __init__ (line 338) | def __init__(self, *args, **kwargs): method forward (line 346) | def forward( method _flash_attention_forward (line 482) | def _flash_attention_forward( method _upad_input (line 587) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class Qwen2SdpaAttention (line 631) | class Qwen2SdpaAttention(Qwen2Attention): method forward (line 639) | def forward( class Qwen2DecoderLayer (line 725) | class Qwen2DecoderLayer(nn.Module): method __init__ (line 726) | def __init__(self, config: Qwen2Config, layer_idx: int): method forward (line 741) | def forward( class Qwen2PreTrainedModel (line 823) | class Qwen2PreTrainedModel(PreTrainedModel): method _init_weights (line 833) | def _init_weights(self, module): class Qwen2Model (line 919) | class Qwen2Model(Qwen2PreTrainedModel): method __init__ (line 927) | def __init__(self, config: Qwen2Config): method get_input_embeddings (line 943) | def get_input_embeddings(self): method set_input_embeddings (line 946) | def set_input_embeddings(self, value): method forward (line 950) | def forward( class Qwen2ForCausalLM (line 1097) | class Qwen2ForCausalLM(Qwen2PreTrainedModel): method __init__ (line 1100) | def __init__(self, config): method get_input_embeddings (line 1109) | def get_input_embeddings(self): method set_input_embeddings (line 1112) | def set_input_embeddings(self, value): method get_output_embeddings (line 1115) | def get_output_embeddings(self): method set_output_embeddings (line 1118) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 1121) | def set_decoder(self, decoder): method get_decoder (line 1124) | def get_decoder(self): method forward (line 1129) | def forward( method prepare_inputs_for_generation (line 1192) | def prepare_inputs_for_generation( method _reorder_cache (line 1250) | def _reorder_cache(past_key_values, beam_idx): class Qwen2ForSequenceClassification (line 1274) | class Qwen2ForSequenceClassification(Qwen2PreTrainedModel): method __init__ (line 1275) | def __init__(self, config): method get_input_embeddings (line 1284) | def get_input_embeddings(self): method set_input_embeddings (line 1287) | def set_input_embeddings(self, value): method forward (line 1291) | def forward( FILE: llavamod/model/language_model/stablelm/configuration_stablelm_epoch.py class StableLMEpochConfig (line 22) | class StableLMEpochConfig(PretrainedConfig): method __init__ (line 72) | def __init__( FILE: llavamod/model/language_model/stablelm/modeling_stablelm_epoch.py function _get_unpad_data (line 52) | def _get_unpad_data(attention_mask): function _make_causal_mask (line 65) | def _make_causal_mask( function _expand_mask (line 83) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class RotaryEmbedding (line 96) | class RotaryEmbedding(nn.Module): method __init__ (line 97) | def __init__( method _set_cos_sin_cache (line 117) | def _set_cos_sin_cache(self, seq_len: int, device: torch.device, dtype... method forward (line 129) | def forward(self, x: torch.Tensor, seq_len: Optional[int] = None): function rotate_half (line 139) | def rotate_half(x: torch.Tensor): function apply_rotary_pos_emb (line 145) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class MLP (line 156) | class MLP(nn.Module): method __init__ (line 157) | def __init__(self, config: StableLMEpochConfig): method forward (line 167) | def forward(self, x: torch.Tensor) -> torch.Tensor: function repeat_kv (line 171) | def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: class Attention (line 183) | class Attention(nn.Module): method __init__ (line 184) | def __init__(self, config: StableLMEpochConfig): method _init_rope (line 208) | def _init_rope(self): method forward (line 216) | def forward( class FlashAttention2 (line 299) | class FlashAttention2(Attention): method __init__ (line 304) | def __init__(self, *args, **kwargs): method forward (line 312) | def forward( method _flash_attention_forward (line 387) | def _flash_attention_forward( method _upad_input (line 446) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class DecoderLayer (line 491) | class DecoderLayer(nn.Module): method __init__ (line 492) | def __init__(self, config: StableLMEpochConfig): method forward (line 499) | def forward( class StableLMEpochPreTrainedModel (line 540) | class StableLMEpochPreTrainedModel(PreTrainedModel): method _init_weights (line 552) | def _init_weights(self, module: nn.Module): method _set_gradient_checkpointing (line 566) | def _set_gradient_checkpointing(self, module: nn.Module, value=False): class StableLMEpochModel (line 571) | class StableLMEpochModel(StableLMEpochPreTrainedModel): method __init__ (line 572) | def __init__(self, config: StableLMEpochConfig): method get_input_embeddings (line 583) | def get_input_embeddings(self): method set_input_embeddings (line 586) | def set_input_embeddings(self, value: nn.Module): method _prepare_decoder_attention_mask (line 590) | def _prepare_decoder_attention_mask( method forward (line 617) | def forward( class StableLMEpochForCausalLM (line 760) | class StableLMEpochForCausalLM(StableLMEpochPreTrainedModel): method __init__ (line 763) | def __init__(self, config: StableLMEpochConfig): method get_input_embeddings (line 772) | def get_input_embeddings(self): method set_input_embeddings (line 775) | def set_input_embeddings(self, value): method get_output_embeddings (line 778) | def get_output_embeddings(self): method set_output_embeddings (line 781) | def set_output_embeddings(self, new_embeddings: nn.Module): method get_decoder (line 784) | def get_decoder(self): method set_decoder (line 787) | def set_decoder(self, decoder): method forward (line 790) | def forward( method prepare_inputs_for_generation (line 858) | def prepare_inputs_for_generation( method _reorder_cache (line 904) | def _reorder_cache(past_key_values, beam_idx): FILE: llavamod/model/language_model/stablelm/tokenization_arcade100k.py function _load_tiktoken_bpe (line 23) | def _load_tiktoken_bpe(tiktoken_bpe_file: str) -> Dict[bytes, int]: function _arcade100k (line 79) | def _arcade100k(vocab_file: str): class Arcade100kTokenizer (line 90) | class Arcade100kTokenizer(PreTrainedTokenizer): method __init__ (line 107) | def __init__( method __len__ (line 133) | def __len__(self): method vocab_size (line 137) | def vocab_size(self): method get_vocab (line 140) | def get_vocab(self) -> Dict[bytes, int]: method convert_tokens_to_ids (line 143) | def convert_tokens_to_ids( method _add_tokens (line 159) | def _add_tokens( method save_vocabulary (line 172) | def save_vocabulary(self, save_directory: str, **kwargs) -> Tuple[str]: method tokenize (line 186) | def tokenize( method convert_tokens_to_string (line 222) | def convert_tokens_to_string(self, tokens: List[Union[bytes, str]]) ->... method _convert_id_to_token (line 242) | def _convert_id_to_token(self, index: int) -> Union[bytes, str]: method _convert_token_to_id (line 248) | def _convert_token_to_id(self, token: Union[bytes, str]) -> int: method _tokenize (line 256) | def _tokenize(self, text: str, **kwargs): method _decode (line 265) | def _decode( FILE: llavamod/model/llava_arch.py class LlavaMetaModel (line 27) | class LlavaMetaModel: method __init__ (line 29) | def __init__(self, config): method get_image_tower (line 38) | def get_image_tower(self): method get_video_tower (line 44) | def get_video_tower(self): method initialize_vision_modules (line 50) | def initialize_vision_modules(self, model_args, fsdp=None): class LlavaMetaForCausalLM (line 131) | class LlavaMetaForCausalLM(ABC): method get_model (line 134) | def get_model(self): method get_image_tower (line 137) | def get_image_tower(self): method get_video_tower (line 140) | def get_video_tower(self): method encode_images (line 143) | def encode_images(self, images): method encode_videos (line 150) | def encode_videos(self, videos): # [mini_b, c, t, h, w] method prepare_inputs_labels_for_multimodal (line 155) | def prepare_inputs_labels_for_multimodal( method initialize_vision_tokenizer (line 336) | def initialize_vision_tokenizer(self, model_args, tokenizer): class LlavaQWenMetaForCausalLM (line 382) | class LlavaQWenMetaForCausalLM(LlavaMetaForCausalLM): method prepare_inputs_labels_for_multimodal (line 384) | def prepare_inputs_labels_for_multimodal( FILE: llavamod/model/make_delta.py function make_delta (line 13) | def make_delta(base_model_path, target_model_path, delta_path, hub_repo_... FILE: llavamod/model/modeling_flash_attention_utils.py function _get_unpad_data (line 34) | def _get_unpad_data(attention_mask: torch.Tensor) -> Tuple[torch.Tensor,... function _upad_input (line 61) | def _upad_input( function prepare_fa2_from_position_ids (line 134) | def prepare_fa2_from_position_ids(query, key, value, position_ids): function _flash_attention_forward (line 184) | def _flash_attention_forward( FILE: llavamod/model/multimodal_encoder/builder.py function build_image_tower (line 15) | def build_image_tower(image_tower_cfg, **kwargs): function build_video_tower (line 39) | def build_video_tower(video_tower_cfg, **kwargs): FILE: llavamod/model/multimodal_encoder/clip_encoder.py class CLIPVisionTower (line 7) | class CLIPVisionTower(nn.Module): method __init__ (line 8) | def __init__(self, image_tower, args, delay_load=False, cache_dir='./c... method load_model (line 24) | def load_model(self): method feature_select (line 35) | def feature_select(self, image_forward_outs): method forward (line 46) | def forward(self, images): method dummy_feature (line 60) | def dummy_feature(self): method dtype (line 64) | def dtype(self): method device (line 68) | def device(self): method config (line 72) | def config(self): method hidden_size (line 79) | def hidden_size(self): method num_patches (line 83) | def num_patches(self): FILE: llavamod/model/multimodal_encoder/clips2_encoder.py class CLIPVisionTowerS2 (line 8) | class CLIPVisionTowerS2(CLIPVisionTower): method __init__ (line 9) | def __init__(self, image_tower, args, delay_load=False): method load_model (line 27) | def load_model(self): method forward_feature (line 42) | def forward_feature(self, images): method forward (line 49) | def forward(self, images): method hidden_size (line 65) | def hidden_size(self): FILE: llavamod/model/multimodal_encoder/siglip_encoder.py class SiglipVisionTower (line 8) | class SiglipVisionTower(nn.Module): method __init__ (line 9) | def __init__(self, image_tower, args, delay_load=False, cache_dir='./c... method load_model (line 25) | def load_model(self): method feature_select (line 32) | def feature_select(self, image_forward_outs): method forward (line 43) | def forward(self, images): method dummy_feature (line 57) | def dummy_feature(self): method dtype (line 61) | def dtype(self): method device (line 65) | def device(self): method config (line 69) | def config(self): method hidden_size (line 76) | def hidden_size(self): method num_patches (line 80) | def num_patches(self): FILE: llavamod/model/multimodal_projector/builder.py class IdentityMap (line 14) | class IdentityMap(nn.Module): method __init__ (line 15) | def __init__(self): method forward (line 18) | def forward(self, x, *args, **kwargs): method config (line 22) | def config(self): function build_image_projector (line 26) | def build_image_projector(config, delay_load=False, **kwargs): function build_video_projector (line 69) | def build_video_projector(config, delay_load=False, **kwargs): class MLP (line 112) | class MLP(nn.Module): method __init__ (line 113) | def __init__(self, mm_hidden_size, hidden_size): method forward (line 121) | def forward(self, x): class build_projector (line 125) | class build_projector(nn.Module): method __init__ (line 126) | def __init__(self, config, delay_load=False, **kwargs): method forward_image (line 148) | def forward_image(self, image_feature): method forward_video (line 151) | def forward_video(self, video_feature): FILE: llavamod/model/multimodal_projector/pool_block.py class Pool_Block (line 8) | class Pool_Block(nn.Module): method __init__ (line 9) | def __init__(self, projector_type, config): method forward (line 20) | def forward(self, x): FILE: llavamod/model/multimodal_projector/qformer.py class Blip2Model (line 9) | class Blip2Model(Blip2PreTrainedModel): method __init__ (line 10) | def __init__(self, config: Blip2Config): method forward (line 26) | def forward( function qformer_config_template (line 62) | def qformer_config_template(config, projector_type): class Cheap_Blip2Model (line 159) | class Cheap_Blip2Model(Blip2PreTrainedModel): method __init__ (line 160) | def __init__(self, config: Blip2Config): method forward (line 176) | def forward( function cheap_qformer_config_template (line 208) | def cheap_qformer_config_template(config, projector_type): FILE: llavamod/model/multimodal_projector/simple_block.py class SimpleResBlock (line 9) | class SimpleResBlock(nn.Module): method __init__ (line 10) | def __init__(self, channels): method forward (line 19) | def forward(self, x): class BaseConv2D (line 23) | class BaseConv2D(nn.Module): method __init__ (line 24) | def __init__(self, channels, groups=1, eps=1e-6): method forward (line 31) | def forward(self, x): class SimpleBlock (line 39) | class SimpleBlock(nn.Module): method __init__ (line 40) | def __init__(self, in_channels, out_channels, num_in_block, num_out_bl... method forward (line 60) | def forward(self, x): class Cheap_SimpleBlock (line 81) | class Cheap_SimpleBlock(nn.Module): method __init__ (line 82) | def __init__(self, in_channels, out_channels, num_in_block, num_out_bl... method forward (line 102) | def forward(self, x): FILE: llavamod/model/utils.py function auto_upgrade (line 7) | def auto_upgrade(config): function create_reference_model (line 34) | def create_reference_model(model, num_shared_layers: int = None, pattern... function disable_dropout_in_model (line 109) | def disable_dropout_in_model(model: torch.nn.Module) -> None: class CausalLMOutputWithPast (line 121) | class CausalLMOutputWithPast(ModelOutput): FILE: llavamod/serve/cli.py function load_image (line 17) | def load_image(image_file): function main (line 26) | def main(args): FILE: llavamod/serve/utils.py function load_image (line 7) | def load_image(image_file): FILE: llavamod/train/align_train.py function rank0_print (line 15) | def rank0_print(*args): function create_model_tokenizer (line 20) | def create_model_tokenizer( function train (line 515) | def train(): FILE: llavamod/train/align_trainer.py function rank0_print (line 43) | def rank0_print(*args): function maybe_zero_3 (line 48) | def maybe_zero_3(param, ignore_status=False, name=None): function get_mm_adapter_state_maybe_zero_3 (line 62) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function split_to_even_chunks (line 68) | def split_to_even_chunks(indices, lengths, num_chunks): function get_modality_length_grouped_indices (line 90) | def get_modality_length_grouped_indices(lengths, batch_size, world_size,... function get_length_grouped_indices (line 119) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 130) | class LengthGroupedSampler(Sampler): method __init__ (line 136) | def __init__( method __len__ (line 153) | def __len__(self): method __iter__ (line 156) | def __iter__(self): function unwrap_model (line 166) | def unwrap_model(model: nn.Module) -> nn.Module: class AlignTrainer (line 180) | class AlignTrainer(Trainer): method __init__ (line 217) | def __init__( method _get_train_sampler (line 311) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method create_optimizer (line 326) | def create_optimizer(self): method _prepare_deepspeed (line 436) | def _prepare_deepspeed(self, model): method get_p (line 455) | def get_p(self, model, inputs): method get_logp (line 479) | def get_logp(self, model, inputs): method compute_align_loss (line 503) | def compute_align_loss(self, policy_logprobs, reference_probs, labels): method compute_loss (line 530) | def compute_loss( method store_metrics (line 596) | def store_metrics(self, metrics: Dict[str, float], train_eval: Literal... method log (line 600) | def log(self, logs: Dict[str, float]) -> None: method _save_checkpoint (line 616) | def _save_checkpoint(self, model, trial, metrics=None): method _save (line 638) | def _save(self, output_dir: Optional[str] = None, state_dict=None): FILE: llavamod/train/dpo_train.py function rank0_print (line 15) | def rank0_print(*args): function create_model_tokenizer (line 20) | def create_model_tokenizer( function train (line 471) | def train(): FILE: llavamod/train/dpo_trainer.py function rank0_print (line 43) | def rank0_print(*args): function maybe_zero_3 (line 48) | def maybe_zero_3(param, ignore_status=False, name=None): function get_mm_adapter_state_maybe_zero_3 (line 62) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function split_to_even_chunks (line 68) | def split_to_even_chunks(indices, lengths, num_chunks): function get_modality_length_grouped_indices (line 90) | def get_modality_length_grouped_indices(lengths, batch_size, world_size,... function get_length_grouped_indices (line 119) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 130) | class LengthGroupedSampler(Sampler): method __init__ (line 136) | def __init__( method __len__ (line 153) | def __len__(self): method __iter__ (line 156) | def __iter__(self): function unwrap_model (line 166) | def unwrap_model(model: nn.Module) -> nn.Module: class DPOTrainer (line 180) | class DPOTrainer(Trainer): method __init__ (line 217) | def __init__( method _get_train_sampler (line 318) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method create_optimizer (line 333) | def create_optimizer(self): method _prepare_deepspeed (line 443) | def _prepare_deepspeed(self, model): method get_logp (line 462) | def get_logp(self, model, inputs, average_log_prob: bool = False): method dpo_loss (line 497) | def dpo_loss( method compute_loss (line 564) | def compute_loss( method store_metrics (line 643) | def store_metrics(self, metrics: Dict[str, float], train_eval: Literal... method log (line 647) | def log(self, logs: Dict[str, float]) -> None: method _save_checkpoint (line 663) | def _save_checkpoint(self, model, trial, metrics=None): method _save (line 685) | def _save(self, output_dir: Optional[str] = None, state_dict=None): FILE: llavamod/train/llava_trainer.py function maybe_zero_3 (line 20) | def maybe_zero_3(param, ignore_status=False, name=None): function get_mm_adapter_state_maybe_zero_3 (line 34) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function split_to_even_chunks (line 40) | def split_to_even_chunks(indices, lengths, num_chunks): function get_modality_length_grouped_indices (line 62) | def get_modality_length_grouped_indices(lengths, batch_size, world_size,... function get_length_grouped_indices (line 90) | def get_length_grouped_indices(lengths, batch_size, world_size, generato... class LengthGroupedSampler (line 101) | class LengthGroupedSampler(Sampler): method __init__ (line 107) | def __init__( method __len__ (line 124) | def __len__(self): method __iter__ (line 127) | def __iter__(self): class LLaVATrainer (line 135) | class LLaVATrainer(Trainer): method _get_train_sampler (line 137) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method create_optimizer (line 152) | def create_optimizer(self): method _save_checkpoint (line 256) | def _save_checkpoint(self, model, trial, metrics=None): method _save (line 277) | def _save(self, output_dir: Optional[str] = None, state_dict=None): FILE: llavamod/train/train.py function rank0_print (line 14) | def rank0_print(*args): function train (line 19) | def train(): FILE: llavamod/train/train_utils.py function maybe_zero_3 (line 10) | def maybe_zero_3(param, ignore_status=False, name=None): function get_peft_state_maybe_zero_3 (line 25) | def get_peft_state_maybe_zero_3(named_params, bias): function get_peft_state_non_lora_maybe_zero_3 (line 50) | def get_peft_state_non_lora_maybe_zero_3(named_params, require_grad_only... function get_mm_adapter_state_maybe_zero_3 (line 58) | def get_mm_adapter_state_maybe_zero_3(named_params, keys_to_match): function find_all_linear_names (line 64) | def find_all_linear_names(model, add_keywords=None): function safe_save_model_for_hf_trainer (line 81) | def safe_save_model_for_hf_trainer(trainer: transformers.Trainer, function is_accelerate_greater_20_0 (line 127) | def is_accelerate_greater_20_0() -> bool: function is_peft_available (line 139) | def is_peft_available() -> bool: function is_npu_available (line 143) | def is_npu_available() -> bool: function is_xpu_available (line 154) | def is_xpu_available() -> bool: function is_transformers_greater_than (line 170) | def is_transformers_greater_than(current_version: str) -> bool: function is_wandb_available (line 182) | def is_wandb_available() -> bool: FILE: llavamod/utils.py function order_pick_k (line 17) | def order_pick_k(lst, k): class HookTool (line 32) | class HookTool: method __init__ (line 33) | def __init__(self): method hook_fun (line 35) | def hook_fun(self, module, fea_in, fea_out): function get_gating_logit_by_hook (line 38) | def get_gating_logit_by_hook(model): function build_logger (line 50) | def build_logger(logger_name, logger_filename): class StreamToLogger (line 93) | class StreamToLogger(object): method __init__ (line 97) | def __init__(self, logger, log_level=logging.INFO): method __getattr__ (line 103) | def __getattr__(self, attr): method write (line 106) | def write(self, buf): method flush (line 120) | def flush(self): function disable_torch_init (line 126) | def disable_torch_init(): function violates_moderation (line 135) | def violates_moderation(text): function pretty_print_semaphore (line 156) | def pretty_print_semaphore(semaphore): FILE: scripts/activated_params.py function num_param (line 1) | def num_param(vocab_size, hidden_size, num_hidden_layers, intermediate_s... FILE: scripts/convert_mmbench_for_submission.py function get_args (line 6) | def get_args(): FILE: 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: 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: 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: scripts/convert_vizwiz_for_submission.py function parse_args (line 8) | def parse_args(): FILE: scripts/convert_vqav2_for_submission.py function parse_args (line 8) | def parse_args(): FILE: scripts/extract_mm_projector.py function parse_args (line 14) | def parse_args(): FILE: scripts/merge_lora_weights.py function merge_lora (line 6) | def merge_lora(args): FILE: scripts/merge_moe_lora_weights.py function _replace_module (line 13) | def _replace_module(parent_module, child_name, new_module, old_module): function _unload_and_optionally_merge (line 31) | def _unload_and_optionally_merge(model, merge=True): function merge_lora (line 70) | def merge_lora(args):