SYMBOL INDEX (860 symbols across 61 files) FILE: envs/peft/examples/causal_language_modeling/peft_lora_clm_accelerate_ds_zero3_offload.py function levenshtein_distance (line 24) | def levenshtein_distance(str1, str2): function get_closest_label (line 45) | def get_closest_label(eval_pred, classes): function b2mb (line 57) | def b2mb(x): class TorchTracemalloc (line 62) | class TorchTracemalloc: method __enter__ (line 63) | def __enter__(self): method cpu_mem_used (line 77) | def cpu_mem_used(self): method peak_monitor_func (line 81) | def peak_monitor_func(self): method __exit__ (line 93) | def __exit__(self, *exc): function main (line 109) | def main(): FILE: envs/peft/examples/conditional_generation/peft_adalora_seq2seq.py function preprocess_function (line 65) | def preprocess_function(examples): FILE: envs/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_ds_zero3_offload.py function levenshtein_distance (line 18) | def levenshtein_distance(str1, str2): function get_closest_label (line 39) | def get_closest_label(eval_pred, classes): function b2mb (line 51) | def b2mb(x): class TorchTracemalloc (line 56) | class TorchTracemalloc: method __enter__ (line 57) | def __enter__(self): method cpu_mem_used (line 71) | def cpu_mem_used(self): method peak_monitor_func (line 75) | def peak_monitor_func(self): method __exit__ (line 87) | def __exit__(self, *exc): function main (line 103) | def main(): FILE: envs/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_fsdp.py function main (line 14) | def main(): FILE: envs/peft/examples/feature_extraction/peft_lora_embedding_semantic_search.py function parse_args (line 44) | def parse_args(): function save_model_hook (line 156) | def save_model_hook(models, weights, output_dir): function load_model_hook (line 163) | def load_model_hook(models, input_dir): class AutoModelForSentenceEmbedding (line 171) | class AutoModelForSentenceEmbedding(nn.Module): method __init__ (line 172) | def __init__(self, model_name, tokenizer, normalize=True): method forward (line 179) | def forward(self, **kwargs): method mean_pooling (line 187) | def mean_pooling(self, model_output, attention_mask): method __getattr__ (line 192) | def __getattr__(self, name: str): function get_cosing_embeddings (line 200) | def get_cosing_embeddings(query_embs, product_embs): function get_loss (line 204) | def get_loss(cosine_score, labels): function main (line 208) | def main(): FILE: envs/peft/examples/fp4_finetuning/finetune_fp4_opt_bnb_peft.py class CastOutputToFloat (line 79) | class CastOutputToFloat(nn.Sequential): method forward (line 80) | def forward(self, x): function print_trainable_parameters (line 92) | def print_trainable_parameters(model): FILE: envs/peft/examples/int8_training/fine_tune_blip2_int8.py class ImageCaptioningDataset (line 43) | class ImageCaptioningDataset(Dataset): method __init__ (line 44) | def __init__(self, dataset, processor): method __len__ (line 48) | def __len__(self): method __getitem__ (line 51) | def __getitem__(self, idx): function collator (line 60) | def collator(batch): FILE: envs/peft/examples/int8_training/peft_adalora_whisper_large_training.py function parse_args (line 49) | def parse_args(): function load_streaming_dataset (line 280) | def load_streaming_dataset(dataset_name, dataset_config_name, split, **k... function prepare_dataset_wrapper (line 296) | def prepare_dataset_wrapper(do_lower_case, do_remove_punctuation, proces... function save_model_hook (line 322) | def save_model_hook(models, weights, output_dir): function load_model_hook (line 329) | def load_model_hook(models, input_dir): class DataCollatorSpeechSeq2SeqWithPadding (line 337) | class DataCollatorSpeechSeq2SeqWithPadding: method __call__ (line 340) | def __call__(self, features: List[Dict[str, Union[List[int], torch.Ten... function get_audio_length_processor (line 364) | def get_audio_length_processor(max_input_length): function evaluation_loop (line 371) | def evaluation_loop(model, eval_dataloader, processor, normalizer, metri... function main (line 422) | def main(): FILE: envs/peft/examples/lora_dreambooth/convert_kohya_ss_sd_lora_to_peft.py function get_modules_names (line 24) | def get_modules_names( function get_rank_alpha (line 53) | def get_rank_alpha( FILE: envs/peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py function get_module_kohya_state_dict (line 20) | def get_module_kohya_state_dict( FILE: envs/peft/examples/lora_dreambooth/train_dreambooth.py function import_model_class_from_model_name_or_path (line 53) | def import_model_class_from_model_name_or_path(pretrained_model_name_or_... function parse_args (line 73) | def parse_args(input_args=None): function b2mb (line 395) | def b2mb(x): class TorchTracemalloc (line 400) | class TorchTracemalloc: method __enter__ (line 401) | def __enter__(self): method cpu_mem_used (line 415) | def cpu_mem_used(self): method peak_monitor_func (line 419) | def peak_monitor_func(self): method __exit__ (line 431) | def __exit__(self, *exc): class DreamBoothDataset (line 447) | class DreamBoothDataset(Dataset): method __init__ (line 453) | def __init__( method __len__ (line 495) | def __len__(self): method __getitem__ (line 498) | def __getitem__(self, index): function collate_fn (line 528) | def collate_fn(examples, with_prior_preservation=False): class PromptDataset (line 550) | class PromptDataset(Dataset): method __init__ (line 553) | def __init__(self, prompt, num_samples): method __len__ (line 557) | def __len__(self): method __getitem__ (line 560) | def __getitem__(self, index): function get_full_repo_name (line 567) | def get_full_repo_name(model_id: str, organization: Optional[str] = None... function main (line 577) | def main(args): FILE: envs/peft/examples/sequence_classification/peft_no_lora_accelerate.py function parse_args (line 21) | def parse_args(): function main (line 79) | def main(): FILE: envs/peft/scripts/stale.py function main (line 35) | def main(): FILE: envs/peft/src/peft/auto.py class _BaseAutoPeftModel (line 43) | class _BaseAutoPeftModel: method __init__ (line 47) | def __init__(self, *args, **kwargs): method from_pretrained (line 56) | def from_pretrained( class AutoPeftModel (line 113) | class AutoPeftModel(_BaseAutoPeftModel): class AutoPeftModelForCausalLM (line 118) | class AutoPeftModelForCausalLM(_BaseAutoPeftModel): class AutoPeftModelForSeq2SeqLM (line 123) | class AutoPeftModelForSeq2SeqLM(_BaseAutoPeftModel): class AutoPeftModelForSequenceClassification (line 128) | class AutoPeftModelForSequenceClassification(_BaseAutoPeftModel): class AutoPeftModelForTokenClassification (line 133) | class AutoPeftModelForTokenClassification(_BaseAutoPeftModel): class AutoPeftModelForQuestionAnswering (line 138) | class AutoPeftModelForQuestionAnswering(_BaseAutoPeftModel): class AutoPeftModelForFeatureExtraction (line 143) | class AutoPeftModelForFeatureExtraction(_BaseAutoPeftModel): FILE: envs/peft/src/peft/import_utils.py function is_bnb_available (line 18) | def is_bnb_available(): function is_bnb_4bit_available (line 22) | def is_bnb_4bit_available(): FILE: envs/peft/src/peft/mapping.py function get_peft_config (line 67) | def get_peft_config(config_dict: Dict[str, Any]): function get_peft_model (line 78) | def get_peft_model(model: PreTrainedModel, peft_config: PeftConfig, adap... FILE: envs/peft/src/peft/peft_model.py class PeftModel (line 78) | class PeftModel(PushToHubMixin, torch.nn.Module): method __init__ (line 102) | def __init__(self, model: PreTrainedModel, peft_config: PeftConfig, ad... method save_pretrained (line 122) | def save_pretrained( method from_pretrained (line 205) | def from_pretrained( method _setup_prompt_encoder (line 274) | def _setup_prompt_encoder(self, adapter_name: str): method _prepare_model_for_gradient_checkpointing (line 314) | def _prepare_model_for_gradient_checkpointing(self, model: PreTrainedM... method get_prompt_embedding_to_save (line 329) | def get_prompt_embedding_to_save(self, adapter_name: str): method get_prompt (line 343) | def get_prompt(self, batch_size: int): method print_trainable_parameters (line 386) | def print_trainable_parameters(self): method __getattr__ (line 405) | def __getattr__(self, name: str): method forward (line 412) | def forward(self, *args: Any, **kwargs: Any): method _get_base_model_class (line 418) | def _get_base_model_class(self, is_prompt_tuning=False): method disable_adapter (line 427) | def disable_adapter(self): method get_base_model (line 449) | def get_base_model(self): method add_adapter (line 455) | def add_adapter(self, adapter_name: str, peft_config: PeftConfig): method set_additional_trainable_modules (line 475) | def set_additional_trainable_modules(self, peft_config, adapter_name): method _split_kwargs (line 484) | def _split_kwargs(cls, kwargs: Dict[str, Any]): method load_adapter (line 497) | def load_adapter(self, model_id: str, adapter_name: str, is_trainable:... method set_adapter (line 607) | def set_adapter(self, adapter_name: str): method base_model_torch_dtype (line 619) | def base_model_torch_dtype(self): method active_peft_config (line 623) | def active_peft_config(self): method create_or_update_model_card (line 626) | def create_or_update_model_card(self, output_dir: str): class PeftModelForSequenceClassification (line 667) | class PeftModelForSequenceClassification(PeftModel): method __init__ (line 707) | def __init__(self, model, peft_config: PeftConfig, adapter_name="defau... method forward (line 722) | def forward( method _prefix_tuning_forward (line 783) | def _prefix_tuning_forward( class PeftModelForCausalLM (line 855) | class PeftModelForCausalLM(PeftModel): method __init__ (line 892) | def __init__(self, model, peft_config: PeftConfig, adapter_name="defau... method forward (line 896) | def forward( method generate (line 970) | def generate(self, **kwargs): method prepare_inputs_for_generation (line 985) | def prepare_inputs_for_generation(self, *args, **kwargs): class PeftModelForSeq2SeqLM (line 1021) | class PeftModelForSeq2SeqLM(PeftModel): method __init__ (line 1057) | def __init__(self, model, peft_config: PeftConfig, adapter_name="defau... method forward (line 1064) | def forward( method generate (line 1184) | def generate(self, **kwargs): method prepare_inputs_for_generation (line 1249) | def prepare_inputs_for_generation(self, *args, **kwargs): class PeftModelForTokenClassification (line 1260) | class PeftModelForTokenClassification(PeftModel): method __init__ (line 1300) | def __init__(self, model, peft_config: PeftConfig = None, adapter_name... method forward (line 1315) | def forward( method _prefix_tuning_forward (line 1377) | def _prefix_tuning_forward( class PeftModelForQuestionAnswering (line 1432) | class PeftModelForQuestionAnswering(PeftModel): method __init__ (line 1470) | def __init__(self, model, peft_config: PeftConfig = None, adapter_name... method forward (line 1485) | def forward( method _prefix_tuning_forward (line 1552) | def _prefix_tuning_forward( class PeftModelForFeatureExtraction (line 1624) | class PeftModelForFeatureExtraction(PeftModel): method __init__ (line 1659) | def __init__(self, model, peft_config: PeftConfig = None, adapter_name... method forward (line 1662) | def forward( FILE: envs/peft/src/peft/tuners/adalora.py class AdaLoraConfig (line 32) | class AdaLoraConfig(LoraConfig): method __post_init__ (line 60) | def __post_init__(self): class AdaLoraModel (line 64) | class AdaLoraModel(LoraModel): method __init__ (line 90) | def __init__(self, model, config, adapter_name): method add_adapter (line 96) | def add_adapter(self, adapter_name, config=None): method _find_and_replace (line 124) | def _find_and_replace(self, adapter_name): method __getattr__ (line 219) | def __getattr__(self, name: str): method forward (line 226) | def forward(self, *args, **kwargs): method resize_modules_by_rank_pattern (line 250) | def resize_modules_by_rank_pattern(self, rank_pattern, adapter_name): method resize_state_dict_by_rank_pattern (line 281) | def resize_state_dict_by_rank_pattern(self, rank_pattern, state_dict, ... method update_and_allocate (line 297) | def update_and_allocate(self, global_step): method _prepare_adalora_config (line 320) | def _prepare_adalora_config(peft_config, model_config): class AdaLoraLayer (line 330) | class AdaLoraLayer(LoraLayer): method __init__ (line 331) | def __init__( method update_layer (line 342) | def update_layer(self, adapter_name, r, lora_alpha, lora_dropout, init... method reset_lora_parameters (line 369) | def reset_lora_parameters(self, adapter_name): class SVDLinear (line 376) | class SVDLinear(nn.Linear, AdaLoraLayer): method __init__ (line 378) | def __init__( method merge (line 403) | def merge(self): method unmerge (line 421) | def unmerge(self): method forward (line 438) | def forward(self, x: torch.Tensor): class SVDLinear8bitLt (line 463) | class SVDLinear8bitLt(bnb.nn.Linear8bitLt, AdaLoraLayer): method __init__ (line 465) | def __init__( method forward (line 493) | def forward(self, x: torch.Tensor): class SVDLinear4bit (line 529) | class SVDLinear4bit(bnb.nn.Linear4bit, AdaLoraLayer): method __init__ (line 531) | def __init__( method forward (line 558) | def forward(self, x: torch.Tensor): class RankAllocator (line 592) | class RankAllocator(object): method __init__ (line 602) | def __init__(self, model, peft_config, adapter_name): method set_total_step (line 613) | def set_total_step(self, total_step): method reset_ipt (line 616) | def reset_ipt(self): method _set_budget_scheduler (line 621) | def _set_budget_scheduler(self, model): method budget_schedule (line 632) | def budget_schedule(self, step: int): method update_ipt (line 651) | def update_ipt(self, model): method _element_score (line 668) | def _element_score(self, n): method _combine_ipt (line 671) | def _combine_ipt(self, ipt_E, ipt_AB): method mask_to_budget (line 676) | def mask_to_budget(self, model, budget): method update_and_allocate (line 728) | def update_and_allocate(self, model, global_step, force_mask=False): method mask_using_rank_pattern (line 740) | def mask_using_rank_pattern(self, model, rank_pattern): FILE: envs/peft/src/peft/tuners/adaption_prompt.py function llama_rotate_half (line 29) | def llama_rotate_half(x: torch.Tensor) -> torch.Tensor: function llama_apply_rotary_pos_emb (line 44) | def llama_apply_rotary_pos_emb(q, cos, sin, position_ids): function llama_compute_query_states (line 61) | def llama_compute_query_states(model: nn.Module, **kwargs) -> torch.Tensor: function is_adaption_prompt_trainable (line 99) | def is_adaption_prompt_trainable(params: str) -> bool: class AdaptionPromptConfig (line 105) | class AdaptionPromptConfig(PeftConfig): method __post_init__ (line 114) | def __post_init__(self): function prepare_config (line 118) | def prepare_config( class AdaptionPromptModel (line 134) | class AdaptionPromptModel(nn.Module): method __init__ (line 151) | def __init__(self, model, configs: Dict, adapter_name: str): method add_adapter (line 169) | def add_adapter(self, adapter_name: str, config: AdaptionPromptConfig)... method set_adapter (line 205) | def set_adapter(self, adapter_name: str) -> None: method enable_adapter_layers (line 218) | def enable_adapter_layers(self): method disable_adapter_layers (line 223) | def disable_adapter_layers(self): method _create_adapted_attentions (line 228) | def _create_adapted_attentions(self, config: AdaptionPromptConfig, par... method _set_adapted_attentions (line 238) | def _set_adapted_attentions(self, adapter_name: str) -> None: method _remove_adapted_attentions (line 246) | def _remove_adapted_attentions(self, adapter_name: str) -> None: method _mark_only_adaption_prompts_as_trainable (line 256) | def _mark_only_adaption_prompts_as_trainable(self) -> None: method __getattr__ (line 262) | def __getattr__(self, name: str): class AdaptedAttention (line 272) | class AdaptedAttention(nn.Module): method __init__ (line 275) | def __init__(self, model_type: str, adapter_len: int, model): method forward (line 305) | def forward(self, **kwargs): FILE: envs/peft/src/peft/tuners/ia3.py class IA3Config (line 44) | class IA3Config(PeftConfig): method __post_init__ (line 90) | def __post_init__(self): class IA3Model (line 94) | class IA3Model(torch.nn.Module): method __init__ (line 128) | def __init__(self, model, config, adapter_name): method add_adapter (line 135) | def add_adapter(self, adapter_name, config=None): method _check_quantization_dependency (line 146) | def _check_quantization_dependency(self): method _create_new_module (line 159) | def _create_new_module(self, ia3_config, adapter_name, target, is_feed... method _check_target_module_exists (line 216) | def _check_target_module_exists(self, ia3_config, key): method _find_and_replace (line 225) | def _find_and_replace(self, adapter_name): method _is_valid_match (line 261) | def _is_valid_match(key: str, target_key: str): method _replace_module (line 272) | def _replace_module(self, parent_module, child_name, new_module, old_m... method __getattr__ (line 286) | def __getattr__(self, name: str): method get_peft_config_as_dict (line 293) | def get_peft_config_as_dict(self, inference: bool = False): method _set_adapter_layers (line 302) | def _set_adapter_layers(self, enabled=True): method enable_adapter_layers (line 307) | def enable_adapter_layers(self): method disable_adapter_layers (line 310) | def disable_adapter_layers(self): method set_adapter (line 313) | def set_adapter(self, adapter_name): method _prepare_ia3_config (line 322) | def _prepare_ia3_config(peft_config, model_config): method merge_and_unload (line 335) | def merge_and_unload(self): function mark_only_ia3_as_trainable (line 375) | def mark_only_ia3_as_trainable(model: nn.Module) -> None: class IA3Layer (line 381) | class IA3Layer: method __init__ (line 382) | def __init__( method update_layer (line 397) | def update_layer(self, adapter_name, init_ia3_weights): method reset_ia3_parameters (line 408) | def reset_ia3_parameters(self, adapter_name): class Linear (line 414) | class Linear(nn.Linear, IA3Layer): method __init__ (line 416) | def __init__( method merge (line 442) | def merge(self): method unmerge (line 455) | def unmerge(self): method forward (line 470) | def forward(self, x: torch.Tensor): class Linear8bitLt (line 502) | class Linear8bitLt(bnb.nn.Linear8bitLt, IA3Layer): method __init__ (line 504) | def __init__( method forward (line 532) | def forward(self, x: torch.Tensor): FILE: envs/peft/src/peft/tuners/lora.py class LoraConfig (line 46) | class LoraConfig(PeftConfig): method __post_init__ (line 114) | def __post_init__(self): class LoraModel (line 118) | class LoraModel(torch.nn.Module): method __init__ (line 175) | def __init__(self, model, config, adapter_name): method add_adapter (line 186) | def add_adapter(self, adapter_name, config=None): method _check_quantization_dependency (line 203) | def _check_quantization_dependency(self): method _check_target_module_exists (line 212) | def _check_target_module_exists(self, lora_config, key): method _create_new_module (line 238) | def _create_new_module(self, lora_config, adapter_name, target): method _find_and_replace (line 313) | def _find_and_replace(self, adapter_name): method _replace_module (line 361) | def _replace_module(self, parent_module, child_name, new_module, old_m... method __getattr__ (line 379) | def __getattr__(self, name: str): method get_peft_config_as_dict (line 386) | def get_peft_config_as_dict(self, inference: bool = False): method _set_adapter_layers (line 395) | def _set_adapter_layers(self, enabled=True): method enable_adapter_layers (line 400) | def enable_adapter_layers(self): method disable_adapter_layers (line 403) | def disable_adapter_layers(self): method set_adapter (line 406) | def set_adapter(self, adapter_name): method merge_adapter (line 414) | def merge_adapter(self): method unmerge_adapter (line 422) | def unmerge_adapter(self): method _prepare_lora_config (line 431) | def _prepare_lora_config(peft_config, model_config): method _unload_and_optionally_merge (line 438) | def _unload_and_optionally_merge(self, merge=True): method add_weighted_adapter (line 476) | def add_weighted_adapter(self, adapters, weights, adapter_name, combin... method _svd_weighted_adapter (line 538) | def _svd_weighted_adapter(self, adapters, weights, new_rank, target, t... method delete_adapter (line 568) | def delete_adapter(self, adapter_name): method merge_and_unload (line 601) | def merge_and_unload(self): method unload (line 620) | def unload(self): function mark_only_lora_as_trainable (line 639) | def mark_only_lora_as_trainable(model: nn.Module, bias: str = "none") ->... class LoraLayer (line 657) | class LoraLayer: method __init__ (line 658) | def __init__(self, in_features: int, out_features: int, **kwargs): method update_layer (line 675) | def update_layer(self, adapter_name, r, lora_alpha, lora_dropout, init... method update_layer_conv2d (line 693) | def update_layer_conv2d(self, adapter_name, r, lora_alpha, lora_dropou... method update_layer_embedding (line 718) | def update_layer_embedding(self, adapter_name, r, lora_alpha, lora_dro... method reset_lora_parameters (line 738) | def reset_lora_parameters(self, adapter_name): class Linear (line 749) | class Linear(nn.Linear, LoraLayer): method __init__ (line 751) | def __init__( method merge (line 779) | def merge(self): method unmerge (line 789) | def unmerge(self): method get_delta_weight (line 799) | def get_delta_weight(self, adapter): method forward (line 808) | def forward(self, x: torch.Tensor): class Embedding (line 835) | class Embedding(nn.Embedding, LoraLayer): method __init__ (line 837) | def __init__( method unmerge (line 858) | def unmerge(self): method merge (line 866) | def merge(self): method get_delta_weight (line 874) | def get_delta_weight(self, adapter): method forward (line 877) | def forward(self, x: torch.Tensor): class Conv2d (line 901) | class Conv2d(nn.Conv2d, LoraLayer): method __init__ (line 903) | def __init__( method merge (line 934) | def merge(self): method unmerge (line 944) | def unmerge(self): method get_delta_weight (line 954) | def get_delta_weight(self, adapter): method forward (line 971) | def forward(self, x: torch.Tensor): class Linear8bitLt (line 1033) | class Linear8bitLt(bnb.nn.Linear8bitLt, LoraLayer): method __init__ (line 1035) | def __init__( method forward (line 1063) | def forward(self, x: torch.Tensor): class Linear4bit (line 1092) | class Linear4bit(bnb.nn.Linear4bit, LoraLayer): method __init__ (line 1094) | def __init__( method forward (line 1122) | def forward(self, x: torch.Tensor): FILE: envs/peft/src/peft/tuners/p_tuning.py class PromptEncoderReparameterizationType (line 26) | class PromptEncoderReparameterizationType(str, enum.Enum): class PromptEncoderConfig (line 32) | class PromptEncoderConfig(PromptLearningConfig): method __post_init__ (line 61) | def __post_init__(self): class PromptEncoder (line 67) | class PromptEncoder(torch.nn.Module): method __init__ (line 114) | def __init__(self, config): method forward (line 161) | def forward(self, indices): FILE: envs/peft/src/peft/tuners/prefix_tuning.py class PrefixTuningConfig (line 25) | class PrefixTuningConfig(PromptLearningConfig): method __post_init__ (line 43) | def __post_init__(self): class PrefixEncoder (line 49) | class PrefixEncoder(torch.nn.Module): method __init__ (line 85) | def __init__(self, config): method forward (line 103) | def forward(self, prefix: torch.Tensor): FILE: envs/peft/src/peft/tuners/prompt_tuning.py class PromptTuningInit (line 26) | class PromptTuningInit(str, enum.Enum): class PromptTuningConfig (line 32) | class PromptTuningConfig(PromptLearningConfig): method __post_init__ (line 61) | def __post_init__(self): class PromptEmbedding (line 65) | class PromptEmbedding(torch.nn.Module): method __init__ (line 103) | def __init__(self, config, word_embeddings): method forward (line 127) | def forward(self, indices): FILE: envs/peft/src/peft/utils/config.py class PeftType (line 28) | class PeftType(str, enum.Enum): class TaskType (line 38) | class TaskType(str, enum.Enum): class PeftConfigMixin (line 48) | class PeftConfigMixin(PushToHubMixin): method to_dict (line 63) | def to_dict(self): method save_pretrained (line 66) | def save_pretrained(self, save_directory, **kwargs): method from_pretrained (line 95) | def from_pretrained(cls, pretrained_model_name_or_path, subfolder=None... method from_json_file (line 134) | def from_json_file(cls, path_json_file, **kwargs): method _split_kwargs (line 148) | def _split_kwargs(cls, kwargs): method _get_peft_type (line 164) | def _get_peft_type( class PeftConfig (line 190) | class PeftConfig(PeftConfigMixin): class PromptLearningConfig (line 208) | class PromptLearningConfig(PeftConfig): FILE: envs/peft/src/peft/utils/hub_utils.py function hub_file_exists (line 20) | def hub_file_exists(repo_id: str, filename: str, revision: str = None, r... FILE: envs/peft/src/peft/utils/other.py function add_library_to_model_card (line 37) | def add_library_to_model_card(output_dir): function bloom_model_postprocess_past_key_value (line 62) | def bloom_model_postprocess_past_key_value(past_key_values): function prepare_model_for_kbit_training (line 75) | def prepare_model_for_kbit_training(model, use_gradient_checkpointing=Tr... function prepare_model_for_int8_training (line 114) | def prepare_model_for_int8_training(*args, **kwargs): function shift_tokens_right (line 123) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class ModulesToSaveWrapper (line 144) | class ModulesToSaveWrapper(torch.nn.Module): method __init__ (line 145) | def __init__(self, module_to_save, adapter_name): method update (line 152) | def update(self, adapter_name): method forward (line 188) | def forward(self, *args, **kwargs): function _get_submodules (line 194) | def _get_submodules(model, key): function _freeze_adapter (line 201) | def _freeze_adapter(model, adapter_name): function _set_trainable (line 207) | def _set_trainable(model, adapter_name): function _set_adapter (line 221) | def _set_adapter(model, adapter_name): function _prepare_prompt_learning_config (line 227) | def _prepare_prompt_learning_config(peft_config, model_config): function fsdp_auto_wrap_policy (line 269) | def fsdp_auto_wrap_policy(model): function transpose (line 304) | def transpose(weight, fan_in_fan_out): FILE: envs/peft/src/peft/utils/save_and_load.py function get_peft_model_state_dict (line 19) | def get_peft_model_state_dict(model, state_dict=None, adapter_name="defa... function set_peft_model_state_dict (line 82) | def set_peft_model_state_dict(model, peft_model_state_dict, adapter_name... FILE: envs/peft/tests/test_adaption_prompt.py function is_llama_available (line 33) | def is_llama_available() -> bool: class AdaptionPromptTester (line 47) | class AdaptionPromptTester(TestCase, PeftCommonTester): method setUp (line 55) | def setUp(self): method _create_test_llama_config (line 61) | def _create_test_llama_config(): method test_attributes (line 72) | def test_attributes(self) -> None: method test_prepare_for_training (line 81) | def test_prepare_for_training(self) -> None: method test_prepare_for_int8_training (line 92) | def test_prepare_for_int8_training(self) -> None: method test_save_pretrained (line 118) | def test_save_pretrained(self) -> None: method test_save_pretrained_selected_adapters (line 163) | def test_save_pretrained_selected_adapters(self) -> None: method test_generate (line 213) | def test_generate(self) -> None: method test_sequence_adapter_ops (line 229) | def test_sequence_adapter_ops(self) -> None: method test_add_and_set_while_disabled (line 298) | def test_add_and_set_while_disabled(self): method test_use_cache (line 343) | def test_use_cache(self) -> None: method test_bf16_inference (line 367) | def test_bf16_inference(self) -> None: method test_disable_adapter (line 380) | def test_disable_adapter(self): FILE: envs/peft/tests/test_auto.py class PeftAutoModelTester (line 38) | class PeftAutoModelTester(unittest.TestCase): method test_peft_causal_lm (line 39) | def test_peft_causal_lm(self): method test_peft_seq2seq_lm (line 60) | def test_peft_seq2seq_lm(self): method test_peft_sequence_cls (line 81) | def test_peft_sequence_cls(self): method test_peft_token_classification (line 104) | def test_peft_token_classification(self): method test_peft_question_answering (line 127) | def test_peft_question_answering(self): method test_peft_feature_extraction (line 150) | def test_peft_feature_extraction(self): method test_peft_whisper (line 173) | def test_peft_whisper(self): FILE: envs/peft/tests/test_common_gpu.py class PeftGPUCommonTests (line 42) | class PeftGPUCommonTests(unittest.TestCase): method setUp (line 47) | def setUp(self): method tearDown (line 53) | def tearDown(self): method test_lora_bnb_8bit_quantization (line 65) | def test_lora_bnb_8bit_quantization(self): method test_lora_bnb_4bit_quantization_from_pretrained_safetensors (line 116) | def test_lora_bnb_4bit_quantization_from_pretrained_safetensors(self): method test_lora_bnb_4bit_quantization (line 131) | def test_lora_bnb_4bit_quantization(self): method test_lora_causal_lm_mutli_gpu_inference (line 179) | def test_lora_causal_lm_mutli_gpu_inference(self): method test_lora_seq2seq_lm_mutli_gpu_inference (line 209) | def test_lora_seq2seq_lm_mutli_gpu_inference(self): method test_adaption_prompt_8bit (line 235) | def test_adaption_prompt_8bit(self): method test_adaption_prompt_4bit (line 258) | def test_adaption_prompt_4bit(self): FILE: envs/peft/tests/test_config.py class PeftConfigTestMixin (line 35) | class PeftConfigTestMixin: class PeftConfigTester (line 46) | class PeftConfigTester(unittest.TestCase, PeftConfigTestMixin): method test_methods (line 47) | def test_methods(self): method test_task_type (line 63) | def test_task_type(self): method test_from_pretrained (line 68) | def test_from_pretrained(self): method test_save_pretrained (line 78) | def test_save_pretrained(self): method test_from_json_file (line 91) | def test_from_json_file(self): method test_to_dict (line 100) | def test_to_dict(self): method test_from_pretrained_cache_dir (line 109) | def test_from_pretrained_cache_dir(self): method test_from_pretrained_cache_dir_remote (line 119) | def test_from_pretrained_cache_dir_remote(self): method test_set_attributes (line 127) | def test_set_attributes(self): method test_config_copy (line 139) | def test_config_copy(self): method test_config_deepcopy (line 146) | def test_config_deepcopy(self): method test_config_pickle_roundtrip (line 153) | def test_config_pickle_roundtrip(self): FILE: envs/peft/tests/test_custom_models.py class MLP (line 46) | class MLP(nn.Module): method __init__ (line 47) | def __init__(self): method forward (line 55) | def forward(self, X): class ModelEmbConv1D (line 65) | class ModelEmbConv1D(nn.Module): method __init__ (line 66) | def __init__(self): method forward (line 74) | def forward(self, X): class ModelConv2D (line 83) | class ModelConv2D(nn.Module): method __init__ (line 84) | def __init__(self): method forward (line 91) | def forward(self, X): class MockTransformerWrapper (line 100) | class MockTransformerWrapper: method from_pretrained (line 108) | def from_pretrained(cls, model_id): class PeftCustomModelTester (line 124) | class PeftCustomModelTester(unittest.TestCase, PeftCommonTester): method prepare_inputs_for_testing (line 129) | def prepare_inputs_for_testing(self): method test_attributes_parametrized (line 134) | def test_attributes_parametrized(self, test_name, model_id, config_cls... method test_adapter_name (line 138) | def test_adapter_name(self, test_name, model_id, config_cls, config_kw... method test_prepare_for_training_parametrized (line 142) | def test_prepare_for_training_parametrized(self, test_name, model_id, ... method test_save_pretrained (line 150) | def test_save_pretrained(self, test_name, model_id, config_cls, config... method test_from_pretrained_config_construction (line 154) | def test_from_pretrained_config_construction(self, test_name, model_id... method test_merge_layers (line 158) | def test_merge_layers(self, test_name, model_id, config_cls, config_kw... method test_generate (line 169) | def test_generate(self, test_name, model_id, config_cls, config_kwargs): method test_generate_half_prec (line 174) | def test_generate_half_prec(self, test_name, model_id, config_cls, con... method test_training_customs (line 179) | def test_training_customs(self, test_name, model_id, config_cls, confi... method test_training_customs_layer_indexing (line 183) | def test_training_customs_layer_indexing(self, test_name, model_id, co... method test_training_customs_gradient_checkpointing (line 189) | def test_training_customs_gradient_checkpointing(self, test_name, mode... method test_inference_safetensors (line 193) | def test_inference_safetensors(self, test_name, model_id, config_cls, ... method test_peft_model_device_map (line 197) | def test_peft_model_device_map(self, test_name, model_id, config_cls, ... method test_only_params_are_updated (line 201) | def test_only_params_are_updated(self, test_name, model_id, config_cls... method test_disable_adapters (line 236) | def test_disable_adapters(self, test_name, model_id, config_cls, confi... FILE: envs/peft/tests/test_decoder_models.py function skip_non_pt_mqa (line 41) | def skip_non_pt_mqa(test_list): class PeftDecoderModelTester (line 48) | class PeftDecoderModelTester(unittest.TestCase, PeftCommonTester): method prepare_inputs_for_testing (line 57) | def prepare_inputs_for_testing(self): method test_attributes_parametrized (line 69) | def test_attributes_parametrized(self, test_name, model_id, config_cls... method test_adapter_name (line 73) | def test_adapter_name(self, test_name, model_id, config_cls, config_kw... method test_prepare_for_training_parametrized (line 77) | def test_prepare_for_training_parametrized(self, test_name, model_id, ... method test_save_pretrained (line 81) | def test_save_pretrained(self, test_name, model_id, config_cls, config... method test_save_pretrained_selected_adapters (line 85) | def test_save_pretrained_selected_adapters(self, test_name, model_id, ... method test_from_pretrained_config_construction (line 89) | def test_from_pretrained_config_construction(self, test_name, model_id... method test_merge_layers (line 102) | def test_merge_layers(self, test_name, model_id, config_cls, config_kw... method test_generate (line 106) | def test_generate(self, test_name, model_id, config_cls, config_kwargs): method test_generate_half_prec (line 110) | def test_generate_half_prec(self, test_name, model_id, config_cls, con... method test_prefix_tuning_half_prec_conversion (line 114) | def test_prefix_tuning_half_prec_conversion(self, test_name, model_id,... method test_training_decoders (line 118) | def test_training_decoders(self, test_name, model_id, config_cls, conf... method test_training_decoders_layer_indexing (line 122) | def test_training_decoders_layer_indexing(self, test_name, model_id, c... method test_training_decoders_gradient_checkpointing (line 126) | def test_training_decoders_gradient_checkpointing(self, test_name, mod... method test_inference_safetensors (line 130) | def test_inference_safetensors(self, test_name, model_id, config_cls, ... method test_peft_model_device_map (line 134) | def test_peft_model_device_map(self, test_name, model_id, config_cls, ... method test_delete_adapter (line 138) | def test_delete_adapter(self, test_name, model_id, config_cls, config_... method test_unload_adapter (line 150) | def test_unload_adapter(self, test_name, model_id, config_cls, config_... method test_weighted_combination_of_adapters (line 162) | def test_weighted_combination_of_adapters(self, test_name, model_id, c... method test_training_prompt_learning_tasks (line 166) | def test_training_prompt_learning_tasks(self, test_name, model_id, con... method test_disable_adapter (line 180) | def test_disable_adapter(self, test_name, model_id, config_cls, config... FILE: envs/peft/tests/test_encoder_decoder_models.py class PeftEncoderDecoderModelTester (line 32) | class PeftEncoderDecoderModelTester(unittest.TestCase, PeftCommonTester): method prepare_inputs_for_testing (line 41) | def prepare_inputs_for_testing(self): method test_attributes_parametrized (line 55) | def test_attributes_parametrized(self, test_name, model_id, config_cls... method test_adapter_name (line 59) | def test_adapter_name(self, test_name, model_id, config_cls, config_kw... method test_prepare_for_training_parametrized (line 63) | def test_prepare_for_training_parametrized(self, test_name, model_id, ... method test_save_pretrained (line 67) | def test_save_pretrained(self, test_name, model_id, config_cls, config... method test_save_pretrained_selected_adapters (line 71) | def test_save_pretrained_selected_adapters(self, test_name, model_id, ... method test_from_pretrained_config_construction (line 75) | def test_from_pretrained_config_construction(self, test_name, model_id... method test_merge_layers (line 88) | def test_merge_layers(self, test_name, model_id, config_cls, config_kw... method test_generate (line 93) | def test_generate(self, test_name, model_id, config_cls, config_kwargs): method test_generate_half_prec (line 97) | def test_generate_half_prec(self, test_name, model_id, config_cls, con... method test_prefix_tuning_half_prec_conversion (line 101) | def test_prefix_tuning_half_prec_conversion(self, test_name, model_id,... method test_training_encoder_decoders (line 105) | def test_training_encoder_decoders(self, test_name, model_id, config_c... method test_training_encoder_decoders_layer_indexing (line 109) | def test_training_encoder_decoders_layer_indexing(self, test_name, mod... method test_training_encoder_decoders_gradient_checkpointing (line 113) | def test_training_encoder_decoders_gradient_checkpointing(self, test_n... method test_inference_safetensors (line 117) | def test_inference_safetensors(self, test_name, model_id, config_cls, ... method test_peft_model_device_map (line 121) | def test_peft_model_device_map(self, test_name, model_id, config_cls, ... method test_delete_adapter (line 125) | def test_delete_adapter(self, test_name, model_id, config_cls, config_... method test_unload_adapter (line 138) | def test_unload_adapter(self, test_name, model_id, config_cls, config_... method test_weighted_combination_of_adapters (line 150) | def test_weighted_combination_of_adapters(self, test_name, model_id, c... method test_training_prompt_learning_tasks (line 154) | def test_training_prompt_learning_tasks(self, test_name, model_id, con... method test_disable_adapter (line 167) | def test_disable_adapter(self, test_name, model_id, config_cls, config... FILE: envs/peft/tests/test_feature_extraction_models.py function skip_deberta_lora_tests (line 37) | def skip_deberta_lora_tests(test_list): function skip_deberta_pt_tests (line 44) | def skip_deberta_pt_tests(test_list): class PeftFeatureExtractionModelTester (line 51) | class PeftFeatureExtractionModelTester(unittest.TestCase, PeftCommonTest... method prepare_inputs_for_testing (line 60) | def prepare_inputs_for_testing(self): method test_attributes_parametrized (line 72) | def test_attributes_parametrized(self, test_name, model_id, config_cls... method test_adapter_name (line 76) | def test_adapter_name(self, test_name, model_id, config_cls, config_kw... method test_prepare_for_training_parametrized (line 80) | def test_prepare_for_training_parametrized(self, test_name, model_id, ... method test_save_pretrained (line 84) | def test_save_pretrained(self, test_name, model_id, config_cls, config... method test_save_pretrained_selected_adapters (line 88) | def test_save_pretrained_selected_adapters(self, test_name, model_id, ... method test_from_pretrained_config_construction (line 92) | def test_from_pretrained_config_construction(self, test_name, model_id... method test_merge_layers (line 105) | def test_merge_layers(self, test_name, model_id, config_cls, config_kw... method test_training (line 109) | def test_training(self, test_name, model_id, config_cls, config_kwargs): method test_training_prompt_learning_tasks (line 115) | def test_training_prompt_learning_tasks(self, test_name, model_id, con... method test_training_layer_indexing (line 119) | def test_training_layer_indexing(self, test_name, model_id, config_cls... method test_training_gradient_checkpointing (line 125) | def test_training_gradient_checkpointing(self, test_name, model_id, co... method test_inference_safetensors (line 129) | def test_inference_safetensors(self, test_name, model_id, config_cls, ... method test_peft_model_device_map (line 133) | def test_peft_model_device_map(self, test_name, model_id, config_cls, ... method test_delete_adapter (line 137) | def test_delete_adapter(self, test_name, model_id, config_cls, config_... method test_unload_adapter (line 149) | def test_unload_adapter(self, test_name, model_id, config_cls, config_... method test_weighted_combination_of_adapters (line 161) | def test_weighted_combination_of_adapters(self, test_name, model_id, c... FILE: envs/peft/tests/test_gpu_examples.py class DataCollatorSpeechSeq2SeqWithPadding (line 56) | class DataCollatorSpeechSeq2SeqWithPadding: method __call__ (line 63) | def __call__(self, features: List[Dict[str, Union[List[int], torch.Ten... class PeftBnbGPUExampleTests (line 89) | class PeftBnbGPUExampleTests(unittest.TestCase): method setUp (line 105) | def setUp(self): method tearDown (line 110) | def tearDown(self): method test_causal_lm_training (line 120) | def test_causal_lm_training(self): method test_4bit_adalora_causalLM (line 179) | def test_4bit_adalora_causalLM(self): method test_causal_lm_training_mutli_gpu (line 240) | def test_causal_lm_training_mutli_gpu(self): method test_seq2seq_lm_training_single_gpu (line 303) | def test_seq2seq_lm_training_single_gpu(self): method test_seq2seq_lm_training_mutli_gpu (line 364) | def test_seq2seq_lm_training_mutli_gpu(self): method test_audio_model_training (line 424) | def test_audio_model_training(self): FILE: envs/peft/tests/test_stablediffusion.py class StableDiffusionModelTester (line 56) | class StableDiffusionModelTester(TestCase, PeftCommonTester): method instantiate_sd_peft (line 63) | def instantiate_sd_peft(self, model_id, config_cls, config_kwargs): method prepare_inputs_for_testing (line 88) | def prepare_inputs_for_testing(self): method test_merge_layers (line 102) | def test_merge_layers(self, test_name, model_id, config_cls, config_kw... method test_add_weighted_adapter_base_unchanged (line 130) | def test_add_weighted_adapter_base_unchanged(self, test_name, model_id... method test_disable_adapter (line 158) | def test_disable_adapter(self, test_name, model_id, config_cls, config... FILE: envs/peft/tests/testing_common.py class ClassInstantier (line 81) | class ClassInstantier(OrderedDict): method __getitem__ (line 82) | def __getitem__(self, key, *args, **kwargs): method get_grid_parameters (line 91) | def get_grid_parameters(self, grid_parameters, filter_params_func=None): class PeftCommonTester (line 145) | class PeftCommonTester: method prepare_inputs_for_common (line 158) | def prepare_inputs_for_common(self): method _test_model_attr (line 161) | def _test_model_attr(self, model_id, config_cls, config_kwargs): method _test_adapter_name (line 173) | def _test_adapter_name(self, model_id, config_cls, config_kwargs): method _test_prepare_for_training (line 188) | def _test_prepare_for_training(self, model_id, config_cls, config_kwar... method _test_save_pretrained (line 229) | def _test_save_pretrained(self, model_id, config_cls, config_kwargs): method _test_save_pretrained_selected_adapters (line 271) | def _test_save_pretrained_selected_adapters(self, model_id, config_cls... method _test_from_pretrained_config_construction (line 331) | def _test_from_pretrained_config_construction(self, model_id, config_c... method _test_merge_layers (line 348) | def _test_merge_layers(self, model_id, config_cls, config_kwargs): method _test_generate (line 395) | def _test_generate(self, model_id, config_cls, config_kwargs): method _test_generate_half_prec (line 413) | def _test_generate_half_prec(self, model_id, config_cls, config_kwargs): method _test_prefix_tuning_half_prec_conversion (line 435) | def _test_prefix_tuning_half_prec_conversion(self, model_id, config_cl... method _test_training (line 450) | def _test_training(self, model_id, config_cls, config_kwargs): method _test_inference_safetensors (line 475) | def _test_inference_safetensors(self, model_id, config_cls, config_kwa... method _test_training_layer_indexing (line 511) | def _test_training_layer_indexing(self, model_id, config_cls, config_k... method _test_training_gradient_checkpointing (line 565) | def _test_training_gradient_checkpointing(self, model_id, config_cls, ... method _test_peft_model_device_map (line 597) | def _test_peft_model_device_map(self, model_id, config_cls, config_kwa... method _test_training_prompt_learning_tasks (line 619) | def _test_training_prompt_learning_tasks(self, model_id, config_cls, c... method _test_delete_adapter (line 642) | def _test_delete_adapter(self, model_id, config_cls, config_kwargs): method _test_unload_adapter (line 676) | def _test_unload_adapter(self, model_id, config_cls, config_kwargs): method _test_weighted_combination_of_adapters (line 702) | def _test_weighted_combination_of_adapters(self, model_id, config_cls,... method _test_disable_adapter (line 767) | def _test_disable_adapter(self, model_id, config_cls, config_kwargs): FILE: envs/peft/tests/testing_utils.py function require_torch_gpu (line 22) | def require_torch_gpu(test_case): function require_torch_multi_gpu (line 32) | def require_torch_multi_gpu(test_case): function require_bitsandbytes (line 42) | def require_bitsandbytes(test_case): function temp_seed (line 55) | def temp_seed(seed: int): FILE: evaluate/demo_gradio_video_dubbing.py function resize_video (line 87) | def resize_video(video_path, output_path, max_size=448): function chat_with_multi_modal (line 114) | def chat_with_multi_modal(model: str, prompt: str, bucket_name: str, vid... function smooth_concatenate (line 155) | def smooth_concatenate(audio_tensors: List[torch.Tensor], sample_rate: i... function process_and_save_audio (line 188) | def process_and_save_audio(audio_tensors: List[torch.Tensor], function merge_audio_video (line 200) | def merge_audio_video(audio_path: str, class PrintToLog (line 219) | class PrintToLog: method write (line 220) | def write(self, message): method flush (line 224) | def flush(self): function init_audiostory (line 229) | def init_audiostory(): function video_dubbing (line 258) | def video_dubbing(video_path: str, guidance: float, step: int): function generate_video (line 363) | def generate_video(steps, guidance_scale, video_input): function clear_all (line 421) | def clear_all(): FILE: evaluate/evaluate_long_audio.py function extract_content_and_duration (line 69) | def extract_content_and_duration(text: str) -> Tuple[str, float | None]: function smooth_concatenate (line 95) | def smooth_concatenate( function process_and_save_audio (line 148) | def process_and_save_audio( function wav2fbank (line 179) | def wav2fbank(filename: str) -> torch.Tensor: function norm_fbank (line 211) | def norm_fbank(fbank: torch.Tensor) -> torch.Tensor: function prepare_one_fbank (line 216) | def prepare_one_fbank(wav_path: str, cuda_enabled: bool = True) -> Dict[... FILE: evaluate/inference.py function smooth_concatenate (line 93) | def smooth_concatenate( function process_and_prepare_concat (line 146) | def process_and_prepare_concat( function wav2fbank (line 170) | def wav2fbank(filename: str) -> torch.Tensor: function norm_fbank (line 203) | def norm_fbank(fbank: torch.Tensor) -> torch.Tensor: function prepare_one_fbank (line 208) | def prepare_one_fbank(wav_path: str, cuda_enabled: bool = True) -> Dict[... function extract_content_and_duration (line 226) | def extract_content_and_duration(text: str) -> Tuple[str, Optional[float]]: function parse_args (line 256) | def parse_args() -> argparse.Namespace: function main (line 301) | def main() -> None: FILE: src/models/detokenizer/modeling_flux.py class StableAudioPositionalEmbedding (line 21) | class StableAudioPositionalEmbedding(nn.Module): method __init__ (line 26) | def __init__(self, dim: int): method forward (line 32) | def forward(self, times: torch.Tensor) -> torch.Tensor: class DurationEmbedder (line 40) | class DurationEmbedder(nn.Module): method __init__ (line 58) | def __init__( method forward (line 76) | def forward( function retrieve_timesteps (line 96) | def retrieve_timesteps( class Flux_T5 (line 139) | class Flux_T5(nn.Module): method __init__ (line 141) | def __init__(self, config, text_encoder_dir=None, initialize_reference... method get_sigmas (line 189) | def get_sigmas(self, timesteps, n_dim=3, dtype=torch.float32): method encode_text_classifier_free (line 202) | def encode_text_classifier_free(self, prompt: List[str], T5_tokens_see... method encode_text (line 273) | def encode_text(self, prompt): method encode_duration (line 294) | def encode_duration(self, duration): method inference_flow (line 298) | def inference_flow( method encode_text_classifier_free_padding (line 421) | def encode_text_classifier_free_padding(self, prompt: List[str], T5_to... method inference_flow_padding (line 493) | def inference_flow_padding( method encode_text_classifier_free_full_tokens (line 616) | def encode_text_classifier_free_full_tokens(self, T5_tokens_seedx, num... method inference_flow_full_tokens (line 669) | def inference_flow_full_tokens( method forward (line 789) | def forward(self, latents, t5_tokens, duration=torch.tensor([10]), sft... FILE: src/models/detokenizer/resampler.py function FeedForward (line 9) | def FeedForward(dim, mult=4): function reshape_tensor (line 19) | def reshape_tensor(x, heads): class PerceiverAttention (line 30) | class PerceiverAttention(nn.Module): method __init__ (line 32) | def __init__(self, *, dim, dim_head=64, heads=8): method forward (line 46) | def forward(self, x, latents): class AttentionPool2d (line 78) | class AttentionPool2d(nn.Module): method __init__ (line 80) | def __init__(self, seq_len: int, embed_dim: int, num_heads: int, outpu... method forward (line 89) | def forward(self, x, return_all_tokens=False): class Resampler (line 119) | class Resampler(nn.Module): method __init__ (line 121) | def __init__( method forward (line 152) | def forward(self, x): class ResamplerXL (line 168) | class ResamplerXL(nn.Module): method __init__ (line 170) | def __init__( method forward (line 206) | def forward(self, x): class ResamplerXLV2 (line 226) | class ResamplerXLV2(nn.Module): method __init__ (line 228) | def __init__( method forward (line 266) | def forward(self, x,pooled_text_embeds=None): class ResamplerXLIdentity (line 288) | class ResamplerXLIdentity(nn.Module): method __init__ (line 289) | def __init__(self) -> None: method forward (line 292) | def forward(self, x, pooled_text_embeds=None): FILE: src/models/detokenizer_cotrain/modeling_flux_cotrain.py class StableAudioPositionalEmbedding (line 20) | class StableAudioPositionalEmbedding(nn.Module): method __init__ (line 25) | def __init__(self, dim: int): method forward (line 31) | def forward(self, times: torch.Tensor) -> torch.Tensor: class DurationEmbedder (line 39) | class DurationEmbedder(nn.Module): method __init__ (line 57) | def __init__( method forward (line 75) | def forward( function retrieve_timesteps (line 95) | def retrieve_timesteps( class Flux_T5_cotrain (line 138) | class Flux_T5_cotrain(nn.Module): method __init__ (line 140) | def __init__(self, config, text_encoder_dir=None, initialize_reference... method get_sigmas (line 188) | def get_sigmas(self, timesteps, n_dim=3, dtype=torch.float32): method encode_text_classifier_free (line 201) | def encode_text_classifier_free(self, prompt: List[str], T5_tokens_see... method encode_text (line 272) | def encode_text(self, prompt): method encode_duration (line 293) | def encode_duration(self, duration): method inference_flow (line 297) | def inference_flow( method encode_text_classifier_free_padding (line 419) | def encode_text_classifier_free_padding(self, prompt: List[str], T5_to... method inference_flow_padding (line 491) | def inference_flow_padding( method encode_text_classifier_free_full_tokens (line 613) | def encode_text_classifier_free_full_tokens(self, T5_tokens_seedx, num... method inference_flow_full_tokens (line 666) | def inference_flow_full_tokens( method forward (line 790) | def forward(self, latents, t5_tokens, duration=torch.tensor([10]), sft... method forward_fake (line 943) | def forward_fake(self, latents, t5_tokens, duration=torch.tensor([10])... FILE: src/models/mllm/generation.py class AutoAudioTokenGenerationProcessor (line 9) | class AutoAudioTokenGenerationProcessor(LogitsProcessor): method __init__ (line 11) | def __init__(self, tokenizer, num_aud_gen_tokens=32) -> None: method __call__ (line 19) | def __call__(self, input_ids, scores): class AutoT5TokenGenerationProcessor (line 39) | class AutoT5TokenGenerationProcessor(LogitsProcessor): method __init__ (line 41) | def __init__(self, tokenizer, num_t5_gen_tokens=64) -> None: method __call__ (line 49) | def __call__(self, input_ids, scores): FILE: src/models/mllm/load_qwenvl_llm.py function load_checkpoint (line 8) | def load_checkpoint(source_model, target_model): FILE: src/models/mllm/modeling_audiostory_llm.py function cosine_loss (line 40) | def cosine_loss(rec, target): function get_2d_sincos_pos_embed (line 47) | def get_2d_sincos_pos_embed(embed_dim, h_size, w_size, cls_token=False): function get_2d_sincos_pos_embed_from_grid (line 65) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 75) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): function get_abs_pos (line 96) | def get_abs_pos(abs_pos, tgt_size): class AudioStory_llm (line 116) | class AudioStory_llm(nn.Module): method __init__ (line 118) | def __init__(self, llm, input_resampler, output_resampler, whisper_res... method _init_weights (line 166) | def _init_weights(self, m): method build_audio_projector (line 176) | def build_audio_projector(self, projector_type, hidden_size, target_hi... method forward (line 196) | def forward(self, input_ids, attention_mask, labels, image_embeds, aud... method get_last_hidden_states (line 241) | def get_last_hidden_states(self, input_ids, attention_mask, labels, im... method generate_T5_audtoken_attn_multi_audio (line 298) | def generate_T5_audtoken_attn_multi_audio(self, method from_pretrained (line 415) | def from_pretrained(cls, llm, input_resampler, output_resampler, whisp... FILE: src/models/mllm/modeling_audiostory_unified.py function cosine_loss (line 40) | def cosine_loss(rec: torch.Tensor, target: torch.Tensor) -> torch.Tensor: class AudioStory_unified (line 55) | class AudioStory_unified(nn.Module): method __init__ (line 69) | def __init__( method build_audio_projector_layernorm (line 95) | def build_audio_projector_layernorm( method forward (line 109) | def forward( method inference_audiostory_tta (line 189) | def inference_audiostory_tta( method from_pretrained (line 233) | def from_pretrained( FILE: src/models/mllm/modeling_llama_xformer.py function _make_causal_mask (line 51) | def _make_causal_mask( function _expand_mask (line 82) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... class LlamaRotaryEmbedding (line 97) | class LlamaRotaryEmbedding(torch.nn.Module): method __init__ (line 99) | def __init__(self, dim, max_position_embeddings=2048, base=10000, devi... method forward (line 117) | def forward(self, x, seq_len=None): function rotate_half (line 134) | def rotate_half(x): function apply_rotary_pos_emb (line 141) | def apply_rotary_pos_emb(q, k, cos, sin, position_ids): class LlamaMLP (line 152) | class LlamaMLP(nn.Module): method __init__ (line 154) | def __init__( method forward (line 166) | def forward(self, x): class LlamaAttention (line 170) | class LlamaAttention(nn.Module): method __init__ (line 173) | def __init__(self, config: LlamaConfig): method _shape (line 190) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 193) | def forward( class LlamaDecoderLayer (line 247) | class LlamaDecoderLayer(nn.Module): method __init__ (line 249) | def __init__(self, config: LlamaConfig): method forward (line 261) | def forward( class LlamaPreTrainedModel (line 337) | class LlamaPreTrainedModel(PreTrainedModel): method _init_weights (line 344) | def _init_weights(self, module): method _set_gradient_checkpointing (line 355) | def _set_gradient_checkpointing(self, module, value=False): class LlamaModel (line 428) | class LlamaModel(LlamaPreTrainedModel): method __init__ (line 436) | def __init__(self, config: LlamaConfig): method get_input_embeddings (line 449) | def get_input_embeddings(self): method set_input_embeddings (line 452) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 456) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 477) | def forward( class LlamaForCausalLM (line 612) | class LlamaForCausalLM(LlamaPreTrainedModel): method __init__ (line 614) | def __init__(self, config): method get_input_embeddings (line 623) | def get_input_embeddings(self): method set_input_embeddings (line 626) | def set_input_embeddings(self, value): method get_output_embeddings (line 629) | def get_output_embeddings(self): method set_output_embeddings (line 632) | def set_output_embeddings(self, new_embeddings): method set_decoder (line 635) | def set_decoder(self, decoder): method get_decoder (line 638) | def get_decoder(self): method forward (line 643) | def forward( method prepare_inputs_for_generation (line 748) | def prepare_inputs_for_generation( method _reorder_cache (line 782) | def _reorder_cache(past_key_values, beam_idx): class LlamaForSequenceClassification (line 804) | class LlamaForSequenceClassification(LlamaPreTrainedModel): method __init__ (line 807) | def __init__(self, config): method get_input_embeddings (line 816) | def get_input_embeddings(self): method set_input_embeddings (line 819) | def set_input_embeddings(self, value): method forward (line 823) | def forward( FILE: src/models/mllm/peft_models.py function get_peft_model_with_resize_embedding (line 29) | def get_peft_model_with_resize_embedding(model, peft_config=None, model_... function get_model_with_resize_embedding (line 117) | def get_model_with_resize_embedding(model, vocab_size=None, torch_dtype=... function get_full_model_with_resize_embedding (line 162) | def get_full_model_with_resize_embedding(model, vocab_size=None, torch_d... FILE: src/models/mllm/utils.py function remove_mismatched_weights (line 9) | def remove_mismatched_weights(model, pretrained_state_dict): function load_zero3_checkpoint (line 28) | def load_zero3_checkpoint(module: nn.Module, state_dict, prefix="", erro... FILE: src/models/tokenizer/init_qwen_tokenizer.py function init_tokenizer (line 6) | def init_tokenizer(pretrained_model_path, add_tokens_path=None): FILE: src/models/tokenizer/init_qwen_tokenizer_special_token.py function init_tokenizer (line 6) | def init_tokenizer(pretrained_model_path, add_tokens_path=None): FILE: src/models/tokenizer/modeling_tangoflux.py class StableAudioPositionalEmbedding (line 19) | class StableAudioPositionalEmbedding(nn.Module): method __init__ (line 24) | def __init__(self, dim: int): method forward (line 30) | def forward(self, times: torch.Tensor) -> torch.Tensor: class DurationEmbedder (line 38) | class DurationEmbedder(nn.Module): method __init__ (line 56) | def __init__( method forward (line 74) | def forward( function retrieve_timesteps (line 94) | def retrieve_timesteps( class TangoFlux (line 137) | class TangoFlux(nn.Module): method __init__ (line 139) | def __init__(self, config, text_encoder_dir=None, initialize_reference... method get_sigmas (line 185) | def get_sigmas(self, timesteps, n_dim=3, dtype=torch.float32): method encode_text_classifier_free (line 198) | def encode_text_classifier_free(self, prompt: List[str], num_samples_p... method encode_text (line 255) | def encode_text(self, prompt): method encode_duration (line 276) | def encode_duration(self, duration): method inference_flow (line 280) | def inference_flow( method inference_text_prompt_tokens (line 398) | def inference_text_prompt_tokens( method forward (line 454) | def forward(self, latents, prompt, duration=torch.tensor([10]), sft=Tr... FILE: src/models/tokenizer/modeling_whisper.py function shift_tokens_right (line 44) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function _make_causal_mask (line 61) | def _make_causal_mask( function _expand_mask (line 79) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... function _compute_mask_indices (line 94) | def _compute_mask_indices( class WhisperPositionalEmbedding (line 213) | class WhisperPositionalEmbedding(nn.Embedding): method __init__ (line 214) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method forward (line 217) | def forward(self, input_ids, past_key_values_length=0): class WhisperAttention (line 221) | class WhisperAttention(nn.Module): method __init__ (line 224) | def __init__( method _shape (line 252) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 256) | def forward( class WhisperEncoderLayer (line 378) | class WhisperEncoderLayer(nn.Module): method __init__ (line 379) | def __init__(self, config: WhisperConfig): method forward (line 395) | def forward( class WhisperDecoderLayer (line 447) | class WhisperDecoderLayer(nn.Module): method __init__ (line 448) | def __init__(self, config: WhisperConfig): method forward (line 474) | def forward( class WhisperPreTrainedModel (line 564) | class WhisperPreTrainedModel(PreTrainedModel): method _init_weights (line 571) | def _init_weights(self, module): method _set_gradient_checkpointing (line 582) | def _set_gradient_checkpointing(self, module, value=False): method _get_feat_extract_output_lengths (line 586) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class WhisperEncoder (line 724) | class WhisperEncoder(WhisperPreTrainedModel): method __init__ (line 733) | def __init__(self, config: WhisperConfig): method _freeze_parameters (line 759) | def _freeze_parameters(self): method get_input_embeddings (line 764) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 767) | def set_input_embeddings(self, value: nn.Module): method forward (line 770) | def forward( class WhisperDecoder (line 876) | class WhisperDecoder(WhisperPreTrainedModel): method __init__ (line 884) | def __init__(self, config: WhisperConfig): method get_input_embeddings (line 904) | def get_input_embeddings(self): method set_input_embeddings (line 907) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 910) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 932) | def forward( class WhisperModel (line 1137) | class WhisperModel(WhisperPreTrainedModel): method __init__ (line 1140) | def __init__(self, config: WhisperConfig): method get_input_embeddings (line 1148) | def get_input_embeddings(self): method set_input_embeddings (line 1151) | def set_input_embeddings(self, value): method get_encoder (line 1154) | def get_encoder(self): method get_decoder (line 1157) | def get_decoder(self): method freeze_encoder (line 1160) | def freeze_encoder(self): method _mask_input_features (line 1167) | def _mask_input_features( method forward (line 1212) | def forward( class WhisperForConditionalGeneration (line 1323) | class WhisperForConditionalGeneration(WhisperPreTrainedModel): method __init__ (line 1334) | def __init__(self, config: WhisperConfig): method get_encoder (line 1342) | def get_encoder(self): method get_decoder (line 1345) | def get_decoder(self): method resize_token_embeddings (line 1348) | def resize_token_embeddings(self, new_num_tokens: int) -> nn.Embedding: method get_output_embeddings (line 1352) | def get_output_embeddings(self): method set_output_embeddings (line 1355) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 1358) | def get_input_embeddings(self) -> nn.Module: method freeze_encoder (line 1361) | def freeze_encoder(self): method forward (line 1370) | def forward( method generate (line 1466) | def generate( method prepare_inputs_for_generation (line 1638) | def prepare_inputs_for_generation( method _reorder_cache (line 1661) | def _reorder_cache(past_key_values, beam_idx): class WhisperForAudioClassification (line 1675) | class WhisperForAudioClassification(WhisperPreTrainedModel): method __init__ (line 1676) | def __init__(self, config): method freeze_encoder (line 1689) | def freeze_encoder(self): method get_input_embeddings (line 1696) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1699) | def set_input_embeddings(self, value: nn.Module): method forward (line 1704) | def forward( class Whisper_Resampler_llava (line 1797) | class Whisper_Resampler_llava(nn.Module): method __init__ (line 1798) | def __init__(self, token_num, ori_embed_dim, tgt_embed_dim): method _init_weights (line 1816) | def _init_weights(self, m): method forward (line 1825) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Whisper_Resampler_llava_old (line 1837) | class Whisper_Resampler_llava_old(nn.Module): method __init__ (line 1838) | def __init__(self, window_size, ori_embed_dim, tgt_embed_dim): method _init_weights (line 1853) | def _init_weights(self, m): method forward (line 1862) | def forward(self, x: torch.Tensor) -> torch.Tensor: FILE: src/models/tokenizer/modeling_whisper_inference.py function shift_tokens_right (line 44) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... function _make_causal_mask (line 61) | def _make_causal_mask( function _expand_mask (line 79) | def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Option... function _compute_mask_indices (line 94) | def _compute_mask_indices( class WhisperPositionalEmbedding (line 213) | class WhisperPositionalEmbedding(nn.Embedding): method __init__ (line 214) | def __init__(self, num_positions: int, embedding_dim: int, padding_idx... method forward (line 217) | def forward(self, input_ids, past_key_values_length=0): class WhisperAttention (line 221) | class WhisperAttention(nn.Module): method __init__ (line 224) | def __init__( method _shape (line 252) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 256) | def forward( class WhisperEncoderLayer (line 378) | class WhisperEncoderLayer(nn.Module): method __init__ (line 379) | def __init__(self, config: WhisperConfig): method forward (line 395) | def forward( class WhisperDecoderLayer (line 447) | class WhisperDecoderLayer(nn.Module): method __init__ (line 448) | def __init__(self, config: WhisperConfig): method forward (line 474) | def forward( class WhisperPreTrainedModel (line 564) | class WhisperPreTrainedModel(PreTrainedModel): method _init_weights (line 571) | def _init_weights(self, module): method _set_gradient_checkpointing (line 582) | def _set_gradient_checkpointing(self, module, value=False): method _get_feat_extract_output_lengths (line 586) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... class WhisperEncoder (line 724) | class WhisperEncoder(WhisperPreTrainedModel): method __init__ (line 733) | def __init__(self, config: WhisperConfig): method _freeze_parameters (line 756) | def _freeze_parameters(self): method get_input_embeddings (line 761) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 764) | def set_input_embeddings(self, value: nn.Module): method forward (line 767) | def forward( class WhisperDecoder (line 871) | class WhisperDecoder(WhisperPreTrainedModel): method __init__ (line 879) | def __init__(self, config: WhisperConfig): method get_input_embeddings (line 899) | def get_input_embeddings(self): method set_input_embeddings (line 902) | def set_input_embeddings(self, value): method _prepare_decoder_attention_mask (line 905) | def _prepare_decoder_attention_mask(self, attention_mask, input_shape,... method forward (line 927) | def forward( class WhisperModel (line 1132) | class WhisperModel(WhisperPreTrainedModel): method __init__ (line 1135) | def __init__(self, config: WhisperConfig): method get_input_embeddings (line 1143) | def get_input_embeddings(self): method set_input_embeddings (line 1146) | def set_input_embeddings(self, value): method get_encoder (line 1149) | def get_encoder(self): method get_decoder (line 1152) | def get_decoder(self): method freeze_encoder (line 1155) | def freeze_encoder(self): method _mask_input_features (line 1162) | def _mask_input_features( method forward (line 1207) | def forward( class WhisperForConditionalGeneration (line 1302) | class WhisperForConditionalGeneration(WhisperPreTrainedModel): method __init__ (line 1313) | def __init__(self, config: WhisperConfig): method get_encoder (line 1321) | def get_encoder(self): method get_decoder (line 1324) | def get_decoder(self): method resize_token_embeddings (line 1327) | def resize_token_embeddings(self, new_num_tokens: int) -> nn.Embedding: method get_output_embeddings (line 1331) | def get_output_embeddings(self): method set_output_embeddings (line 1334) | def set_output_embeddings(self, new_embeddings): method get_input_embeddings (line 1337) | def get_input_embeddings(self) -> nn.Module: method freeze_encoder (line 1340) | def freeze_encoder(self): method forward (line 1349) | def forward( method generate (line 1445) | def generate( method prepare_inputs_for_generation (line 1617) | def prepare_inputs_for_generation( method _reorder_cache (line 1640) | def _reorder_cache(past_key_values, beam_idx): class WhisperForAudioClassification (line 1654) | class WhisperForAudioClassification(WhisperPreTrainedModel): method __init__ (line 1655) | def __init__(self, config): method freeze_encoder (line 1668) | def freeze_encoder(self): method get_input_embeddings (line 1675) | def get_input_embeddings(self) -> nn.Module: method set_input_embeddings (line 1678) | def set_input_embeddings(self, value: nn.Module): method forward (line 1683) | def forward( FILE: src/models/tokenizer/qwen_visual.py function get_abs_pos (line 24) | def get_abs_pos(abs_pos, tgt_size): function get_2d_sincos_pos_embed (line 44) | def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False): function get_2d_sincos_pos_embed_from_grid (line 62) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 73) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): class Resampler (line 94) | class Resampler(nn.Module): method __init__ (line 102) | def __init__(self, grid_size, embed_dim, num_heads, kv_dim=None, norm_... method _init_weights (line 132) | def _init_weights(self, m): method forward (line 141) | def forward(self, x, attn_mask=None): method _repeat (line 153) | def _repeat(self, query, N: int): method __init__ (line 165) | def __init__(self, grid_size, embed_dim, num_heads, kv_dim=None, norm_... method _init_weights (line 195) | def _init_weights(self, m): method forward (line 204) | def forward(self, x, attn_mask=None): method _repeat (line 216) | def _repeat(self, query, N: int): class Resampler (line 157) | class Resampler(nn.Module): method __init__ (line 102) | def __init__(self, grid_size, embed_dim, num_heads, kv_dim=None, norm_... method _init_weights (line 132) | def _init_weights(self, m): method forward (line 141) | def forward(self, x, attn_mask=None): method _repeat (line 153) | def _repeat(self, query, N: int): method __init__ (line 165) | def __init__(self, grid_size, embed_dim, num_heads, kv_dim=None, norm_... method _init_weights (line 195) | def _init_weights(self, m): method forward (line 204) | def forward(self, x, attn_mask=None): method _repeat (line 216) | def _repeat(self, query, N: int): class VisualAttention (line 220) | class VisualAttention(nn.Module): method __init__ (line 227) | def __init__(self, embed_dim, num_heads, bias=True, kdim=None, vdim=No... method forward (line 248) | def forward(self, query, key, value, attn_mask=None): class VisualAttentionBlock (line 301) | class VisualAttentionBlock(nn.Module): method __init__ (line 303) | def __init__( method attention (line 325) | def attention( method forward (line 338) | def forward( class TransformerBlock (line 353) | class TransformerBlock(nn.Module): method __init__ (line 355) | def __init__( method get_cast_dtype (line 371) | def get_cast_dtype(self) -> torch.dtype: method get_cast_device (line 374) | def get_cast_device(self) -> torch.device: method forward (line 377) | def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor] =... class VisionTransformerWithAttnPool (line 393) | class VisionTransformerWithAttnPool(nn.Module): method __init__ (line 395) | def __init__(self, method forward (line 455) | def forward(self, x: torch.Tensor, patch_positions: Optional[torch.Ten... method encode (line 487) | def encode(self, image_paths: List[str]): method from_pretrained (line 500) | def from_pretrained(cls, pretrained_model_path=None, **kwargs): class VisionTransformer (line 530) | class VisionTransformer(nn.Module): method __init__ (line 532) | def __init__(self, method forward (line 575) | def forward(self, x: torch.Tensor): method encode (line 596) | def encode(self, image_paths: List[str]): FILE: src/processer/tokenizer.py function bert_tokenizer (line 4) | def bert_tokenizer(pretrained_model_name_or_path): FILE: src/processer/transforms.py function get_transform (line 5) | def get_transform(type='clip', keep_ratio=True, image_size=224):